From 8ed02e9418c19d10391109d1a10ff1b252b0e8a1 Mon Sep 17 00:00:00 2001 From: wu-hui <53845758+wu-hui@users.noreply.github.com> Date: Fri, 8 Dec 2023 07:27:30 -0500 Subject: [PATCH] Add new firestore-nightly workflow (#12180) --- .github/workflows/firestore-nightly.yml | 93 ++++++++++++++++++ .../API/FIRServerTimestampTests.mm | 11 ++- .../gha-encrypted/firestore-nightly.plist.gpg | Bin 0 -> 518 bytes 3 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/firestore-nightly.yml create mode 100644 scripts/gha-encrypted/firestore-nightly.plist.gpg diff --git a/.github/workflows/firestore-nightly.yml b/.github/workflows/firestore-nightly.yml new file mode 100644 index 00000000000..e4261462f2f --- /dev/null +++ b/.github/workflows/firestore-nightly.yml @@ -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 diff --git a/Firestore/Example/Tests/Integration/API/FIRServerTimestampTests.mm b/Firestore/Example/Tests/Integration/API/FIRServerTimestampTests.mm index 13fc8e960fb..1f8f28473fc 100644 --- a/Firestore/Example/Tests/Integration/API/FIRServerTimestampTests.mm +++ b/Firestore/Example/Tests/Integration/API/FIRServerTimestampTests.mm @@ -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]); diff --git a/scripts/gha-encrypted/firestore-nightly.plist.gpg b/scripts/gha-encrypted/firestore-nightly.plist.gpg new file mode 100644 index 0000000000000000000000000000000000000000..7c8645634c1bf476ca11311078893a7ade96356a GIT binary patch literal 518 zcmV+h0{Q)n4Fm}T2qT}|y9O6rU;EO*Gy!61K)a|*^zV`CeTF#x<`^UqFEk8_q$Pk& zy%c!>5cwy1Phq^|ii_aIH`&AJIZ8FSM($F&!tDhVvuHmudX{I9y0Z*>@iB@WmdX_+ z7~;DJ>X(|5TYs*w?2SM^o2J_t)=6w>C)E{S(KuxK4kE7=9_G(LSO<1xNF{CkStgBsYtgr-j zKG#hE_2}&L!;poCm(!sZuB7C>IPFWk6^d(oX4R>y^-ValJEZiP|+&`K;gAz?b`z-8LrLI zlF<7rE%I=VgCm6R+q(H_zcW*>Wonows$1rmce$H=+V+Sl4l#3bE1=X3EVP67J*fSU zaNZS}E(CVhKl=ec!vAx6WQl)r!kQi8ujJsYlC6KFs@%ukk{#nt@N$N+yk&hn@&`lm zJ-?$#{Cz)V-%2k1#r(=Ut_hqsdo=f1crJ5*!>C_18k5?F+frwQi%F@5-PhhxGYNff zp-9nk48y;4=q2tS50LYr-hrOzLM^jSgHu6_APnQ*0f1%wz=Ea{h4p|(7~UjxjMk|^ IR(cj*CL0?I0ssI2 literal 0 HcmV?d00001