-
Notifications
You must be signed in to change notification settings - Fork 527
167 lines (143 loc) · 5.05 KB
/
test-e2e.yml
File metadata and controls
167 lines (143 loc) · 5.05 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
on:
workflow_call:
jobs:
test-build:
name: 'test:build'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup node
uses: actions/setup-node@v6
with:
node-version-file: '.tool-versions'
cache: 'npm'
- name: Cache test-build output
uses: actions/cache@v5
id: test-build-cache
with:
path: build
key: test-build-${{ runner.os }}-${{ hashFiles('package-lock.json', 'src/**', 'public/**') }}
restore-keys: |
test-build-${{ runner.os }}-
- name: Cache node_modules
uses: actions/cache@v5
id: test-npm-cache
with:
path: node_modules
key: npm-${{ runner.os }}-${{ hashFiles('package-lock.json', 'patches/**', '.tool-versions') }}
restore-keys: |
npm-${{ runner.os }}-
- name: Install dependencies
if: steps.test-npm-cache.outputs.cache-hit != 'true'
run: npm ci --prefer-offline --no-audit --progress=false
# This is required to ensure that our code is instrumented with coverage details
- name: Run test build
if: steps.test-build-cache.outputs.cache-hit != 'true'
run: npm run test:build
test-e2e:
name: 'test:e2e'
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [test-build]
steps:
- uses: actions/checkout@v6
- name: Setup node
uses: actions/setup-node@v6
with:
node-version-file: '.tool-versions'
cache: 'npm'
- name: Cache test-build output
uses: actions/cache@v5
id: test-build-cache
with:
path: build
key: test-build-${{ runner.os }}-${{ hashFiles('package-lock.json', 'src/**', 'public/**') }}
restore-keys: |
test-build-${{ runner.os }}-
- name: Cache node_modules
uses: actions/cache@v5
id: test-npm-cache
with:
path: node_modules
key: npm-${{ runner.os }}-${{ hashFiles('package-lock.json', 'patches/**', '.tool-versions') }}
restore-keys: |
npm-${{ runner.os }}-
- name: Install dependencies
if: steps.test-npm-cache.outputs.cache-hit != 'true'
run: npm ci --prefer-offline --no-audit --progress=false
# Cache playwright binaries
- uses: actions/cache@v5
id: playwright-cache
with:
path: |
~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
playwright-${{ runner.os }}-
# On cache miss: download browsers and install OS dependencies
- name: Install Playwright with dependencies
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install --with-deps
# On cache hit: only ensure OS dependencies are present (fast, idempotent)
- name: Install Playwright OS dependencies
if: steps.playwright-cache.outputs.cache-hit == 'true'
run: npx playwright install-deps
- name: Cache nyc_output dir
uses: actions/cache@v5
id: nyc_output-cache
with:
path: ./.nyc_output
key: nyc_output-${{ runner.os }}-${{ github.sha }}
restore-keys: |
nyc_output-${{ runner.os }}-${{ github.sha }}
- name: Run E2E against Kubo
run: npm run test:e2e
env:
REACT_APP_ENV: test
- name: Store Artifacts from Failed Tests
if: failure()
uses: actions/upload-artifact@v6
with:
name: test-results
path: test-results/
retention-days: 7
e2e-coverage: # since we run coverage in shards and some files may not contain coverage, we cache the .nyc_output directory
name: 'e2e-coverage'
runs-on: ubuntu-latest
needs: [test-e2e]
steps:
- uses: actions/checkout@v6
- name: Setup node
uses: actions/setup-node@v6
with:
node-version-file: '.tool-versions'
cache: 'npm'
- name: Cache node_modules
uses: actions/cache@v5
id: npm-cache
with:
path: node_modules
key: npm-${{ runner.os }}-${{ hashFiles('package-lock.json', 'patches/**', '.tool-versions') }}
restore-keys: |
npm-${{ runner.os }}-
- name: Install dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm ci --prefer-offline --no-audit --progress=false
- name: Cache nyc_output dir
uses: actions/cache@v5
id: nyc_output-cache
with:
path: ./.nyc_output
key: nyc_output-${{ runner.os }}-${{ github.sha }}
restore-keys: |
nyc_output-${{ runner.os }}-${{ github.sha }}
- name: Generate nyc coverage report
id: coverage
run: npx nyc report --reporter=lcov
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: e2e_tests
name: e2e-coverage
fail_ci_if_error: false
verbose: true