-
-
Notifications
You must be signed in to change notification settings - Fork 367
Expand file tree
/
Copy pathtest-suite-web-desktop-e2e-pr.yml
More file actions
325 lines (305 loc) · 12.6 KB
/
Copy pathtest-suite-web-desktop-e2e-pr.yml
File metadata and controls
325 lines (305 loc) · 12.6 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
name: "[Test] PR Suite Web & Desktop e2e tests"
# Executed as part of PR checks
# Builds the desktop app and deploys the web app to dev.suite.sldev.cz/suite-web/<branch-name>/web
# Runs full e2e test suite for Suite Desktop and Suite Web
permissions:
id-token: write # for fetching the OIDC token
contents: read # for actions/checkout
pull-requests: write # for posting comments
on:
pull_request:
branches:
- develop
paths-ignore:
- "suite-native/**"
- "packages/react-native-usb/**"
# ignore unrelated github workflows config files
- ".github/workflows/connect*"
- ".github/workflows/suite-native*"
- ".github/workflows/build-desktop*"
- ".github/workflows/release*"
- ".github/actions/release*/**"
- "**.md"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
DEV_SERVER_URL: "https://dev.suite.sldev.cz"
STAGING_SUITE_SERVER_URL: "https://staging-suite.trezor.io"
jobs:
determine-strategy:
name: Determine test strategy
if: github.repository == 'trezor/trezor-suite'
runs-on: ubuntu-latest
outputs:
strategy: ${{ steps.determine.outputs.strategy }}
spec-list: ${{ steps.determine.outputs.spec-list }}
steps:
- name: Checkout PR head
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
fetch-depth: 0
- name: Determine test strategy
id: determine
uses: ./.github/actions/determine-test-strategy
# ── Desktop ────────────────────────────────────────────────────────────────
build-app:
needs:
- determine-strategy
if: github.repository == 'trezor/trezor-suite'
uses: ./.github/workflows/build-suite-desktop-e2e.yml
post-currents-pr-info-desktop:
if: github.repository == 'trezor/trezor-suite' && github.event_name == 'pull_request'
runs-on: ubuntu-latest
concurrency:
group: post-currents-pr-info-desktop-${{ github.event.pull_request.number }}
cancel-in-progress: false
needs:
- build-app
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
- name: Install Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: ".nvmrc"
- name: Generate GitHub App token
id: trezor-bot-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3
with:
client-id: ${{ secrets.TREZOR_BOT_APP_ID }}
private-key: ${{ secrets.TREZOR_BOT_PRIVATE_KEY }}
- name: Post Currents link
uses: ./.github/actions/post-currents-link
with:
github_token: ${{ steps.trezor-bot-token.outputs.token }}
project: "desktop"
currents-project-id: "4ytF0E"
- name: Post quarantine list
uses: ./.github/actions/post-quarantine-list
with:
github_token: ${{ steps.trezor-bot-token.outputs.token }}
currents_api_key: ${{ secrets.CURRENTS_API_KEY }}
project_name: "desktop"
run-e2e-suite-desktop-tests:
if: |
always() &&
github.repository == 'trezor/trezor-suite' &&
needs.build-app.result == 'success' &&
needs.resolve-spec-list.result == 'success'
needs:
- build-app
- resolve-spec-list
strategy:
fail-fast: false
matrix:
TEST_GROUP: ${{ fromJSON(needs.resolve-spec-list.outputs.matrix-desktop) }}
uses: ./.github/workflows/template-suite-run-e2e.yml
with:
target: "desktop"
pw-config: ${{ needs.resolve-spec-list.outputs.spec-list != '' && './playwright-config/playwright-desktop-pr-all.config.ts' || './playwright-config/playwright-desktop-pr.config.ts' }}
test-group: ${{ matrix.TEST_GROUP }}
fail-fast: "7"
currents-project-id: "4ytF0E"
download-artifact-name: "desktop-app-build-e2e"
spec-list: ${{ needs.resolve-spec-list.outputs.spec-list }}
secrets:
currents-record-key: ${{ secrets.CURRENTS_RECORD_KEY }}
e2e-passphrase: ${{ secrets.E2E_TEST_PASSPHRASE }}
e2e-passphrase-live: ${{ secrets.E2E_TEST_PASSPHRASE_LIVE }}
# ── Web ────────────────────────────────────────────────────────────────────
build-web:
if: github.repository == 'trezor/trezor-suite'
uses: ./.github/workflows/build-suite-web-e2e.yml
extract-branch:
if: github.repository == 'trezor/trezor-suite'
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.extract_branch.outputs.branch }}
steps:
- name: Extract branch name
id: extract_branch
run: |
BRANCH_NAME="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT
build-connect:
needs: [extract-branch]
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
with:
ref: ${{ needs.extract-branch.outputs.branch }}
- name: Release connect to dev environment
uses: ./.github/actions/release-connect
with:
awsRoleToAssume: "arn:aws:iam::538326561891:role/gh_actions_trezor_suite_dev_deploy"
awsRegion: "eu-central-1"
serverHostname: "dev.suite.sldev.cz"
serverPath: "connect/${{ needs.extract-branch.outputs.branch }}"
uploadArtifacts: "true"
buildArtifacts: "true"
nodeEnv: "development"
connectPopupUrl: "https://dev.suite.sldev.cz/suite-web/${{ needs.extract-branch.outputs.branch }}/web/connect-popup"
suiteWebUrl: "https://dev.suite.sldev.cz/suite-web/${{ needs.extract-branch.outputs.branch }}/web"
run-llm-analysis:
name: LLM test analysis
needs:
- determine-strategy
if: github.repository == 'trezor/trezor-suite' && needs.determine-strategy.outputs.strategy == 'analyze'
runs-on: ubuntu-latest
timeout-minutes: 15
outputs:
spec-list: ${{ steps.llm-select.outputs.spec-list }}
steps:
# SECURITY: check out the trusted develop branch so that only reviewed code
# runs with secrets. The PR head is fetched separately purely for computing
# the diff; its code is never installed or executed.
- name: Checkout repository (trusted develop ref)
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
with:
ref: develop
fetch-depth: 0
- name: Fetch PR head for diff
run: git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-head
- name: Check PR size
id: check-size
uses: ./.github/actions/check-pr-size
with:
additions: ${{ github.event.pull_request.additions }}
deletions: ${{ github.event.pull_request.deletions }}
- name: Run LLM test selector
id: llm-select
if: steps.check-size.outputs.is_small_pr == 'true'
uses: ./.github/actions/llm-test-selector
with:
openrouter-api-key: ${{ secrets.E2E_SELECTOR_API_KEY }}
- name: Post LLM analysis to PR description
if: steps.check-size.outputs.is_small_pr == 'true'
uses: ./.github/actions/post-llm-analysis
with:
trezor-bot-app-id: ${{ secrets.TREZOR_BOT_APP_ID }}
trezor-bot-private-key: ${{ secrets.TREZOR_BOT_PRIVATE_KEY }}
resolve-spec-list:
name: Resolve spec list
needs:
- determine-strategy
- run-llm-analysis
if: always() && github.repository == 'trezor/trezor-suite'
runs-on: ubuntu-latest
outputs:
spec-list: ${{ steps.resolve.outputs.spec-list }}
matrix-desktop: ${{ steps.matrix.outputs.matrix-desktop }}
matrix-web: ${{ steps.matrix.outputs.matrix-web }}
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
- name: Resolve final spec list
id: resolve
shell: bash
run: |
STRATEGY="${{ needs.determine-strategy.outputs.strategy }}"
DIRECT_SPEC="${{ needs.determine-strategy.outputs.spec-list }}"
LLM_SPEC="${{ needs.run-llm-analysis.outputs.spec-list }}"
if [[ "$STRATEGY" == "specific-tests" ]]; then
echo "Using direct spec list from strategy determination: $DIRECT_SPEC"
echo "spec-list=$DIRECT_SPEC" >> "$GITHUB_OUTPUT"
elif [[ "$STRATEGY" == "analyze" ]] && [[ -n "$LLM_SPEC" ]]; then
echo "Using LLM-recommended spec list: $LLM_SPEC"
echo "spec-list=$LLM_SPEC" >> "$GITHUB_OUTPUT"
else
echo "Running all tests (strategy=$STRATEGY, LLM spec empty or PR too large)."
echo "spec-list=" >> "$GITHUB_OUTPUT"
fi
- name: Resolve test matrix
id: matrix
uses: ./.github/actions/resolve-test-matrix
with:
spec-list: ${{ steps.resolve.outputs.spec-list }}
max-desktop: "7"
max-web: "5"
post-suite-web-preview-link:
if: github.repository == 'trezor/trezor-suite' && github.event_name == 'pull_request'
runs-on: ubuntu-latest
concurrency:
group: post-suite-web-preview-link-${{ github.event.pull_request.number }}
cancel-in-progress: false
needs:
- build-web
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
- name: Generate GitHub App token
id: trezor-bot-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3
with:
client-id: ${{ secrets.TREZOR_BOT_APP_ID }}
private-key: ${{ secrets.TREZOR_BOT_PRIVATE_KEY }}
- name: Post Suite Web preview link
uses: ./.github/actions/post-suite-web-preview-link
with:
github_token: ${{ steps.trezor-bot-token.outputs.token }}
dev-server-url: ${{ env.DEV_SERVER_URL }}
post-currents-pr-info-web:
if: github.repository == 'trezor/trezor-suite' && github.event_name == 'pull_request'
runs-on: ubuntu-latest
concurrency:
group: post-currents-pr-info-web-${{ github.event.pull_request.number }}
cancel-in-progress: false
needs:
- build-web
- build-connect
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
- name: Install Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: ".nvmrc"
- name: Generate GitHub App token
id: trezor-bot-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3
with:
client-id: ${{ secrets.TREZOR_BOT_APP_ID }}
private-key: ${{ secrets.TREZOR_BOT_PRIVATE_KEY }}
- name: Post Currents link
uses: ./.github/actions/post-currents-link
with:
github_token: ${{ steps.trezor-bot-token.outputs.token }}
project: "web"
currents-project-id: "Og0NOQ"
- name: Post quarantine list
uses: ./.github/actions/post-quarantine-list
with:
github_token: ${{ steps.trezor-bot-token.outputs.token }}
currents_api_key: ${{ secrets.CURRENTS_API_KEY }}
project_name: "web"
run-e2e-suite-web-tests:
if: |
always() &&
github.repository == 'trezor/trezor-suite' &&
needs.build-web.result == 'success' &&
needs.build-connect.result == 'success' &&
needs.resolve-spec-list.result == 'success'
needs:
- build-web
- build-connect
- resolve-spec-list
strategy:
fail-fast: false
matrix:
TEST_GROUP: ${{ fromJSON(needs.resolve-spec-list.outputs.matrix-web) }}
uses: ./.github/workflows/template-suite-run-e2e.yml
with:
target: "web"
pw-config: ${{ needs.resolve-spec-list.outputs.spec-list != '' && './playwright-config/playwright-web-pr-all.config.ts' || './playwright-config/playwright-web-pr.config.ts' }}
test-group: ${{ matrix.TEST_GROUP }}
fail-fast: "7"
currents-project-id: "Og0NOQ"
download-artifact-name: "connect-explorer-webextension-dev.suite.sldev.cz"
spec-list: ${{ needs.resolve-spec-list.outputs.spec-list }}
secrets:
currents-record-key: ${{ secrets.CURRENTS_RECORD_KEY }}
e2e-passphrase: ${{ secrets.E2E_TEST_PASSPHRASE }}
e2e-passphrase-live: ${{ secrets.E2E_TEST_PASSPHRASE_LIVE }}