Repository navigation
150 lines (139 loc) · 6.33 KB
/
Copy pathoptional-e2e.yml
File metadata and controls
150 lines (139 loc) · 6.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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:
# Only here so that GitHub registers this workflow before it is on the default branch, which a
# dispatch needs. The job is skipped for this event. Remove this trigger after the merge.
pull_request:
workflow_dispatch:
inputs:
commit:
description: The commit that the tarballs were built from
required: true
build_run_id:
description: The build.yml run that uploaded the tarball artifacts
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 }}
# See build.yml
DISABLE_V8_COMPILE_CACHE: '1'
jobs:
job_optional_e2e_tests:
name: E2E ${{ matrix.label || matrix.test-application }} Test (optional)
if: github.event_name == 'workflow_dispatch'
# Same cache volume as the E2E jobs in build.yml. The event is always `workflow_dispatch`, so the PR number
# decides if the run gets the PR volume.
runs-on:
namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript-e2e${{ inputs.pr_number != '' && '-pr'
|| '' }}
timeout-minutes: 15
permissions:
contents: read
# To download the artifacts of the build.yml run
actions: read
env:
E2E_TEST_AUTH_TOKEN: ${{ secrets.E2E_TEST_AUTH_TOKEN }}
E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }}
# Needed because some apps expect a certain prefix
NEXT_PUBLIC_E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }}
PUBLIC_E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }}
REACT_APP_E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }}
E2E_TEST_SENTRY_ORG_SLUG: 'sentry-javascript-sdks'
E2E_TEST_SENTRY_PROJECT: 'sentry-javascript-e2e-tests'
E2E_OPENROUTER_API_KEY: ${{ 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-send-to-sentry' && 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: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ 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 }}
# Without the root node_modules, `pnpm run` would first install the whole workspace.
pnpm_config_verify_deps_before_run: 'false'
strategy:
fail-fast: false
# The fallback only keeps the expression valid for the skipped `pull_request` run.
matrix: ${{ fromJson(inputs.matrix || '{"include":[{}]}') }}
steps:
- name: Check out commit ${{ env.HEAD_COMMIT }}
uses: actions/checkout@v7
with:
ref: ${{ env.HEAD_COMMIT }}
- name: Prepare E2E test application
uses: ./.github/actions/prepare-e2e-test
with:
test-application: ${{ matrix.test-application }}
runtime: ${{ matrix.runtime }}
deno-version: ${{ matrix.deno-version }}
artifacts-run-id: ${{ inputs.build_run_id }}
github-token: ${{ github.token }}
# 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: [install-playwright]
- 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() && github.event_name == 'workflow_dispatch' && 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: actions/setup-node@v7
with:
node-version-file: 'package.json'
- 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 }}