-
Notifications
You must be signed in to change notification settings - Fork 898
290 lines (276 loc) · 9.42 KB
/
test-changed-firestore.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
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Test Firestore
on:
workflow_dispatch:
pull_request:
env:
artifactRetentionDays: 14
# Bump Node memory limit
NODE_OPTIONS: "--max_old_space_size=4096"
jobs:
build:
name: Build Firestore
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.set-output.outputs.CHANGED }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so run-changed script can diff properly.
fetch-depth: 0
- name: Set up Node (20)
uses: actions/setup-node@v3
with:
node-version: 22.10.0
- name: install Chrome stable
run: |
sudo apt-get update
sudo apt-get install google-chrome-stable
- name: Test setup and yarn install
run: |
cp config/ci.config.json config/project.json
yarn
- name: build
id: build
run: |
set -o pipefail
yarn build:changed firestore | tee ${{ runner.temp }}/yarn.log.txt
continue-on-error: false
- name: Check if Firestore is changed
id: check-changed
run: egrep "Skipping all" ${{ runner.temp }}/yarn.log.txt
# Continue when "Skipping all" is not found
continue-on-error: true
- name: set output
# This means "Skipping all" was not found
if: steps.check-changed.outcome != 'success'
id: set-output
run: echo "CHANGED=true" >> "$GITHUB_OUTPUT";
- name: Archive build
if: ${{ !cancelled() && steps.build.outcome == 'success' && steps.check-changed.outcome != 'success' }}
run: |
tar -cf build.tar --exclude=.git .
gzip build.tar
- name: Upload build archive
if: ${{ !cancelled() && steps.build.outcome == 'success' && steps.check-changed.outcome != 'success' }}
uses: actions/upload-artifact@v3
with:
name: build.tar.gz
path: build.tar.gz
retention-days: ${{ env.artifactRetentionDays }}
compat-test-chrome:
name: Test Firestore Compatible
runs-on: ubuntu-latest
needs: build
if: ${{ needs.build.outputs.changed == 'true'}}
steps:
- name: Set up Node (20)
uses: actions/setup-node@v3
with:
node-version: 22.10.0
- name: install Chrome stable
run: |
sudo apt-get update
sudo apt-get install google-chrome-stable
- name: Download build archive
uses: actions/download-artifact@v3
with:
name: build.tar.gz
- name: Unzip build artifact
run: tar xf build.tar.gz
- name: Test setup and yarn install
run: cp config/ci.config.json config/project.json
- name: Run compat tests
run: cd packages/firestore-compat && yarn run test:ci
test-chrome:
name: Test Firestore
strategy:
matrix:
test-name: ["test:browser", "test:travis", "test:lite:browser", "test:browser:prod:nameddb", "test:lite:browser:nameddb"]
runs-on: ubuntu-latest
needs: build
if: ${{ needs.build.outputs.changed == 'true'}}
steps:
- name: Set up Node (20)
uses: actions/setup-node@v3
with:
node-version: 22.10.0
- name: install Chrome stable
run: |
sudo apt-get update
sudo apt-get install google-chrome-stable
- name: Download build archive
uses: actions/download-artifact@v3
with:
name: build.tar.gz
- name: Unzip build artifact
run: tar xf build.tar.gz
- name: Test setup and yarn install
run: cp config/ci.config.json config/project.json
- name: Run tests
run: cd packages/firestore && yarn run ${{ matrix.test-name }}
env:
EXPERIMENTAL_MODE: true
test-firestore-nightly-with-chrome:
name: Test Nightly Firestore with Chrome
strategy:
matrix:
test-name: ["test:browser:nightly"]
runs-on: ubuntu-latest
needs: build
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Set up Node (20)
uses: actions/setup-node@v3
with:
node-version: 22.10.0
- name: install Chrome stable
run: |
sudo apt-get update
sudo apt-get install google-chrome-stable
- name: Download build archive
uses: actions/download-artifact@v3
with:
name: build.tar.gz
- name: Unzip build artifact
run: tar xf build.tar.gz
- name: Test setup against nightly Firestore
env:
INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.FIRESTORE_SDK_NIGHTLY_PROJECT_JSON }}
run: |
echo $INTEG_TESTS_GOOGLE_SERVICES > config/project.json
- name: Run tests
run: cd packages/firestore && yarn run ${{ matrix.test-name }}
env:
EXPERIMENTAL_MODE: true
compat-test-firefox:
name: Test Firestore Compatible on Firefox
runs-on: ubuntu-latest
needs: build
if: ${{ needs.build.outputs.changed == 'true'}}
steps:
- name: install Firefox stable
run: npx @puppeteer/browsers install firefox@stable
- name: Set up Node (20)
uses: actions/setup-node@v3
with:
node-version: 22.10.0
- name: Download build archive
uses: actions/download-artifact@v3
with:
name: build.tar.gz
- name: Unzip build artifact
run: tar xf build.tar.gz
- name: Test setup and yarn install
run: cp config/ci.config.json config/project.json
- name: Run compat tests
run: cd packages/firestore-compat && xvfb-run yarn run test:ci
env:
BROWSERS: 'Firefox'
test-firefox:
name: Test Firestore on Firefox
strategy:
matrix:
test-name: ["test:browser", "test:travis", "test:lite:browser", "test:browser:prod:nameddb", "test:lite:browser:nameddb"]
runs-on: ubuntu-latest
needs: build
if: ${{ needs.build.outputs.changed == 'true'}}
steps:
- name: install Firefox stable
run: npx @puppeteer/browsers install firefox@stable
- name: Download build archive
uses: actions/download-artifact@v3
with:
name: build.tar.gz
- name: Unzip build artifact
run: tar xf build.tar.gz
- name: Set up Node (20)
uses: actions/setup-node@v3
with:
node-version: 22.10.0
- name: Test setup and yarn install
run: cp config/ci.config.json config/project.json
- name: Run tests
run: cd packages/firestore && xvfb-run yarn run ${{ matrix.test-name }}
env:
BROWSERS: 'Firefox'
EXPERIMENTAL_MODE: true
compat-test-webkit:
name: Test Firestore Compatible on Webkit
runs-on: macos-latest
needs: build
if: ${{ needs.build.outputs.changed == 'true'}}
steps:
- name: Set up Node (20)
uses: actions/setup-node@v3
with:
node-version: 22.10.0
- name: Download build archive
uses: actions/download-artifact@v3
with:
name: build.tar.gz
- name: Unzip build artifact
run: tar xf build.tar.gz
- name: Test setup
run: |
cp config/ci.config.json config/project.json
npx playwright install webkit
- name: Run compat tests
run: cd packages/firestore-compat && yarn run test:ci
env:
BROWSERS: 'WebkitHeadless'
test-webkit:
name: Test Firestore on Webkit
strategy:
matrix:
# TODO (dlarocque): Add test:travis once the browser tests are isolated
# Exclude test:travis for now, since it includes node tests, which are failing for
# some reason.
test-name: ["test:browser", "test:lite:browser", "test:browser:prod:nameddb", "test:lite:browser:nameddb"]
runs-on: macos-latest
needs: build
if: ${{ needs.build.outputs.changed == 'true'}}
steps:
- name: Download build archive
uses: actions/download-artifact@v3
with:
name: build.tar.gz
- name: Unzip build artifact
run: tar xf build.tar.gz
- name: Set up Node (20)
uses: actions/setup-node@v3
with:
node-version: 22.10.0
- name: Test setup
run: |
cp config/ci.config.json config/project.json
npx playwright install webkit
- name: Run tests
run: cd packages/firestore && yarn run ${{ matrix.test-name }}
env:
BROWSERS: 'WebkitHeadless'
EXPERIMENTAL_MODE: true
# A job that fails if any required job in the test matrix fails,
# to be used as a required check for merging.
check-required-tests:
runs-on: ubuntu-latest
if: always()
name: Check all required tests results
needs: [build, test-chrome, compat-test-chrome]
steps:
- name: Check test matrix
if: needs.build.result == 'failure' || needs.test-chrome.result == 'failure' || needs.compat-test-chrome.result == 'failure'
run: exit 1