Skip to content

Commit 8a5799f

Browse files
committed
Merge remote-tracking branch 'origin/master' into CILogTruncationFix
2 parents d057035 + 4decdf6 commit 8a5799f

File tree

12 files changed

+357
-736
lines changed

12 files changed

+357
-736
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'

config/webpack.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ module.exports = {
115115
);
116116
}),
117117
new NodePolyfillPlugin(),
118-
new webpack.EnvironmentPlugin([
119-
'RTDB_EMULATOR_PORT',
120-
'RTDB_EMULATOR_NAMESPACE'
121-
])
118+
new webpack.EnvironmentPlugin({
119+
'RTDB_EMULATOR_PORT': false,
120+
'RTDB_EMULATOR_NAMESPACE': false
121+
})
122122
]
123123
};

integration/firestore/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
"ts-loader": "8.4.0",
3232
"typescript": "4.2.2",
3333
"webpack": "5.76.0",
34-
"webpack-stream": "6.1.2"
34+
"webpack-stream": "7.0.0"
3535
}
3636
}

packages/firestore/externs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"packages/firestore/src/util/error.ts",
3737
"packages/firestore/src/local/indexeddb_schema.ts",
3838
"packages/firestore/src/local/indexeddb_schema_legacy.ts",
39-
"packages/firestore/src/local/shared_client_state_schema.ts"
39+
"packages/firestore/src/local/shared_client_state_schema.ts",
40+
"packages/firestore/src/util/testing_hooks.ts"
4041
]
4142
}

packages/firestore/src/api.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,4 +223,8 @@ export type {
223223
} from './api/credentials';
224224
export { EmptyAuthCredentialsProvider as _EmptyAuthCredentialsProvider } from './api/credentials';
225225
export { EmptyAppCheckTokenProvider as _EmptyAppCheckTokenProvider } from './api/credentials';
226-
export { TestingHooks as _TestingHooks } from './util/testing_hooks';
226+
export {
227+
ExistenceFilterMismatchCallback as _TestingHooksExistenceFilterMismatchCallback,
228+
TestingHooks as _TestingHooks
229+
} from './util/testing_hooks';
230+
export { ExistenceFilterMismatchInfo as _TestingHooksExistenceFilterMismatchInfo } from './util/testing_hooks_spi';

packages/firestore/src/remote/watch_change.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ import { primitiveComparator } from '../util/misc';
3838
import { SortedMap } from '../util/sorted_map';
3939
import { SortedSet } from '../util/sorted_set';
4040
import {
41-
ExistenceFilterMismatchInfo as TestingHooksExistenceFilterMismatchInfo,
42-
TestingHooks
43-
} from '../util/testing_hooks';
41+
testingHooksSpi,
42+
ExistenceFilterMismatchInfo as TestingHooksExistenceFilterMismatchInfo
43+
} from '../util/testing_hooks_spi';
4444

4545
import { BloomFilter, BloomFilterError } from './bloom_filter';
4646
import { ExistenceFilter } from './existence_filter';
@@ -452,7 +452,7 @@ export class WatchChangeAggregator {
452452
purpose
453453
);
454454
}
455-
TestingHooks.instance?.notifyOnExistenceFilterMismatch(
455+
testingHooksSpi?.notifyOnExistenceFilterMismatch(
456456
createExistenceFilterMismatchInfoForTestingHooks(
457457
currentSize,
458458
watchChange.existenceFilter,

0 commit comments

Comments
 (0)