From d8ed7f4748bbab3da881e52e397753f0fae6f6a3 Mon Sep 17 00:00:00 2001 From: Wu-Hui Date: Thu, 7 Dec 2023 12:46:39 -0500 Subject: [PATCH 1/8] Add new firestore-nightly workflow --- .github/workflows/firestore-nightly.yml | 98 ++++++++++++++++++ .../gha-encrypted/firestore-nightly.plist.gpg | Bin 0 -> 518 bytes 2 files changed, 98 insertions(+) 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..d3d3e4dd8d5 --- /dev/null +++ b/.github/workflows/firestore-nightly.yml @@ -0,0 +1,98 @@ +# 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: + 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: + needs: changes + # Either a scheduled run from public repo, or a pull request with firestore changes. + if: | + (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') + 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: + # Either a scheduled run from public repo, or a pull request with firestore changes. + if: | + (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') + 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/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 From f7dae232ba6486604b5676b83d292de67ee8f41f Mon Sep 17 00:00:00 2001 From: Wu-Hui Date: Thu, 7 Dec 2023 12:55:38 -0500 Subject: [PATCH 2/8] add manual trigger --- .github/workflows/firestore-nightly.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/firestore-nightly.yml b/.github/workflows/firestore-nightly.yml index d3d3e4dd8d5..1a356c33df4 100644 --- a/.github/workflows/firestore-nightly.yml +++ b/.github/workflows/firestore-nightly.yml @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: firestore-nightly +name: firestore_nightly on: + workflow_dispatch: schedule: # Run every day at 2am (PST) - cron uses UTC times - cron: '0 10 * * *' From b7fd8fec2b0ff782fe109fe85afe59e4ec4af206 Mon Sep 17 00:00:00 2001 From: Wu-Hui Date: Thu, 7 Dec 2023 13:07:55 -0500 Subject: [PATCH 3/8] try again --- .github/workflows/firestore-nightly.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/firestore-nightly.yml b/.github/workflows/firestore-nightly.yml index 1a356c33df4..2ba27f28dcd 100644 --- a/.github/workflows/firestore-nightly.yml +++ b/.github/workflows/firestore-nightly.yml @@ -15,6 +15,7 @@ name: firestore_nightly on: + pull_request: workflow_dispatch: schedule: # Run every day at 2am (PST) - cron uses UTC times From 038cf93ed09eb14342ef97c48e25eb57b87a50dc Mon Sep 17 00:00:00 2001 From: Wu-Hui Date: Thu, 7 Dec 2023 13:10:56 -0500 Subject: [PATCH 4/8] try again --- .github/workflows/firestore-nightly.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/firestore-nightly.yml b/.github/workflows/firestore-nightly.yml index 2ba27f28dcd..83d8f23f8da 100644 --- a/.github/workflows/firestore-nightly.yml +++ b/.github/workflows/firestore-nightly.yml @@ -27,7 +27,6 @@ concurrency: jobs: check: - needs: changes # Either a scheduled run from public repo, or a pull request with firestore changes. if: | (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') From aa0c4fc09afea15f680967d0ee5be9c8186d7f21 Mon Sep 17 00:00:00 2001 From: Wu-Hui Date: Thu, 7 Dec 2023 13:16:57 -0500 Subject: [PATCH 5/8] do not skip --- .github/workflows/firestore-nightly.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/firestore-nightly.yml b/.github/workflows/firestore-nightly.yml index 83d8f23f8da..e4261462f2f 100644 --- a/.github/workflows/firestore-nightly.yml +++ b/.github/workflows/firestore-nightly.yml @@ -27,9 +27,6 @@ concurrency: jobs: check: - # Either a scheduled run from public repo, or a pull request with firestore changes. - if: | - (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') runs-on: macos-12 steps: - uses: actions/checkout@v3 @@ -45,9 +42,6 @@ jobs: run: scripts/check.sh --test-only cmake-prod-db: - # Either a scheduled run from public repo, or a pull request with firestore changes. - if: | - (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') needs: check strategy: From 4ca1145ea58b6ecc209b873da1c33756486b1fba Mon Sep 17 00:00:00 2001 From: Wu-Hui Date: Thu, 7 Dec 2023 14:51:05 -0500 Subject: [PATCH 6/8] do not auto-run on PRs --- .github/workflows/firestore-nightly.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/firestore-nightly.yml b/.github/workflows/firestore-nightly.yml index e4261462f2f..7d145d16f67 100644 --- a/.github/workflows/firestore-nightly.yml +++ b/.github/workflows/firestore-nightly.yml @@ -15,7 +15,6 @@ name: firestore_nightly on: - pull_request: workflow_dispatch: schedule: # Run every day at 2am (PST) - cron uses UTC times From 699b8ecfc866d6f58e653565c235a3a45cb1af70 Mon Sep 17 00:00:00 2001 From: Wu-Hui Date: Thu, 7 Dec 2023 15:10:40 -0500 Subject: [PATCH 7/8] fix server timestamp --- .../Tests/Integration/API/FIRServerTimestampTests.mm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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]); From 7faa05cee40ac7131a89f51922323b42ea1d9986 Mon Sep 17 00:00:00 2001 From: Wu-Hui Date: Thu, 7 Dec 2023 15:15:15 -0500 Subject: [PATCH 8/8] bring auto-run back --- .github/workflows/firestore-nightly.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/firestore-nightly.yml b/.github/workflows/firestore-nightly.yml index 7d145d16f67..e4261462f2f 100644 --- a/.github/workflows/firestore-nightly.yml +++ b/.github/workflows/firestore-nightly.yml @@ -15,6 +15,7 @@ name: firestore_nightly on: + pull_request: workflow_dispatch: schedule: # Run every day at 2am (PST) - cron uses UTC times