API Tests #164
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: API Tests | |
| on: | |
| workflow_dispatch: | |
| push: | |
| schedule: | |
| - cron: '0 4 * * *' | |
| jobs: | |
| run-api-tests: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| flavor: [regular-noauth] | |
| fail-fast: false | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Install docker-compose | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y docker-compose | |
| - name: Set up dependencies for ${{ matrix.flavor }} | |
| run: | | |
| docker run -d \ | |
| -p 8585:8080 \ | |
| -p 9090:9090 \ | |
| -p 8081:8081 \ | |
| --add-host=host.docker.internal:host-gateway \ | |
| --name microcks \ | |
| quay.io/microcks/microcks-uber:nightly | |
| sleep 30 | |
| docker logs microcks | |
| - name: Upload API artifacts to Microcks | |
| run: | | |
| docker run --rm --add-host=host.docker.internal:host-gateway \ | |
| -v "${{ github.workspace }}/samples:/samples" \ | |
| -v "${{ github.workspace }}/testsuite:/scripts" \ | |
| -e BASE_URL="http://host.docker.internal:8585" \ | |
| -e MICROCKS_TOKEN="microcks" \ | |
| curlimages/curl:latest sh /scripts/upload-artifacts.sh | |
| - name: Run API tests for ${{ matrix.flavor }} | |
| env: | |
| FLAVOR: ${{ matrix.flavor }} | |
| HOST: host.docker.internal | |
| PORT: 8585 | |
| GRPC_PORT: 9090 | |
| KEYCLOAK_URL: http://host.docker.internal:8180 | |
| run: | | |
| docker run --rm \ | |
| --add-host=host.docker.internal:host-gateway \ | |
| -e FLAVOR=$FLAVOR \ | |
| -e HOST=$HOST \ | |
| -e PORT=$PORT \ | |
| -e KEYCLOAK_URL=$KEYCLOAK_URL \ | |
| -e GRPC_PORT=$GRPC_PORT \ | |
| -v "$PWD:/scripts" \ | |
| -w /scripts/testsuite \ | |
| grafana/k6:latest \ | |
| run api-tests.js | |
| - name: Teardown all containers after tests | |
| if: always() | |
| run: | | |
| echo "Cleaning up all Docker containers..." | |
| docker stop microcks |