Repository navigation
Optional E2E tests for 8df8d056a6314c214a4824423600fe3759e3650d (47131222907-1) #5140
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: 'CI: Optional E2E Tests' | |
| run-name: Optional E2E tests for ${{ inputs.commit }} (${{ inputs.correlation_id }}) | |
| # Dispatched by `job_optional_e2e_tests` in build.yml. This is a separate workflow because GitHub | |
| # does not count failed checks of a dispatched run in the PR status, so these failures do not mark | |
| # the PR as failed. | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| commit: | |
| description: The commit to build and test | |
| required: true | |
| matrix: | |
| description: The optional E2E test matrix as JSON | |
| required: true | |
| pr_number: | |
| description: The PR that the run is for, if there is one | |
| required: false | |
| correlation_id: | |
| description: Lets the dispatching job find this run | |
| required: true | |
| # Like build.yml: a new push to a PR cancels the old run, other runs are never cancelled. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ inputs.pr_number || github.run_id }} | |
| cancel-in-progress: true | |
| env: | |
| HEAD_COMMIT: ${{ inputs.commit }} | |
| CACHED_DEPENDENCY_PATHS: | | |
| ${{ github.workspace }}/node_modules | |
| ${{ github.workspace }}/packages/*/node_modules | |
| ${{ github.workspace }}/dev-packages/*/node_modules | |
| ~/.cache/mongodb-binaries/ | |
| # See build.yml | |
| DISABLE_V8_COMPILE_CACHE: '1' | |
| jobs: | |
| job_optional_e2e_tests: | |
| name: E2E ${{ matrix.label || matrix.test-application }} Test (optional) | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| permissions: | |
| contents: read | |
| actions: read | |
| # Keep the secrets the same as in job_e2e_tests_with_secrets (build.yml). | |
| env: | |
| E2E_TEST_AUTH_TOKEN: ${{ matrix.needs-secrets && secrets.E2E_TEST_AUTH_TOKEN || '' }} | |
| E2E_TEST_DSN: ${{ matrix.needs-secrets && secrets.E2E_TEST_DSN || 'https://username@domain/123' }} | |
| # Needed because some apps expect a certain prefix | |
| NEXT_PUBLIC_E2E_TEST_DSN: ${{ matrix.needs-secrets && secrets.E2E_TEST_DSN || 'https://username@domain/123' }} | |
| PUBLIC_E2E_TEST_DSN: ${{ matrix.needs-secrets && secrets.E2E_TEST_DSN || 'https://username@domain/123' }} | |
| REACT_APP_E2E_TEST_DSN: ${{ matrix.needs-secrets && secrets.E2E_TEST_DSN || 'https://username@domain/123' }} | |
| E2E_TEST_SENTRY_ORG_SLUG: 'sentry-javascript-sdks' | |
| E2E_TEST_SENTRY_PROJECT: 'sentry-javascript-e2e-tests' | |
| E2E_OPENROUTER_API_KEY: ${{ matrix.needs-secrets && secrets.E2E_OPENROUTER_API_KEY || '' }} | |
| # Only this app talks to OpenAI directly (OpenRouter has no Decisions route), so only it gets the key. | |
| E2E_OPENAI_DECISIONS_API_KEY: | |
| ${{ matrix.test-application == 'node-openai-decisions' && secrets.E2E_OPENAI_DECISIONS_API_KEY || '' }} | |
| # Used by test apps that deploy a real Cloudflare Worker, e.g. cloudflare-workers-send-to-sentry | |
| CLOUDFLARE_API_TOKEN: ${{ matrix.needs-secrets && secrets.CLOUDFLARE_API_TOKEN || '' }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ matrix.needs-secrets && secrets.CLOUDFLARE_ACCOUNT_ID || '' }} | |
| # Keeps the Worker name at `<prefix>-pr-<number>`, which the cleanup-e2e-workers workflow deletes | |
| E2E_PR_NUMBER: ${{ inputs.pr_number }} | |
| # The `runtime` of a runtime variant, see dev-packages/e2e-tests/README.md | |
| RUNTIME: ${{ matrix.runtime }} | |
| SENTRY_E2E_TEST_SHARD: ${{ matrix.test-shard }} | |
| # Without the root node_modules, `pnpm run` would first install the whole workspace. | |
| pnpm_config_verify_deps_before_run: 'false' | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(inputs.matrix) }} | |
| steps: | |
| - name: Check out commit ${{ env.HEAD_COMMIT }} | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ env.HEAD_COMMIT }} | |
| - name: Build SDK packages locally | |
| uses: ./.github/actions/build-local-sdk | |
| with: | |
| package-path: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }} | |
| targets: build:tarball | |
| - name: Prepare E2E test application | |
| uses: ./.github/actions/prepare-e2e-test | |
| with: | |
| test-application: ${{ matrix.test-application }} | |
| runtime: ${{ matrix.runtime }} | |
| bun-version: ${{ matrix.bun-version }} | |
| deno-version: ${{ matrix.deno-version }} | |
| download-artifacts: 'false' | |
| - name: Start E2E databases | |
| background: true | |
| working-directory: ${{ runner.temp }}/test-application | |
| run: | | |
| if [ -f docker-compose.yml ]; then | |
| docker compose up -d --wait | |
| fi | |
| # Installs Playwright while the app builds. Keep it right before the build: the runner sets up a background | |
| # composite action's steps from the job's shared `github` context, which fails with "Collection was modified" if | |
| # a foreground step starts at that moment. Starting next to `download-artifact` also made it fail to read the event file. | |
| - name: Install Playwright | |
| id: install-playwright | |
| background: true | |
| uses: ./.github/actions/install-playwright | |
| with: | |
| browsers: chromium | |
| cwd: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }} | |
| - name: Build E2E app | |
| working-directory: ${{ runner.temp }}/test-application | |
| timeout-minutes: 7 | |
| run: ${{ matrix.build-command || 'pnpm test:build' }} | |
| - wait-all: | |
| - name: Run E2E test | |
| working-directory: ${{ runner.temp }}/test-application | |
| timeout-minutes: 10 | |
| run: ${{ matrix.assert-command || 'pnpm test:assert' }} | |
| # A separate job in this workflow, so that a re-run of this run (all jobs or only the failed ones) also updates the | |
| # comment. GitHub re-runs the jobs that depend on a re-run job. | |
| job_report: | |
| name: Report in PR comment | |
| needs: [job_optional_e2e_tests] | |
| # Not for a cancelled run: a new push cancels the old run, and the new run reports. | |
| if: ${{ !cancelled() && inputs.pr_number != '' }} | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 5 | |
| permissions: | |
| contents: read | |
| actions: read | |
| pull-requests: write | |
| steps: | |
| - name: Check out commit ${{ env.HEAD_COMMIT }} | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ env.HEAD_COMMIT }} | |
| - name: Set up Node | |
| uses: ./.github/actions/setup-node | |
| - name: Install pnpm | |
| uses: ./.github/actions/install-pnpm | |
| - name: Install action dependencies | |
| run: pnpm install --frozen-lockfile --filter @sentry-internal/optional-e2e-gh-action | |
| - name: Report optional E2E results | |
| uses: ./dev-packages/optional-e2e-gh-action | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| mode: report | |
| pr_number: ${{ inputs.pr_number }} |