File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88
99name : Cypress
1010
11- on : pull_request
11+ on :
12+ pull_request :
13+ types :
14+ - opened
15+ - synchronize
16+ - reopened
17+ - ready_for_review
18+ - labeled
19+ - unlabeled
1220
1321concurrency :
1422 group : cypress-${{ github.head_ref || github.run_id }}
2735
2836permissions :
2937 contents : read
38+ pull-requests : read
3039
3140jobs :
41+ gate :
42+ runs-on : ubuntu-latest-low
43+ outputs :
44+ should_run : ${{ steps.evaluate.outputs.should_run }}
45+ reason : ${{ steps.evaluate.outputs.reason }}
46+ steps :
47+ - name : Evaluate e2e tests execution conditions
48+ id : evaluate
49+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v8.0.0
50+ with :
51+ script : |
52+ const pr = context.payload.pull_request
53+
54+ const hasForceLabel = pr.labels.some((label) => label.name === 'force-e2e-tests')
55+ const hasToReviewLabel = pr.labels.some((label) => label.name === '3. to review')
56+ const hasToReleaseLabel = pr.labels.some((label) => label.name === '4. to release')
57+
58+ const files = await github.paginate(github.rest.pulls.listFiles, {
59+ owner: context.repo.owner,
60+ repo: context.repo.repo,
61+ pull_number: pr.number,
62+ per_page: 100,
63+ })
64+ const cypressTouched = files.some((file) => file.filename.startsWith('cypress'))
65+
66+ if (hasForceLabel || hasToReviewLabel || hasToReleaseLabel || cypressTouched) {
67+ return
68+ } else {
69+ core.setFailed('Skipping Cypress: missing labels and no cypress path changes.')
70+ }
71+
3272 init :
3373 runs-on : ubuntu-latest
74+ needs : gate
3475 outputs :
3576 nodeVersion : ${{ steps.versions.outputs.nodeVersion }}
3677 npmVersion : ${{ steps.versions.outputs.npmVersion }}
98139
99140 cypress :
100141 runs-on : ubuntu-latest
101- needs : init
142+ needs : [gate, init]
102143
103144 strategy :
104145 fail-fast : false
Original file line number Diff line number Diff line change @@ -6,15 +6,54 @@ name: Playwright Tests
66on :
77 pull_request :
88 branches : [ master ]
9+ types :
10+ - opened
11+ - synchronize
12+ - reopened
13+ - ready_for_review
14+ - labeled
15+ - unlabeled
916
1017permissions :
1118 contents : read
1219
1320jobs :
21+ gate :
22+ runs-on : ubuntu-latest-low
23+ outputs :
24+ should_run : ${{ steps.evaluate.outputs.should_run }}
25+ reason : ${{ steps.evaluate.outputs.reason }}
26+ steps :
27+ - name : Evaluate e2e tests execution conditions
28+ id : evaluate
29+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v8.0.0
30+ with :
31+ script : |
32+ const pr = context.payload.pull_request
33+
34+ const hasSpecialLabel = pr.labels.some((label) => label.name === 'force-e2e-tests')
35+ const hasToReviewLabel = pr.labels.some((label) => label.name === '3. to review')
36+ const hasToReleaseLabel = pr.labels.some((label) => label.name === '4. to release')
37+
38+ const files = await github.paginate(github.rest.pulls.listFiles, {
39+ owner: context.repo.owner,
40+ repo: context.repo.repo,
41+ pull_number: pr.number,
42+ per_page: 100,
43+ })
44+ const playwrightTouched = files.some((file) => file.filename.startsWith('tests/playwright'))
45+
46+ if (hasForceLabel || hasToReviewLabel || hasToReleaseLabel || playwrightTouched) {
47+ return
48+ } else {
49+ core.setFailed('Skipping Playwright: missing labels and no Playwright path changes.')
50+ }
51+
1452 playwright-setup :
1553 timeout-minutes : 15
1654 name : Playwright setup
1755 runs-on : ubuntu-latest
56+ needs : gate
1857 steps :
1958 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2059 with :
4079 path : ./
4180
4281 playwright-tests :
43- needs : [playwright-setup]
82+ needs : [gate, playwright-setup]
4483 timeout-minutes : 60
4584 name : Playwright tests ${{ matrix.shardIndex }} / ${{ matrix.shardTotal }}
4685 runs-on : ubuntu-latest
You can’t perform that action at this time.
0 commit comments