-
Notifications
You must be signed in to change notification settings - Fork 956
323 lines (283 loc) · 10.3 KB
/
node-test.yml
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
name: CI Tests
on:
- pull_request
- push
- merge_group
env:
CI: true
NO_COLOR: true
permissions:
contents: read
concurrency:
# node-test-[pull_request|push]-[branch], typically. Will cancel previous runs that match!
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
if: contains(fromJSON('["pull_request", "merge_group"]'), github.event_name)
strategy:
matrix:
node-version:
- "20"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: npm-shrinkwrap.json
- run: npm i -g [email protected]
- run: npm ci
- run: npm run lint:changed-files
- run: npm run lint
working-directory: firebase-vscode
vscode_unit:
runs-on: macos-latest
strategy:
matrix:
node-version:
- "18"
- "20"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: firebase-vscode/package-lock.json
- run: npm i -g [email protected]
- run: npm ci
- run: npm install
working-directory: firebase-vscode
- run: npm run build
working-directory: firebase-vscode
- run: npm run test:unit
working-directory: firebase-vscode
- uses: codecov/codecov-action@v3
if: matrix.node-version == '20'
vscode_integration:
runs-on: macos-latest
strategy:
matrix:
node-version:
- "18"
- "20"
env:
FIREBASE_EMULATORS_PATH: ${{ github.workspace }}/emulator-cache
# This overrides the binary which runs firebase commands in the extension tasks such as emulator start.
# Currently, CI fails to start with npx so we change it to the global firebase binary.
FIREBASE_BINARY: firebase
steps:
- name: Setup Java JDK
uses: actions/[email protected]
with:
java-version: 17
distribution: temurin
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: firebase-vscode/package-lock.json
# TODO temporary workaround for GitHub Actions CI issue:
# npm ERR! Your cache folder contains root-owned files, due to a bug in
# npm ERR! previous versions of npm which has since been addressed.
- run: sudo chown -R 501:20 "/Users/runner/.npm" || exit 1
- run: npm ci
- run: npm install
working-directory: firebase-vscode
- run: npm run build
working-directory: firebase-vscode
- run: npm i -g firebase-tools@latest
- uses: GabrielBB/xvfb-action@v1
with:
run: npm run test:e2e
working-directory: firebase-vscode
- uses: actions/upload-artifact@v3
if: failure()
with:
name: screenshots
path: firebase-vscode/src/test/screenshots
- uses: codecov/codecov-action@v3
if: matrix.node-version == '20'
unit:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- "18"
- "20"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: npm-shrinkwrap.json
- run: npm i -g [email protected]
- run: npm ci
- run: npm test -- -- --forbid-only
- uses: codecov/codecov-action@v3
if: matrix.node-version == '20'
integration:
needs: unit
if: contains(fromJSON('["push", "merge_group"]'), github.event_name)
runs-on: ubuntu-latest
env:
FIREBASE_EMULATORS_PATH: ${{ github.workspace }}/emulator-cache
COMMIT_SHA: ${{ github.sha }}
CI_JOB_ID: ${{ github.action }}
FBTOOLS_TARGET_PROJECT: ${{ secrets.FBTOOLS_TARGET_PROJECT }}
FBTOOLS_CLIENT_INTEGRATION_SITE: ${{ secrets.FBTOOLS_CLIENT_INTEGRATION_SITE }}
CI_RUN_ID: ${{ github.run_id }}
CI_RUN_ATTEMPT: ${{ github.run_attempt }}
strategy:
fail-fast: false
matrix:
node-version:
- "20"
script:
- npm run test:client-integration
- npm run test:emulator
- npm run test:extensions-emulator
- npm run test:frameworks
- npm run test:functions-discover
- npm run test:hosting
# - npm run test:hosting-rewrites # Long-running test that might conflict across test runs. Run this manually.
- npm run test:import-export
- npm run test:storage-deploy
- npm run test:storage-emulator-integration
- npm run test:triggers-end-to-end
- npm run test:triggers-end-to-end:inspect
- npm run test:dataconnect-deploy
- npm run test:dataconnect-emulator
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: npm-shrinkwrap.json
- name: Cache firebase emulators
uses: actions/cache@v3
with:
path: ${{ env.FIREBASE_EMULATORS_PATH }}
key: ${{ runner.os }}-firebase-emulators-${{ hashFiles('emulator-cache/**') }}
continue-on-error: true
- run: npm i -g [email protected]
- run: npm ci
- run: echo ${{ secrets.service_account_json_base64 }} | base64 -d > ./scripts/service-account.json
- run: ${{ matrix.script }}
- name: Print debug logs
if: failure()
run: find . -type f -name "*debug.log" | xargs cat
integration-windows:
needs: unit
if: contains(fromJSON('["push", "merge_group"]'), github.event_name)
runs-on: windows-latest
env:
FIREBASE_EMULATORS_PATH: ${{ github.workspace }}/emulator-cache
COMMIT_SHA: ${{ github.sha }}
CI_JOB_ID: ${{ github.action }}
FBTOOLS_TARGET_PROJECT: ${{ secrets.FBTOOLS_TARGET_PROJECT }}
FBTOOLS_CLIENT_INTEGRATION_SITE: ${{ secrets.FBTOOLS_CLIENT_INTEGRATION_SITE }}
CI_RUN_ID: ${{ github.run_id }}
CI_RUN_ATTEMPT: ${{ github.run_attempt }}
strategy:
fail-fast: false
matrix:
node-version:
- "20"
script:
- npm run test:hosting
# - npm run test:hosting-rewrites # Long-running test that might conflict across test runs. Run this manually.
- npm run test:client-integration
- npm run test:emulator
# - npm run test:import-export # Fails becuase port 4000 is taken after first run - hub not shutting down?
# - npm run test:extensions-emulator # Fails due to cannot find module sharp (not waiting for npm install?)
- npm run test:functions-discover
# - npm run test:triggers-end-to-end
- npm run test:triggers-end-to-end:inspect
- npm run test:storage-deploy
# - npm run test:storage-emulator-integration
# - npm run test:dataconnect-deploy # TODO (joehanley): Reenable this - it should be safe to run in parallel
# - npm run test:dataconnect-emulator # TODO (joehanley): Figure out why this is failing
- npm run test:frameworks
steps:
- name: Setup Java JDK
uses: actions/[email protected]
with:
java-version: 17
distribution: temurin
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: npm-shrinkwrap.json
- name: Cache firebase emulators
uses: actions/cache@v3
with:
path: ${{ env.FIREBASE_EMULATORS_PATH }}
key: ${{ runner.os }}-firebase-emulators-${{ hashFiles('emulator-cache/**') }}
continue-on-error: true
- run: echo ${{ secrets.service_account_json_base64 }} > tmp.txt
- run: certutil -decode tmp.txt scripts/service-account.json
- run: npm i -g [email protected]
- run: npm ci
- run: ${{ matrix.script }}
- name: Print debug logs
if: failure()
run: dir "*.log" /s/b | type
check-package-lock:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- "20"
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm i -g [email protected]
# --ignore-scripts prevents the `prepare` script from being run.
- run: npm install --package-lock-only --ignore-scripts
- run: "git diff --exit-code -- npm-shrinkwrap.json || (echo 'Error: npm-shrinkwrap.json is changed during npm install! Please make sure to use npm >= 8 and commit npm-shrinkwrap.json.' && false)"
check-package-lock-vsce:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- "20"
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm i -g [email protected]
# --ignore-scripts prevents the `prepare` script from being run.
- run: "(cd firebase-vscode && npm install --package-lock-only --ignore-scripts)"
- run: "git diff --exit-code -- firebase-vscode/package-lock.json || (echo 'Error: firebase-vscode/package-lock.json is changed during npm install! Please make sure to use npm >= 8 and commit firebase-vscode/package-lock.json.' && false)"
check-json-schema:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- "20"
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: npm-shrinkwrap.json
- run: npm install
- run: npm run generate:json-schema
- run: "git diff --exit-code -- schema/*.json || (echo 'Error: JSON schema is changed! Please run npm run generate:json-schema and commit the results.' && false)"