Skip to content

Commit

Permalink
Add new firestore-nightly workflow (#12180)
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-hui authored Dec 8, 2023
1 parent d724d30 commit 8ed02e9
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 2 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/firestore-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# 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: firestore_nightly

on:
pull_request:
workflow_dispatch:
schedule:
# Run every day at 2am (PST) - cron uses UTC times
- cron: '0 10 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
check:
runs-on: macos-12
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Setup check
run: scripts/setup_check.sh

- name: Run check
run: scripts/check.sh --test-only

cmake-prod-db:
needs: check

strategy:
matrix:
os: [macos-12]
databaseId: [(default)]

env:
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
MINT_PATH: ${{ github.workspace }}/mint
TARGET_DATABASE_ID: ${{ matrix.databaseId }}

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3

- name: Prepare ccache
uses: actions/cache@v3
with:
path: ${{ runner.temp }}/ccache
key: firestore-ccache-${{ matrix.databaseId }}-${{ runner.os }}-${{ github.sha }}
restore-keys: |
firestore-ccache-${{ matrix.databaseId }}-${{ runner.os }}-
- name: Cache Mint packages
uses: actions/cache@v3
with:
path: ${{ env.MINT_PATH }}
key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }}
restore-keys: ${{ runner.os }}-mint-

- uses: actions/setup-python@v4
with:
python-version: '3.7'

- name: Install Secret GoogleService-Info.plist
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/firestore-nightly.plist.gpg \
Firestore/Example/App/GoogleService-Info.plist "$plist_secret"

# Skipping terraform index creation because we are not allowed to download SA key json.

- name: Setup build
run: scripts/install_prereqs.sh Firestore ${{ runner.os }} cmake

- name: Build and test
run: |
export CCACHE_DIR=${{ runner.temp }}/ccache
export TARGET_BACKEND=nightly
scripts/third_party/travis/retry.sh scripts/build.sh Firestore ${{ runner.os }} cmake
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,18 @@ - (void)verifyTimestampsInSnapshot:(FIRDocumentSnapshot *)snapshot

/** Verifies a snapshot containing _setData but with resolved server timestamps. */
- (void)verifySnapshotWithResolvedTimestamps:(FIRDocumentSnapshot *)snapshot {
// Tolerate up to 10 seconds of clock skew between client and server.
NSInteger tolerance = 10;

// Somehow the skew is much worse in nightly
if ([self.db.settings.host isEqualToString:@"test-firestore.sandbox.googleapis.com"]) {
tolerance = 200;
}

XCTAssertTrue(snapshot.exists);
FIRTimestamp *when = snapshot[@"when"];
XCTAssertTrue([when isKindOfClass:[FIRTimestamp class]]);
// Tolerate up to 10 seconds of clock skew between client and server.
XCTAssertEqualWithAccuracy(when.seconds, [FIRTimestamp timestamp].seconds, 10);
XCTAssertEqualWithAccuracy(when.seconds, [FIRTimestamp timestamp].seconds, tolerance);

// Validate the rest of the document.
XCTAssertEqualObjects(snapshot.data, [self expectedDataWithTimestamp:when]);
Expand Down
Binary file added scripts/gha-encrypted/firestore-nightly.plist.gpg
Binary file not shown.

0 comments on commit 8ed02e9

Please sign in to comment.