Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new firestore-nightly workflow #12180

Merged
merged 8 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Loading