@@ -2,6 +2,8 @@ name: run e2e tests
2
2
3
3
on :
4
4
workflow_dispatch :
5
+ pull_request :
6
+ types : [opened, synchronize, reopened, labeled]
5
7
6
8
env :
7
9
NODE_VERSION : 18.16.1
10
12
NEXT_VERSION : netlify-testing
11
13
NEXT_TEST_MODE : deploy
12
14
NEXT_E2E_TEST_TIMEOUT : 600000
15
+ NEXT_TEST_JOB : true
13
16
TEST_CONCURRENCY : 8
14
17
NEXT_TELEMETRY_DISABLED : 1
15
18
TURBO_TOKEN : ${{ secrets.TURBO_TOKEN }}
20
23
21
24
jobs :
22
25
test-e2e :
26
+ if : ${{ github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'run-e2e-tests') }}
23
27
name : test e2e
24
28
runs-on : ubuntu-latest
25
29
timeout-minutes : 25
35
39
test/e2e/favicon-short-circuit/favicon-short-circuit.test.ts
36
40
37
41
steps :
42
+ - name : ' Setup jq'
43
+
38
44
- name : get github token
39
45
uses : navikt/github-app-token-generator@v1
40
46
id : token
@@ -44,20 +50,20 @@ jobs:
44
50
repo : ${{ env.NEXT_REPO }}
45
51
46
52
- name : checkout next.js repo
47
- uses : actions/checkout@v3
53
+ uses : actions/checkout@v4
48
54
with :
49
55
repository : ${{ env.NEXT_REPO }}
50
56
token : ${{ steps.token.outputs.token }}
51
57
ref : ${{ env.NEXT_VERSION }}
52
58
path : ${{ env.next-path }}
53
59
54
60
- name : checkout runtime repo
55
- uses : actions/checkout@v3
61
+ uses : actions/checkout@v4
56
62
with :
57
63
path : ${{ env.runtime-path }}
58
64
59
65
- name : setup node
60
- uses : actions/setup-node@v3
66
+ uses : actions/setup-node@v4
61
67
with :
62
68
node-version : ${{ env.NODE_VERSION }}
63
69
97
103
working-directory : ${{ env.next-path }}
98
104
99
105
- name : install runtime
100
- run : npm install
106
+ run : npm install --ignore-scripts
101
107
working-directory : ${{ env.runtime-path }}
102
108
103
109
- name : build runtime
@@ -121,13 +127,20 @@ jobs:
121
127
NEXT_EXTERNAL_TESTS_FILTERS : ./tests.json
122
128
run : node run-tests.js -g ${{ matrix.group }}/5 -c ${TEST_CONCURRENCY} --type e2e
123
129
working-directory : ${{ env.next-path }}
124
-
125
- validate-tests :
126
- name : validate tests
127
- needs : [test-e2e]
128
- runs-on : ubuntu-latest
129
- steps :
130
- - run : exit 1
131
- if :
132
- ${{ always() && (contains(needs.*.result, 'failure') || contains(needs.*.result,
133
- ' skipped' ) || contains(needs.*.result, 'cancelled')) }}
130
+ - name : Test results
131
+ working-directory : ${{ env.next-path }}
132
+ run : |
133
+ for file in `ls test/e2e/**/*.results.json`; do
134
+ test_name=$(echo $file | sed -e 's/test\/e2e\/\(.*\/.*\).results.json/\1/')
135
+ echo "<details>" >> $GITHUB_STEP_SUMMARY
136
+ echo "<summary>:x: Test failed: <code>${test_name}</code></summary>" >> $GITHUB_STEP_SUMMARY
137
+ echo "<pre><code>" >> $GITHUB_STEP_SUMMARY
138
+ cat $file | jq -r '.testResults[].message'>> $GITHUB_STEP_SUMMARY
139
+ echo "</code></pre>" >> $GITHUB_STEP_SUMMARY
140
+ echo "</details>" >> $GITHUB_STEP_SUMMARY
141
+ failed=true
142
+ done
143
+ if [ "$failed" = true ] ; then
144
+ echo "Failed tests. Please see action summary for details."
145
+ exit 1
146
+ fi
0 commit comments