Skip to content

Commit 8ed02e9

Browse files
authored
Add new firestore-nightly workflow (#12180)
1 parent d724d30 commit 8ed02e9

File tree

3 files changed

+102
-2
lines changed

3 files changed

+102
-2
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Copyright 2023 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: firestore_nightly
16+
17+
on:
18+
pull_request:
19+
workflow_dispatch:
20+
schedule:
21+
# Run every day at 2am (PST) - cron uses UTC times
22+
- cron: '0 10 * * *'
23+
24+
concurrency:
25+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
26+
cancel-in-progress: true
27+
28+
jobs:
29+
check:
30+
runs-on: macos-12
31+
steps:
32+
- uses: actions/checkout@v3
33+
34+
- uses: actions/setup-python@v4
35+
with:
36+
python-version: 3.11
37+
38+
- name: Setup check
39+
run: scripts/setup_check.sh
40+
41+
- name: Run check
42+
run: scripts/check.sh --test-only
43+
44+
cmake-prod-db:
45+
needs: check
46+
47+
strategy:
48+
matrix:
49+
os: [macos-12]
50+
databaseId: [(default)]
51+
52+
env:
53+
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
54+
MINT_PATH: ${{ github.workspace }}/mint
55+
TARGET_DATABASE_ID: ${{ matrix.databaseId }}
56+
57+
runs-on: ${{ matrix.os }}
58+
steps:
59+
- uses: actions/checkout@v3
60+
61+
- name: Prepare ccache
62+
uses: actions/cache@v3
63+
with:
64+
path: ${{ runner.temp }}/ccache
65+
key: firestore-ccache-${{ matrix.databaseId }}-${{ runner.os }}-${{ github.sha }}
66+
restore-keys: |
67+
firestore-ccache-${{ matrix.databaseId }}-${{ runner.os }}-
68+
69+
- name: Cache Mint packages
70+
uses: actions/cache@v3
71+
with:
72+
path: ${{ env.MINT_PATH }}
73+
key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }}
74+
restore-keys: ${{ runner.os }}-mint-
75+
76+
- uses: actions/setup-python@v4
77+
with:
78+
python-version: '3.7'
79+
80+
- name: Install Secret GoogleService-Info.plist
81+
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/firestore-nightly.plist.gpg \
82+
Firestore/Example/App/GoogleService-Info.plist "$plist_secret"
83+
84+
# Skipping terraform index creation because we are not allowed to download SA key json.
85+
86+
- name: Setup build
87+
run: scripts/install_prereqs.sh Firestore ${{ runner.os }} cmake
88+
89+
- name: Build and test
90+
run: |
91+
export CCACHE_DIR=${{ runner.temp }}/ccache
92+
export TARGET_BACKEND=nightly
93+
scripts/third_party/travis/retry.sh scripts/build.sh Firestore ${{ runner.os }} cmake

Firestore/Example/Tests/Integration/API/FIRServerTimestampTests.mm

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,18 @@ - (void)verifyTimestampsInSnapshot:(FIRDocumentSnapshot *)snapshot
123123

124124
/** Verifies a snapshot containing _setData but with resolved server timestamps. */
125125
- (void)verifySnapshotWithResolvedTimestamps:(FIRDocumentSnapshot *)snapshot {
126+
// Tolerate up to 10 seconds of clock skew between client and server.
127+
NSInteger tolerance = 10;
128+
129+
// Somehow the skew is much worse in nightly
130+
if ([self.db.settings.host isEqualToString:@"test-firestore.sandbox.googleapis.com"]) {
131+
tolerance = 200;
132+
}
133+
126134
XCTAssertTrue(snapshot.exists);
127135
FIRTimestamp *when = snapshot[@"when"];
128136
XCTAssertTrue([when isKindOfClass:[FIRTimestamp class]]);
129-
// Tolerate up to 10 seconds of clock skew between client and server.
130-
XCTAssertEqualWithAccuracy(when.seconds, [FIRTimestamp timestamp].seconds, 10);
137+
XCTAssertEqualWithAccuracy(when.seconds, [FIRTimestamp timestamp].seconds, tolerance);
131138

132139
// Validate the rest of the document.
133140
XCTAssertEqualObjects(snapshot.data, [self expectedDataWithTimestamp:when]);
518 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)