| name: APISIX Docker Test |
| |
| on: |
| push: |
| branches: |
| - master |
| pull_request: |
| branches: |
| - master |
| |
| jobs: |
| build: |
| strategy: |
| fail-fast: false |
| matrix: |
| platform: |
| - alpine |
| - centos |
| - alpine-local |
| - alpine-dev |
| |
| runs-on: ubuntu-latest |
| env: |
| APISIX_PATH: "./apisix-local" |
| APISIX_DOCKER_TAG: 2.12.1-${{ matrix.platform }} |
| steps: |
| - uses: actions/checkout@v2 |
| |
| - name: Clone apisix for local test |
| if: ${{ matrix.platform == 'alpine-local' }} |
| run: | |
| git clone --depth 1 http://github.com/apache/apisix apisix-local |
| |
| - name: Build and run |
| run: | |
| make build-on-${{ matrix.platform }} |
| docker-compose -f ./compose/docker-compose.yaml up -d |
| sleep 30 |
| docker logs compose_apisix_1 |
| |
| - name: Test |
| run: | |
| grep -C 3 '\[error\]' example/apisix_log/error.log && exit 1 |
| |
| curl http://127.0.0.1:9080/apisix/admin/routes/1 \ |
| -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' |
| { |
| "uri": "/get", |
| "upstream": { |
| "type": "roundrobin", |
| "nodes": { |
| "httpbin.org:80": 1 |
| } |
| } |
| }' |
| |
| result_code=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/get` |
| if [[ $result_code -ne 200 ]];then |
| printf "result_code: %s\n" "$result_code" |
| exit 125 |
| fi |
| |
| - name: Tar Image |
| if: ${{ !endsWith(matrix.platform, '-local') && !endsWith(matrix.platform, '-dev') }} |
| run: | |
| make save-${{ matrix.platform }}-tar |
| |
| - name: Upload Image |
| if: ${{ !endsWith(matrix.platform, '-local') && !endsWith(matrix.platform, '-dev') }} |
| uses: actions/upload-artifact@v2 |
| with: |
| path: ./package |