Skip to content

Commit 037fc58

Browse files
committed
Merge remote-tracking branch 'origin/master' into TestingHooksSpi
2 parents e550a5c + 4ae8041 commit 037fc58

File tree

3 files changed

+115
-27
lines changed

3 files changed

+115
-27
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#######################################################################################################
99

1010
# These owners will be the default owners for everything in the repo.
11-
* @dwyfrequency @hsubox76 @firebase/jssdk-global-approvers
11+
* @firebase/jssdk-global-approvers
1212

1313
# Database Code
1414
packages/database @maneesht @jsdt @jmwski @firebase/jssdk-global-approvers
@@ -74,4 +74,4 @@ scripts/docgen/content-sources/ @egilmorez @firebase/jssdk-global-approvers
7474
docs-devsite/ @egilmorez @markarndt @kevinthecheung
7575

7676
# Changeset
77-
.changeset @firebase/jssdk-changeset-approvers @firebase/firestore-js-team @firebase/jssdk-global-approvers
77+
.changeset @firebase/jssdk-changeset-approvers @firebase/firestore-js-team @firebase/jssdk-global-approvers

.github/workflows/test-changed-firestore.yml

Lines changed: 104 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@ name: Test Firestore
22

33
on: pull_request
44

5+
env:
6+
artifactRetentionDays: 14
7+
58
jobs:
6-
test-chrome:
7-
name: Test Firestore on Chrome and Node If Changed
9+
build:
10+
name: Build Firestore
11+
812
runs-on: ubuntu-latest
13+
outputs:
14+
changed: ${{ steps.set-output.outputs.CHANGED }}
915

1016
steps:
1117
- name: Checkout Repo
@@ -28,27 +34,112 @@ jobs:
2834
cp config/ci.config.json config/project.json
2935
yarn
3036
- name: build
31-
run: yarn build:changed firestore
32-
- name: Run tests if firestore or its dependencies has changed
33-
run: yarn test:changed firestore
37+
id: build
38+
# TODO(wuandy): Separate yarn and egrep into steps, so build failure
39+
# is captured by github actions.
40+
run: yarn build:changed firestore | egrep "Skipping all"
41+
# Continue when "Skipping all" is not found
42+
continue-on-error: true
43+
- name: set output
44+
# This means "Skipping all" was not found
45+
if: steps.build.outcome != 'success'
46+
id: set-output
47+
run: echo "CHANGED=true" >> "$GITHUB_OUTPUT";
48+
- name: Archive build
49+
if: ${{ !cancelled() && steps.build.outcome != 'success' }}
50+
run: |
51+
tar -cf build.tar --exclude="\.git" .
52+
gzip build.tar
53+
- name: Upload build archive
54+
if: ${{ !cancelled() && steps.build.outcome != 'success' }}
55+
uses: actions/upload-artifact@v3
56+
with:
57+
name: build.tar.gz
58+
path: build.tar.gz
59+
retention-days: ${{ env.artifactRetentionDays }}
60+
61+
compat-test-chrome:
62+
name: Test Firestore Compatible
63+
runs-on: ubuntu-latest
64+
needs: build
65+
if: ${{ needs.build.outputs.changed == 'true'}}
66+
steps:
67+
- name: Set up Node (14)
68+
uses: actions/setup-node@v3
69+
with:
70+
node-version: 14.x
71+
- name: install Chrome stable
72+
run: |
73+
sudo apt-get update
74+
sudo apt-get install google-chrome-stable
75+
- name: Download build archive
76+
uses: actions/download-artifact@v3
77+
with:
78+
name: build.tar.gz
79+
- name: Unzip build artifact
80+
run: tar xf build.tar.gz
81+
- name: Bump Node memory limit
82+
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
83+
- name: Test setup and yarn install
84+
run: |
85+
cp config/ci.config.json config/project.json
86+
- name: Run compat tests
87+
run: cd packages/firestore-compat && yarn run test:ci
88+
89+
test-chrome:
90+
name: Test Firestore
91+
strategy:
92+
matrix:
93+
test-name: ["test:browser", "test:travis", "test:lite:browser", "test:browser:prod:nameddb", "test:lite:browser:nameddb"]
94+
runs-on: ubuntu-latest
95+
needs: build
96+
if: ${{ needs.build.outputs.changed == 'true'}}
97+
steps:
98+
- name: Set up Node (14)
99+
uses: actions/setup-node@v3
100+
with:
101+
node-version: 14.x
102+
- name: install Chrome stable
103+
run: |
104+
sudo apt-get update
105+
sudo apt-get install google-chrome-stable
106+
- name: Download build archive
107+
uses: actions/download-artifact@v3
108+
with:
109+
name: build.tar.gz
110+
- name: Unzip build artifact
111+
run: tar xf build.tar.gz
112+
- name: Bump Node memory limit
113+
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
114+
- name: Test setup and yarn install
115+
run: |
116+
cp config/ci.config.json config/project.json
117+
- name: Run tests
118+
run: cd packages/firestore && yarn run ${{ matrix.test-name }}
119+
34120

