Astarte end-to-end test #123
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: Astarte end-to-end test | |
| on: | |
| # Run when pushing to stable branches | |
| push: | |
| paths: | |
| - "apps/**" | |
| - "tools/astarte_e2e/**" | |
| - ".github/workflows/astarte-end-to-end-test-workflow.yaml" | |
| branches: | |
| - "master" | |
| - "release-*" | |
| # Run on branch/tag creation | |
| create: | |
| # Run on pull requests matching apps | |
| pull_request: | |
| paths: | |
| - "apps/**" | |
| - "tools/astarte_e2e/**" | |
| - ".github/workflows/astarte-end-to-end-test-workflow.yaml" | |
| # Allow this workflow to be called by others | |
| workflow_call: | |
| env: | |
| elixir_version: "1.15" | |
| otp_version: "26.1" | |
| jobs: | |
| e2e-build: | |
| uses: ./.github/workflows/astarte-e2e-build-workflow.yaml | |
| astarte-build: | |
| uses: ./.github/workflows/astarte-build-workflow.yaml | |
| end-to-end-test: | |
| needs: [e2e-build, astarte-build] | |
| name: End-to-end Test | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Initialize docker compose files | |
| run: docker run -v $(pwd)/compose:/compose astarte/docker-compose-initializer | |
| - name: Restore astarte images | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: astarte-images | |
| path: ${{ runner.temp }} | |
| - name: Restore astarte e2e image | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: astarte-e2e-image | |
| path: ${{ runner.temp }} | |
| - name: Load astarte images | |
| run: ls ${{ runner.temp }}/*.tar | xargs --max-args 1 docker load --input | |
| - name: Start all Astarte services | |
| run: docker compose up -d | |
| - name: Wait for Astarte to come up | |
| run: | | |
| wget https://github.com/astarte-platform/wait-for-astarte-docker-compose/releases/download/v1.1.0/wait-for-astarte-docker-compose_1.1.0_linux_amd64.tar.gz | |
| tar xf wait-for-astarte-docker-compose_1.1.0_linux_amd64.tar.gz | |
| ./wait-for-astarte-docker-compose | |
| - name: Install astartectl | |
| run: | | |
| wget https://github.com/astarte-platform/astartectl/releases/download/v22.11.02/astartectl_22.11.02_linux_x86_64.tar.gz | |
| tar xf astartectl_22.11.02_linux_x86_64.tar.gz | |
| chmod +x astartectl | |
| - name: Generate realm keypair and JWT | |
| run: | | |
| ./astartectl utils gen-keypair test | |
| E2E_HOUSEKEEPING_API_JWT=$(./astartectl utils gen-jwt housekeeping -k compose/astarte-keys/housekeeping_private.pem) | |
| echo "E2E_HOUSEKEEPING_API_JWT=$E2E_HOUSEKEEPING_API_JWT" >> $GITHUB_ENV | |
| - name: Generate JWT | |
| run: | | |
| JWT=$(./astartectl utils gen-jwt appengine channels pairing realm-management -k test_private.pem) | |
| echo "E2E_JWT=$JWT" >> $GITHUB_ENV | |
| - name: Run Astarte E2E | |
| working-directory: tools/astarte_e2e | |
| env: | |
| E2E_HOST: "astarte-e2e" | |
| E2E_PAIRING_URL: http://api.astarte.localhost/pairing | |
| E2E_APPENGINE_URL: http://api.astarte.localhost/appengine | |
| E2E_HOUSEKEEPING_URL: http://api.astarte.localhost/housekeeping | |
| E2E_REALM_MANAGEMENT_URL: http://api.astarte.localhost/realmmanagement | |
| E2E_AMQP_CONSUMER_HOST: rabbitmq | |
| E2E_IGNORE_SSL_ERRORS: true | |
| E2E_CHECK_INTERVAL_SECONDS: 5 | |
| E2E_CHECK_REPETITIONS: 5 | |
| E2E_MAILER_TO_ADDRESS: mail@example.com | |
| E2E_MAIL_SUBJECT: "Subj: Astarte Notification" | |
| run: | | |
| docker run \ | |
| -e E2E_REALM_PUBLIC_KEY_PEM="$(cat ../../test_public.pem)" \ | |
| --env-file=<(env | grep '^E2E_' | grep -v '^E2E_REALM_PUBLIC_KEY_PEM=') \ | |
| --network astarte \ | |
| --hostname "$E2E_HOST" \ | |
| astarte-e2e | |
| - name: Check Docker | |
| if: ${{ failure() }} | |
| run: docker compose logs | |
| - name: Bring down Astarte docker-compose | |
| run: docker compose down |