| name: Backend E2E Test |
| |
| on: |
| push: |
| branches: |
| - master |
| paths: |
| - 'api/**' |
| pull_request: |
| branches: |
| - master |
| paths: |
| - 'api/**' |
| |
| concurrency: |
| group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }} |
| cancel-in-progress: true |
| |
| jobs: |
| backend-e2e-test: |
| runs-on: ubuntu-latest |
| |
| steps: |
| - uses: actions/checkout@v3 |
| |
| - name: setup go |
| uses: actions/setup-go@v3 |
| with: |
| go-version: "1.17" |
| |
| - uses: docker/setup-buildx-action@v1 |
| |
| - uses: actions/cache@v2 |
| with: |
| path: /tmp/.buildx-cache |
| key: ${{ runner.os }}-buildx-apisixdashboard-${{ github.sha }} |
| restore-keys: | |
| ${{ runner.os }}-buildx-apisixdashboard- |
| ${{ runner.os }}-buildx- |
| |
| - name: Modify conf.yaml Configure for use by the manage-api cluster |
| run: | |
| sed -i 's/127.0.0.1:2379/172.16.238.10:2379/' ./api/conf/conf.yaml |
| sed -i 's@127.0.0.1@0.0.0.0/0@' ./api/conf/conf.yaml |
| sed -i '/172.16.238.10:2379/a\ - 172.16.238.11:2379' ./api/conf/conf.yaml |
| sed -i '/172.16.238.10:2379/a\ - 172.16.238.12:2379' ./api/conf/conf.yaml |
| |
| - name: download file Dockerfile-apisix |
| working-directory: ./api/test/docker |
| run: | |
| curl -o Dockerfile-apisix https://raw.githubusercontent.com/apache/apisix-docker/master/alpine/Dockerfile |
| |
| - name: build docker images |
| working-directory: ./api/test/docker |
| continue-on-error: true |
| run: | |
| docker buildx bake --load \ |
| -f docker-compose.yaml \ |
| --set *.cache-from=type=local,src=/tmp/.buildx-cache \ |
| --set *.cache-to=type=local,dest=/tmp/.buildx-cache |
| |
| - name: build and start grpc_server_example |
| working-directory: ./api/test/docker |
| run: | |
| wget https://github.com/api7/grpc_server_example/archive/refs/tags/20210819.tar.gz |
| tar -xzvf 20210819.tar.gz && cd grpc_server_example-20210819 |
| docker build -t grpc_server_example:latest . |
| |
| - name: run docker compose |
| working-directory: ./api/test/docker |
| run: | |
| docker-compose up -d |
| sleep 5 |
| docker logs docker_managerapi_1 |
| |
| - name: install ginkgo cli |
| run: go install github.com/onsi/ginkgo/ginkgo@v1.16.5 |
| |
| - name: run test |
| working-directory: ./api/test/e2e |
| run: ginkgo -r |
| |
| - name: stop docker compose |
| working-directory: ./api/test/docker |
| run: | |
| docker-compose down |
| sleep 10 |
| |
| - name: output test coverage |
| working-directory: ./api/test/testdata |
| run: | |
| go tool cover -func=./integrationcover.out |
| |
| - name: upload coverage profile |
| working-directory: ./api/test/testdata |
| run: | |
| bash <(curl -s https://codecov.io/bash) -f ./integrationcover.out -F backend-e2e-test-ginkgo |