35121
test-firefox:
36-
name: Test Firestore on Firefox If Changed
122+
name: Test Firestore on Firefox
123+
strategy:
124+
matrix:
125+
test-name: ["test:browser", "test:travis", "test:lite:browser", "test:browser:prod:nameddb", "test:lite:browser:nameddb"]
37126
# Whatever version of Firefox comes with 22.04 is causing Firefox
38127
# startup to hang when launched by karma. Need to look further into
39128
# why.
40129
runs-on: ubuntu-20.04
41-
130+
needs: build
131+
if: ${{ needs.build.outputs.changed == 'true'}}
42132
steps:
43133
- name: install Firefox stable
44134
run: |
45135
sudo apt-get update
46136
sudo apt-get install firefox
47-
- name: Checkout Repo
48-
uses: actions/checkout@master
137+
- name: Download build archive
138+
uses: actions/download-artifact@v3
49139
with:
50-
# This makes Actions fetch all Git history so run-changed script can diff properly.
51-
fetch-depth: 0
140+
name: build.tar.gz
141+
- name: Unzip build artifact
142+
run: tar xf build.tar.gz
52143
- name: Set up Node (14)
53144
uses: actions/setup-node@v3
54145
with:
@@ -58,10 +149,7 @@ jobs:
58149
- name: Test setup and yarn install
59150
run: |
60151
cp config/ci.config.json config/project.json
61-
yarn
62-
- name: build
63-
run: yarn build:changed firestore
64-
- name: Run tests if firestore or its dependencies has changed
65-
run: xvfb-run yarn test:changed firestore
152+
- name: Run tests
153+
run: cd packages/firestore && xvfb-run yarn run ${{ matrix.test-name }}
66154
env:
67155
BROWSERS: 'Firefox'

scripts/ci/check_changeset.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ async function main() {
124124
const errors = [];
125125
try {
126126
await exec(`yarn changeset status`);
127-
console.log(`"BLOCKING_FAILURE=false" >> $GITHUB_OUTPUT`);
127+
await exec(`echo "BLOCKING_FAILURE=false" >> $GITHUB_OUTPUT`);
128128
} catch (e) {
129129
const error = e as Error;
130130
if (error.message.match('No changesets present')) {
131-
console.log(`"BLOCKING_FAILURE=false" >> $GITHUB_OUTPUT`);
131+
await exec(`echo "BLOCKING_FAILURE=false" >> $GITHUB_OUTPUT`);
132132
} else {
133133
const messageLines = error.message.replace(/🦋 error /g, '').split('\n');
134134
let formattedStatusError =
@@ -147,9 +147,9 @@ async function main() {
147147
/**
148148
* Sets Github Actions output for a step. Pass changeset error message to next
149149
* step. See:
150-
* https://github.com/actions/toolkit/blob/master/docs/commands.md#set-outputs
150+
* https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter
151151
*/
152-
console.log(`"BLOCKING_FAILURE=true" >> $GITHUB_OUTPUT`);
152+
await exec(`echo "BLOCKING_FAILURE=true" >> $GITHUB_OUTPUT`);
153153
}
154154
}
155155

@@ -185,13 +185,13 @@ async function main() {
185185
`- Package ${bumpPackage} has a ${bumpText} bump which requires an ` +
186186
`additional line to bump the main "firebase" package to ${bumpText}.`
187187
);
188-
console.log(`"BLOCKING_FAILURE=true" >> $GITHUB_OUTPUT`);
188+
await exec(`echo "BLOCKING_FAILURE=true" >> $GITHUB_OUTPUT`);
189189
} else if (bumpRank[changesetPackages['firebase']] < highestBump) {
190190
errors.push(
191191
`- Package ${bumpPackage} has a ${bumpText} bump. ` +
192192
`Increase the bump for the main "firebase" package to ${bumpText}.`
193193
);
194-
console.log(`"BLOCKING_FAILURE=true" >> $GITHUB_OUTPUT`);
194+
await exec(`echo "BLOCKING_FAILURE=true" >> $GITHUB_OUTPUT`);
195195
}
196196
}
197197
}
@@ -203,11 +203,11 @@ async function main() {
203203
/**
204204
* Sets Github Actions output for a step. Pass changeset error message to next
205205
* step. See:
206-
* https://github.com/actions/toolkit/blob/master/docs/commands.md#set-outputs
206+
* https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter
207207
*/
208208
if (errors.length > 0)
209-
console.log(
210-
`"CHANGESET_ERROR_MESSAGE=${errors.join('%0A')}" >> $GITHUB_OUTPUT`
209+
await exec(
210+
`echo "CHANGESET_ERROR_MESSAGE=${errors.join('%0A')}" >> $GITHUB_OUTPUT`
211211
);
212212
process.exit();
213213
}

0 commit comments

Comments
 (0)