Skip to content

Commit 7d4907a

Browse files
authored
Merge pull request #12 from andrewshan/main
feat: 优化限流标签,增加一键打包
2 parents a65d682 + f87b7de commit 7d4907a

File tree

420 files changed

+223708
-464
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

420 files changed

+223708
-464
lines changed

.github/workflows/release.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
release:
9+
name: Release polaris
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
16+
- name: Get version
17+
id: get_version
18+
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
19+
20+
- name: Build
21+
id: build
22+
env:
23+
VERSION: ${{ steps.get_version.outputs.VERSION }}
24+
run: |
25+
pushd build
26+
bash build.sh ${VERSION}
27+
popd
28+
PACKAGE_NAME=$(ls | grep nginx-gateway-release*.tar.gz | sed -n '1p')
29+
echo ::set-output name=name::${PACKAGE_NAME}
30+
31+
- name: Upload asset
32+
uses: actions/upload-release-asset@v1
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
with:
36+
upload_url: ${{ github.event.release.upload_url }}
37+
asset_path: ./${{ steps.build.outputs.name }}
38+
asset_name: ${{ steps.build.outputs.name }}
39+
asset_content_type: application/gzip

.github/workflows/testing.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: run test
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: clean
17+
run: |
18+
pushd build
19+
./clean.sh
20+
popd
21+
- name: make
22+
run: |
23+
pushd build
24+
./make.sh
25+
popd

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.idea
2+
*.log
3+
*.exe
4+
**/*.exe
5+
# Build output
6+
target
7+
.vscode/
8+
.codecc/

.gitmodules

Whitespace-only changes.

build/build.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
set -e
3+
4+
version="debug"
5+
if [ $# == 1 ]; then
6+
version=$1
7+
fi
8+
echo "build nginx-gateway for version ${version}"
9+
# first make the polaris-cpp
10+
pushd ../third_party
11+
rm -rf polaris-cpp
12+
git clone -b release_v1.1.0 https://github.com/polarismesh/polaris-cpp polaris-cpp
13+
14+
pushd polaris-cpp
15+
make
16+
make package
17+
# copy libraries and headers
18+
tar xf polaris_cpp_sdk.tar.gz
19+
popd
20+
21+
mv polaris-cpp/polaris_cpp_sdk/* polaris_client/
22+
# build nginx
23+
build_os=$(uname -s)
24+
build_arch=$(uname -p)
25+
folder_name=$(echo "nginx-gateway-release-${version}.${build_os}.${build_arch}" | tr 'A-Z' 'a-z')
26+
echo "target name $folder_name"
27+
rm -rf ../$folder_name
28+
mkdir -p ../$folder_name
29+
30+
pushd nginx-1.18.0/
31+
chmod +x configure
32+
./configure \
33+
--prefix=../../$folder_name \
34+
--add-module=../../source/nginx_polaris_limit_module \
35+
--add-module=../polaris_client \
36+
--with-stream
37+
make
38+
make install
39+
popd
40+
41+
pushd ..
42+
cp polaris.yaml $folder_name/conf/
43+
tar czf "$folder_name.tar.gz" $folder_name
44+
popd
45+
46+
popd

build/clean.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
set -e
3+
4+
rm -rf ../target
5+
pushd ../third_party
6+
rm nginx-1.18.0/Makefile
7+
rm -rf nginx-1.18.0/objs
8+
pushd polaris-cpp
9+
make clean
10+
popd
11+
popd

build/make.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
pushd ../third_party
6+
rm -rf polaris-cpp
7+
git clone -b release_v1.1.0 https://github.com/polarismesh/polaris-cpp polaris-cpp
8+
9+
pushd polaris-cpp
10+
make
11+
make package
12+
# copy libraries and headers
13+
tar xf polaris_cpp_sdk.tar.gz
14+
popd
15+
16+
mv polaris-cpp/polaris_cpp_sdk/* polaris_client/
17+
# build nginx
18+
build_os=$(uname -s)
19+
build_arch=$(uname -p)
20+
folder_name="target"
21+
echo "target name $folder_name"
22+
rm -rf ../$folder_name
23+
mkdir -p ../$folder_name
24+
25+
pushd nginx-1.18.0/
26+
chmod +x configure
27+
./configure \
28+
--prefix=../../$folder_name \
29+
--add-module=../../source/nginx_polaris_limit_module \
30+
--add-module=../polaris_client \
31+
--with-stream
32+
make
33+
popd
34+
35+
popd

0 commit comments

Comments
 (0)