14
14
15
15
name : Test All Packages
16
16
17
- on : pull_request
17
+ on :
18
+ workflow_run :
19
+ workflows : ["Build"]
20
+ types :
21
+ - completed
18
22
19
23
env :
20
24
# make chromedriver detect installed Chrome version and download the corresponding driver
30
34
NODE_OPTIONS : " --max_old_space_size=4096"
31
35
32
36
jobs :
33
- build :
34
- name : Build the SDK
35
- runs-on : ubuntu-latest
36
- steps :
37
- # Install Chrome so the correct version of webdriver can be installed by chromedriver when
38
- # setting up the repo. This must be done to build and execute Auth properly.
39
- - name : install Chrome stable
40
- run : |
41
- npx @puppeteer/browsers install chrome@stable
42
- - uses : actions/checkout@v3
43
- - name : Set up Node (20)
44
- uses : actions/setup-node@v4
45
- with :
46
- node-version-file : ' .nvmrc'
47
- - name : Test setup and yarn install
48
- run : |
49
- cp config/ci.config.json config/project.json
50
- yarn
51
- - name : yarn build
52
- run : yarn build
53
- - name : Archive build
54
- if : ${{ !cancelled() }}
55
- run : |
56
- tar -cf build.tar --exclude=.git .
57
- gzip build.tar
58
- - name : Upload build archive
59
- if : ${{ !cancelled() }}
60
- uses : actions/upload-artifact@v3
61
- with :
62
- name : build.tar.gz
63
- path : build.tar.gz
64
- retention-days : ${{ env.artifactRetentionDays }}
65
-
66
37
# Auth and Firestore are built and executed in their own jobs in an attempt to reduce flakiness.
67
38
test-the-rest :
39
+ if : ${{ github.event.workflow_run.conclusion == 'success'}}
68
40
name : (bulk) Node.js and Browser (Chrome) Tests
69
- needs : build
70
41
runs-on : ubuntu-latest
71
42
steps :
72
43
# install Chrome first, so the correct version of webdriver can be installed by chromedriver when setting up the repo
73
44
- name : install Chrome stable
74
45
run : |
75
46
npx @puppeteer/browsers install chrome@stable
76
47
- name : Download build archive
77
- uses : actions/download-artifact@v3
48
+ uses : actions/download-artifact@v4
78
49
with :
79
- name : build.tar.gz
80
- - name : Unzip build artifact
81
- run : tar xf build.tar.gz
82
- - name : Set up Node (20)
83
- uses : actions/setup-node@v4
50
+ name : dists-${{ github.ref }}
51
+ - uses : actions/setup-node@v4
84
52
with :
85
53
node-version-file : ' .nvmrc'
86
- - name : Test setup and yarn install
87
- run : |
88
- cp config/ci.config.json config/project.json
89
- yarn
54
+ cache : yarn
55
+ cache-dependency-path : yarn.lock
56
+ - name : Restore cached node_modules
57
+ uses : actions/cache@v4
58
+ id : node_modules
59
+ with :
60
+ path : " **/node_modules"
61
+ key : node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
62
+ - run : yarn install --frozen-lockfile
63
+ - name : Test setup
64
+ run : cp config/ci.config.json config/project.json
90
65
- name : Set start timestamp env var
91
66
run : echo "FIREBASE_CI_TEST_START_TIME=$(date +%s)" >> $GITHUB_ENV
92
67
- name : Run unit tests
106
81
continue-on-error : true
107
82
108
83
test-auth :
84
+ if : ${{ github.event.workflow_run.conclusion == 'success' }}
109
85
name : (Auth) Node.js and Browser (Chrome) Tests
110
- needs : build
111
86
runs-on : ubuntu-latest
112
87
steps :
113
88
# install Chrome first, so the correct version of webdriver can be installed by chromedriver
@@ -125,19 +100,23 @@ jobs:
125
100
run : |
126
101
echo $CHROME_VERSION_NOTES=$CHROME_VERSION_MISMATCH_MESSAGE
127
102
- name : Download build archive
128
- uses : actions/download-artifact@v3
103
+ uses : actions/download-artifact@v4
129
104
with :
130
- name : build.tar.gz
131
- - name : Unzip build artifact
132
- run : tar xf build.tar.gz
133
- - name : Set up Node (20)
134
- uses : actions/setup-node@v4
105
+ name : dists-${{ github.ref }}
106
+ - uses : actions/setup-node@v4
135
107
with :
136
108
node-version-file : ' .nvmrc'
137
- - name : Test setup and yarn install
138
- run : |
139
- cp config/ci.config.json config/project.json
140
- yarn
109
+ cache : yarn
110
+ cache-dependency-path : yarn.lock
111
+ - name : Restore cached node_modules
112
+ uses : actions/cache@v4
113
+ id : node_modules
114
+ with :
115
+ path : " **/node_modules"
116
+ key : node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
117
+ - run : yarn install --frozen-lockfile
118
+ - name : Test setup
119
+ run : cp config/ci.config.json config/project.json
141
120
- name : Set start timestamp env var
142
121
run : echo "FIREBASE_CI_TEST_START_TIME=$(date +%s)" >> $GITHUB_ENV
143
122
- name : Run unit tests
@@ -156,28 +135,32 @@ jobs:
156
135
continue-on-error : true
157
136
158
137
test-firestore :
138
+ if : ${{ github.event.workflow_run.conclusion == 'success'}}
159
139
name : (Firestore) Node.js and Browser (Chrome) Tests
160
- needs : build
161
140
runs-on : ubuntu-latest
162
141
steps :
163
142
# install Chrome so the correct version of webdriver can be installed by chromedriver when setting up the repo
164
143
- name : install Chrome stable
165
144
run : |
166
145
npx @puppeteer/browsers install chrome@stable
167
146
- name : Download build archive
168
- uses : actions/download-artifact@v3
147
+ uses : actions/download-artifact@v4
169
148
with :
170
- name : build.tar.gz
171
- - name : Unzip build artifact
172
- run : tar xf build.tar.gz
173
- - name : Set up Node (20)
174
- uses : actions/setup-node@v4
149
+ name : dists-${{ github.ref }}
150
+ - uses : actions/setup-node@v4
175
151
with :
176
152
node-version-file : ' .nvmrc'
177
- - name : Test setup and yarn install
178
- run : |
179
- cp config/ci.config.json config/project.json
180
- yarn
153
+ cache : yarn
154
+ cache-dependency-path : yarn.lock
155
+ - name : Restore cached node_modules
156
+ uses : actions/cache@v4
157
+ id : node_modules
158
+ with :
159
+ path : " **/node_modules"
160
+ key : node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
161
+ - run : yarn install --frozen-lockfile
162
+ - name : Test setup
163
+ run : cp config/ci.config.json config/project.json
181
164
- name : Set start timestamp env var
182
165
run : echo "FIREBASE_CI_TEST_START_TIME=$(date +%s)" >> $GITHUB_ENV
183
166
- name : Run unit tests
@@ -196,30 +179,35 @@ jobs:
196
179
path-to-lcov : ./lcov-all.info
197
180
continue-on-error : true
198
181
test-firestore-integration :
182
+ if : ${{ github.event.workflow_run.conclusion == 'success'}}
199
183
strategy :
200
184
fail-fast : false
201
185
matrix :
202
186
persistence : ['memory', 'persistence']
203
187
name : Firestore Integration Tests (${{ matrix.persistence }})
204
- needs : build
205
188
runs-on : ubuntu-latest
206
189
steps :
207
190
# install Chrome so the correct version of webdriver can be installed by chromedriver when setting up the repo
208
191
- name : install Chrome stable
209
192
run : |
210
193
npx @puppeteer/browsers install chrome@stable
211
194
- name : Download build archive
212
- uses : actions/download-artifact@v3
195
+ uses : actions/download-artifact@v4
213
196
with :
214
- name : build.tar.gz
215
- - name : Unzip build artifact
216
- run : tar xf build.tar.gz
217
- - name : Set up Node (20)
218
- uses : actions/setup-node@v4
197
+ name : dists-${{ github.ref }}
198
+ - uses : actions/setup-node@v4
219
199
with :
220
200
node-version-file : ' .nvmrc'
201
+ cache : yarn
202
+ cache-dependency-path : yarn.lock
203
+ - name : Restore cached node_modules
204
+ uses : actions/cache@v4
205
+ id : node_modules
206
+ with :
207
+ path : " **/node_modules"
208
+ key : node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
209
+ - run : yarn install --frozen-lockfile
221
210
- run : cp config/ci.config.json config/project.json
222
- - run : yarn
223
211
- run : yarn build:${{ matrix.persistence }}
224
212
working-directory : integration/firestore
225
213
- run : xvfb-run yarn karma:singlerun
0 commit comments