diff --git a/.github/workflows/canary-deploy.yml b/.github/workflows/canary-deploy.yml index 2a9a6a803a..b92a667760 100644 --- a/.github/workflows/canary-deploy.yml +++ b/.github/workflows/canary-deploy.yml @@ -31,12 +31,18 @@ jobs: with: # Canary release script requires git history and tags. fetch-depth: 0 - - name: Set up Node (20) - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: - node-version: 22.10.0 - - name: Yarn install - run: yarn + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile - name: Deploy canary run: yarn release canary env: diff --git a/.github/workflows/check-changeset.yml b/.github/workflows/check-changeset.yml index 3514f409c8..a2b3081aab 100644 --- a/.github/workflows/check-changeset.yml +++ b/.github/workflows/check-changeset.yml @@ -34,12 +34,18 @@ jobs: with: # This makes Actions fetch all Git history so check_changeset script can diff properly. fetch-depth: 0 - - name: Set up Node (20) - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: - node-version: 22.10.0 - - name: Yarn install - run: yarn + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile - name: Run changeset script # pull main so changeset can diff against it run: | diff --git a/.github/workflows/check-docs.yml b/.github/workflows/check-docs.yml index de182b3eeb..a9c1beb99a 100644 --- a/.github/workflows/check-docs.yml +++ b/.github/workflows/check-docs.yml @@ -27,12 +27,18 @@ jobs: with: # get all history for the diff fetch-depth: 0 - - name: Set up Node (20) - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: - node-version: 22.10.0 - - name: Yarn install - run: yarn + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile - name: Run doc generation run: yarn docgen:all - name: Check for changes in docs-devsite dir (fail if so) diff --git a/.github/workflows/check-pkg-paths.yml b/.github/workflows/check-pkg-paths.yml index 96dfc6f655..9a6d8e0675 100644 --- a/.github/workflows/check-pkg-paths.yml +++ b/.github/workflows/check-pkg-paths.yml @@ -27,14 +27,19 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 - - name: Set up Node (20) - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: - node-version: 22.10.0 - - name: Yarn install - run: yarn - - name: Yarn build - run: yarn build + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile + - run: yarn build - name: Swap in public typings run: yarn release:prepare - name: Check paths diff --git a/.github/workflows/deploy-config.yml b/.github/workflows/deploy-config.yml index 0c3604e470..8b4b426bbc 100644 --- a/.github/workflows/deploy-config.yml +++ b/.github/workflows/deploy-config.yml @@ -35,12 +35,18 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 - - name: Set up node (20) - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: - node-version: 22.10.0 - - name: Yarn install - run: yarn + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile - name: Deploy project config if needed run: yarn ts-node scripts/ci-test/deploy-if-needed.ts env: diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 0857860571..af2c77e503 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -36,10 +36,11 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v4 - - name: Set up Node (20) - uses: actions/setup-node@master + - uses: actions/setup-node@v4 with: - node-version: 22.10.0 + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock - name: install Chrome stable run: | sudo apt-get update diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index f0bbd672fc..08cfbfbf47 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -31,12 +31,18 @@ jobs: with: # get all history for the diff fetch-depth: 0 - - name: Set up node (20) - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: - node-version: 22.10.0 - - name: Yarn install - run: yarn + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile - name: Run formatting script run: yarn format - name: Check for changes (fail if so) diff --git a/.github/workflows/health-metrics-pull-request.yml b/.github/workflows/health-metrics-pull-request.yml index cd6ca442a6..d7eb0fb4af 100644 --- a/.github/workflows/health-metrics-pull-request.yml +++ b/.github/workflows/health-metrics-pull-request.yml @@ -41,12 +41,20 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v4 with: - node-version: 22.10.0 + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile - uses: 'google-github-actions/auth@v0' with: credentials_json: '${{ secrets.GCP_SA_KEY }}' - uses: google-github-actions/setup-gcloud@v2 - - run: yarn install - run: yarn build - name: Run health-metrics/binary-size test run: yarn size-report @@ -58,12 +66,18 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v4 with: - node-version: 22.10.0 + node-version-file: '.nvmrc' - uses: 'google-github-actions/auth@v0' with: credentials_json: '${{ secrets.GCP_SA_KEY }}' - uses: google-github-actions/setup-gcloud@v2 - - run: yarn install + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile - run: yarn build - name: Run health-metrics/modular-exports-binary-size test run: yarn modular-export-size-report diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b6883bea30..6ce41d065e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -23,11 +23,17 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up node (20) - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: - node-version: 22.10.0 - - name: yarn install - run: yarn + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile - name: yarn lint run: yarn lint diff --git a/.github/workflows/prerelease-manual-deploy.yml b/.github/workflows/prerelease-manual-deploy.yml index e5ccabdd14..431e108523 100644 --- a/.github/workflows/prerelease-manual-deploy.yml +++ b/.github/workflows/prerelease-manual-deploy.yml @@ -34,12 +34,18 @@ jobs: with: # Canary release script requires git history and tags. fetch-depth: 0 - - name: Set up node (20) - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: - node-version: 22.10.0 - - name: Yarn install - run: yarn + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile - name: Deploy prerelease run: yarn release custom -p ${{ github.event.inputs.prereleaseName }} -t ${{ github.event.inputs.npmTag }} env: diff --git a/.github/workflows/release-log.yml b/.github/workflows/release-log.yml index eaee66ce96..a27cc3eb89 100644 --- a/.github/workflows/release-log.yml +++ b/.github/workflows/release-log.yml @@ -28,10 +28,9 @@ jobs: - name: Checkout Repo uses: actions/checkout@v4 - - name: Setup Node.js 20.x - uses: actions/setup-node@master + - uses: actions/setup-node@v4 with: - node-version: 22.10.0 + node-version-file: '.nvmrc' - name: Get PR number and send to tracker. run: node scripts/ci/log-changesets.js diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml index ddfff2ed8e..77524f8ab7 100644 --- a/.github/workflows/release-pr.yml +++ b/.github/workflows/release-pr.yml @@ -32,13 +32,20 @@ jobs: # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits fetch-depth: 0 - - name: Setup Node.js 20.x - uses: actions/setup-node@master + - uses: actions/setup-node@v4 with: - node-version: 22.10.0 + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock - - name: Install Dependencies - run: yarn + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + + - run: yarn install --frozen-lockfile # Ensures a new @firebase/app is published with every release. # This keeps the SDK_VERSION variable up to date. diff --git a/.github/workflows/release-prod.yml b/.github/workflows/release-prod.yml index f5a5b80862..1d0fc399c8 100644 --- a/.github/workflows/release-prod.yml +++ b/.github/workflows/release-prod.yml @@ -32,10 +32,6 @@ jobs: contents: write steps: - - name: Set up node (20) - uses: actions/setup-node@v4 - with: - node-version: 22.10.0 - name: Checkout release branch (with history) uses: actions/checkout@v4 with: @@ -43,8 +39,12 @@ jobs: fetch-depth: 0 ref: ${{ github.event.inputs.release-branch }} token: ${{ secrets.OSS_BOT_GITHUB_TOKEN }} - - name: Yarn install - run: yarn + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - run: yarn install --frozen-lockfile - name: Publish to NPM # --skipTests No need to run tests # --skipReinstall Yarn install has already been run diff --git a/.github/workflows/release-staging.yml b/.github/workflows/release-staging.yml index d014167766..6b8fb86fc4 100644 --- a/.github/workflows/release-staging.yml +++ b/.github/workflows/release-staging.yml @@ -46,10 +46,6 @@ jobs: # Block this workflow if run on a non-release branch. if: github.event.inputs.release-branch == 'release' || endsWith(github.event.inputs.release-branch, '-releasebranch') steps: - - name: Set up node (20) - uses: actions/setup-node@v4 - with: - node-version: 22.10.0 - name: Merge main into release uses: actions/github-script@v6 with: @@ -68,8 +64,12 @@ jobs: # Release script requires git history and tags. fetch-depth: 0 ref: ${{ github.event.inputs.release-branch }} - - name: Yarn install - run: yarn + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - run: yarn install --frozen-lockfile - name: Publish to NPM # --skipTests No need to run tests # --skipReinstall Yarn install has already been run diff --git a/.github/workflows/release-tweet.yml b/.github/workflows/release-tweet.yml deleted file mode 100644 index ac446bed7f..0000000000 --- a/.github/workflows/release-tweet.yml +++ /dev/null @@ -1,55 +0,0 @@ -# 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: Send Release Tweet - -on: - workflow_dispatch: - inputs: - version: - description: 'Version number' - type: string - required: true - force: - description: 'Force publish' - type: boolean - default: false - required: true - -jobs: - tweet: - name: Send Release Tweet - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - - name: Setup Node.js 20.x - uses: actions/setup-node@master - with: - node-version: 22.10.0 - - name: Poll release notes page on devsite - run: node scripts/ci/poll_release_notes.js - env: - VERSION: ${{ github.event.inputs.version }} - FORCE_PUBLISH: ${{ github.event.inputs.force }} - - name: Post to Twitter - uses: firebase/firebase-admin-node/.github/actions/send-tweet@master - with: - status: > - v${{github.event.inputs.version}} of @Firebase JavaScript client for Web / Node.js is available. - Release notes: https://firebase.google.com/support/release-notes/js#${{github.event.inputs.version}} - consumer-key: ${{ secrets.TWITTER_CONSUMER_KEY }} - consumer-secret: ${{ secrets.TWITTER_CONSUMER_SECRET }} - access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }} - access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} \ No newline at end of file diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 02f8eda2a9..20bd06f79d 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -31,38 +31,37 @@ env: jobs: build: - name: Build the SDK runs-on: ubuntu-latest steps: - # Install Chrome so the correct version of webdriver can be installed by chromedriver when - # setting up the repo. This must be done to build and execute Auth properly. - - name: install Chrome stable - run: | - npx @puppeteer/browsers install chrome@stable - - uses: actions/checkout@v3 - - name: Set up Node (20) - uses: actions/setup-node@v4 - with: - node-version: 22.10.0 - - name: Test setup and yarn install - run: | - cp config/ci.config.json config/project.json - yarn - - name: yarn build - run: yarn build - - name: Archive build - if: ${{ !cancelled() }} - run: | - tar -cf build.tar --exclude=.git . - gzip build.tar - - name: Upload build archive - if: ${{ !cancelled() }} - uses: actions/upload-artifact@v4 - with: - name: build.tar.gz - path: build.tar.gz + # Install Chrome so the correct version of webdriver can be installed by chromedriver when + # setting up the repo. This must be done to build and execute Auth properly. + - name: install Chrome stable + run: | + npx @puppeteer/browsers install chrome@stable + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile + - run: cp config/ci.config.json config/project.json + - run: yarn build + - name: Upload build archive + uses: actions/upload-artifact@v4 + with: + name: dists-${{ github.sha }} + path: | + packages/**/dist + repo-scripts/**/dist retention-days: ${{ env.artifactRetentionDays }} - + # Auth and Firestore are built and executed in their own jobs in an attempt to reduce flakiness. test-the-rest: name: (bulk) Node.js and Browser (Chrome) Tests @@ -73,20 +72,24 @@ jobs: - name: install Chrome stable run: | npx @puppeteer/browsers install chrome@stable + - uses: actions/checkout@v4 - name: Download build archive uses: actions/download-artifact@v4 with: - name: build.tar.gz - - name: Unzip build artifact - run: tar xf build.tar.gz - - name: Set up Node (20) - uses: actions/setup-node@v4 + name: dists-${{ github.sha }} + - uses: actions/setup-node@v4 with: - node-version: 22.10.0 - - name: Test setup and yarn install - run: | - cp config/ci.config.json config/project.json - yarn + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile + - run: cp config/ci.config.json config/project.json - name: Set start timestamp env var run: echo "FIREBASE_CI_TEST_START_TIME=$(date +%s)" >> $GITHUB_ENV - name: Run unit tests @@ -110,8 +113,7 @@ jobs: needs: build runs-on: ubuntu-latest steps: - # install Chrome first, so the correct version of webdriver can be installed by chromedriver - # when setting up the repo + - uses: actions/checkout@v4 - name: install Chrome stable run: | npx @puppeteer/browsers install chrome@stable @@ -121,23 +123,26 @@ jobs: echo "::warning ::Previously validated version: ${CHROME_VALIDATED_VERSION} vs. Installed version: $chromeVersionString" echo "CHROME_VERSION_NOTES=$CHROME_VERSION_MISMATCH_MESSAGE" >> "$GITHUB_ENV" fi - - name: Test Evn TEMP + - name: Test Env TEMP run: | echo $CHROME_VERSION_NOTES=$CHROME_VERSION_MISMATCH_MESSAGE - name: Download build archive uses: actions/download-artifact@v4 with: - name: build.tar.gz - - name: Unzip build artifact - run: tar xf build.tar.gz - - name: Set up Node (20) - uses: actions/setup-node@v4 + name: dists-${{ github.sha }} + - uses: actions/setup-node@v4 with: - node-version: 22.10.0 - - name: Test setup and yarn install - run: | - cp config/ci.config.json config/project.json - yarn + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile + - run: cp config/ci.config.json config/project.json - name: Set start timestamp env var run: echo "FIREBASE_CI_TEST_START_TIME=$(date +%s)" >> $GITHUB_ENV - name: Run unit tests @@ -160,24 +165,28 @@ jobs: needs: build runs-on: ubuntu-latest steps: - # install Chrome so the correct version of webdriver can be installed by chromedriver when setting up the repo - name: install Chrome stable run: | npx @puppeteer/browsers install chrome@stable + - uses: actions/checkout@v4 + # install Chrome so the correct version of webdriver can be installed by chromedriver when setting up the repo - name: Download build archive uses: actions/download-artifact@v4 with: - name: build.tar.gz - - name: Unzip build artifact - run: tar xf build.tar.gz - - name: Set up Node (20) - uses: actions/setup-node@v4 + name: dists-${{ github.sha }} + - uses: actions/setup-node@v4 with: - node-version: 22.10.0 - - name: Test setup and yarn install - run: | - cp config/ci.config.json config/project.json - yarn + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile + - run: cp config/ci.config.json config/project.json - name: Set start timestamp env var run: echo "FIREBASE_CI_TEST_START_TIME=$(date +%s)" >> $GITHUB_ENV - name: Run unit tests @@ -195,6 +204,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} path-to-lcov: ./lcov-all.info continue-on-error: true + test-firestore-integration: strategy: fail-fast: false @@ -204,6 +214,7 @@ jobs: needs: build runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 # install Chrome so the correct version of webdriver can be installed by chromedriver when setting up the repo - name: install Chrome stable run: | @@ -211,15 +222,20 @@ jobs: - name: Download build archive uses: actions/download-artifact@v4 with: - name: build.tar.gz - - name: Unzip build artifact - run: tar xf build.tar.gz - - name: Set up Node (20) - uses: actions/setup-node@v4 + name: dists-${{ github.sha }} + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules with: - node-version: 22.10.0 + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile - run: cp config/ci.config.json config/project.json - - run: yarn - run: yarn build:${{ matrix.persistence }} working-directory: integration/firestore - run: xvfb-run yarn karma:singlerun diff --git a/.github/workflows/test-changed-auth.yml b/.github/workflows/test-changed-auth.yml index 445c2bfb9b..be00f8ec2c 100644 --- a/.github/workflows/test-changed-auth.yml +++ b/.github/workflows/test-changed-auth.yml @@ -24,12 +24,12 @@ env: CHROMEDRIVER_CDNURL: https://googlechromelabs.github.io/ CHROMEDRIVER_CDNBINARIESURL: https://storage.googleapis.com/chrome-for-testing-public CHROME_VALIDATED_VERSION: linux-120.0.6099.71 + artifactRetentionDays: 14 # Bump Node memory limit NODE_OPTIONS: "--max_old_space_size=4096" jobs: - test-chrome: - name: Test Auth on Chrome and Node If Changed + build: runs-on: ubuntu-latest steps: # install Chrome first, so the correct version of webdriver can be installed by chromedriver @@ -48,49 +48,97 @@ jobs: echo "::warning ::Previously validated version: ${CHROME_VALIDATED_VERSION} vs. Installed version: $chromeVersionString" echo "CHROME_VERSION_NOTES=$CHROME_VERSION_MISMATCH_MESSAGE" >> "$GITHUB_ENV" fi - - name: Test Evn TEMP + - name: Test Env TEMP run: | echo $CHROME_VERSION_NOTES=$CHROME_VERSION_MISMATCH_MESSAGE + - uses: actions/checkout@v4 + with: + # Fetch all Git history so that the build:changed script can use diffs + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile + - run: cp config/ci.config.json config/project.json + - run: yarn build:changed core + - name: Upload build archive + uses: actions/upload-artifact@v4 + with: + name: dists-changed-auth-${{ github.sha }} + path: | + packages/**/dist + repo-scripts/**/dist + retention-days: ${{ env.artifactRetentionDays }} + + test-chrome: + name: Test Auth on Chrome and Node If Changed + needs: build + runs-on: ubuntu-latest + steps: - name: Checkout Repo uses: actions/checkout@v4 with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 - - name: Set up Node (20) - uses: actions/setup-node@v4 + - name: Download build archive + uses: actions/download-artifact@v4 with: - node-version: 22.10.0 - - name: Test setup and yarn install - run: | - cp config/ci.config.json config/project.json - yarn - - name: build - run: yarn build:changed auth + name: dists-changed-auth-${{ github.sha }} + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile + - run: cp config/ci.config.json config/project.json - name: Run tests on changed packages run: xvfb-run yarn test:changed auth + test-firefox: name: Test Auth on Firefox If Changed - + needs: build runs-on: ubuntu-latest steps: - name: install Firefox stable run: npx @puppeteer/browsers install firefox@stable + - name: Checkout Repo uses: actions/checkout@v4 with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 - - name: Set up Node (20) - uses: actions/setup-node@v4 + - name: Download build archive + uses: actions/download-artifact@v4 with: - node-version: 22.10.0 - - name: Test setup and yarn install - run: | - cp config/ci.config.json config/project.json - yarn - - name: build - run: yarn build:changed auth + name: dists-changed-auth-${{ github.sha }} + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile + - run: cp config/ci.config.json config/project.json - name: Run tests on auth changed packages run: xvfb-run yarn test:changed auth env: @@ -98,6 +146,7 @@ jobs: test-webkit: name: Test Auth on Webkit if Changed + needs: build runs-on: macos-latest steps: @@ -105,18 +154,25 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up Node (20) - uses: actions/setup-node@v3 + - name: Download build archive + uses: actions/download-artifact@v4 with: - node-version: 22.10.0 - - name: Test setup and yarn install - run: | - cp config/ci.config.json config/project.json - yarn - npx playwright install webkit - - name: build - run: yarn build:changed auth + name: dists-changed-auth-${{ github.sha }} + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile + - run: cp config/ci.config.json config/project.json + - run: npx playwright install webkit - name: Run tests on changed packages run: yarn test:changed auth env: - BROWSERS: 'WebkitHeadless' \ No newline at end of file + BROWSERS: 'WebkitHeadless' diff --git a/.github/workflows/test-changed-fcm-integration.yml b/.github/workflows/test-changed-fcm-integration.yml index ff6023274a..68ebcca5c9 100644 --- a/.github/workflows/test-changed-fcm-integration.yml +++ b/.github/workflows/test-changed-fcm-integration.yml @@ -41,7 +41,7 @@ jobs: - name: Set up Node (20) uses: actions/setup-node@v4 with: - node-version: 22.10.0 + node-version-file: '.nvmrc' - name: Test setup and yarn install run: | cp config/ci.config.json config/project.json diff --git a/.github/workflows/test-changed-firestore-integration.yml b/.github/workflows/test-changed-firestore-integration.yml index d9269a6d1a..137076bf4a 100644 --- a/.github/workflows/test-changed-firestore-integration.yml +++ b/.github/workflows/test-changed-firestore-integration.yml @@ -71,13 +71,12 @@ jobs: - name: Set up Node (20) uses: actions/setup-node@v4 with: - node-version: 22.10.0 + node-version-file: '.nvmrc' - name: install Chrome stable run: | sudo apt-get update sudo apt-get install google-chrome-stable - - name: Test setup and yarn install - run: yarn + - run: yarn install --frozen-lockfile - name: build run: yarn build:changed firestore-integration - name: Run tests if firestore or its dependencies has changed diff --git a/.github/workflows/test-changed-firestore.yml b/.github/workflows/test-changed-firestore.yml index e5a45745f7..f35fadddce 100644 --- a/.github/workflows/test-changed-firestore.yml +++ b/.github/workflows/test-changed-firestore.yml @@ -37,10 +37,9 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 - - name: Set up Node (20) - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: - node-version: 22.10.0 + node-version-file: .nvmrc - name: install Chrome stable run: | sudo apt-get update @@ -74,7 +73,7 @@ jobs: if: ${{ !cancelled() && steps.build.outcome == 'success' && steps.check-changed.outcome != 'success' }} uses: actions/upload-artifact@v4 with: - name: build.tar.gz + name: build-${{ github.sha }} path: build.tar.gz retention-days: ${{ env.artifactRetentionDays }} @@ -84,20 +83,19 @@ jobs: needs: build if: ${{ needs.build.outputs.changed == 'true'}} steps: - - name: Set up Node (20) - uses: actions/setup-node@v4 - with: - node-version: 22.10.0 - - name: install Chrome stable - run: | - sudo apt-get update - sudo apt-get install google-chrome-stable - name: Download build archive uses: actions/download-artifact@v4 with: - name: build.tar.gz + name: build-${{ github.sha }} - name: Unzip build artifact run: tar xf build.tar.gz + - uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + - name: install Chrome stable + run: | + sudo apt-get update + sudo apt-get install google-chrome-stable - name: Test setup and yarn install run: cp config/ci.config.json config/project.json - name: Run compat tests @@ -112,20 +110,19 @@ jobs: needs: build if: ${{ needs.build.outputs.changed == 'true'}} steps: - - name: Set up Node (20) - uses: actions/setup-node@v4 - with: - node-version: 22.10.0 - - name: install Chrome stable - run: | - sudo apt-get update - sudo apt-get install google-chrome-stable - name: Download build archive uses: actions/download-artifact@v4 with: - name: build.tar.gz + name: build-${{ github.sha }} - name: Unzip build artifact run: tar xf build.tar.gz + - uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + - name: install Chrome stable + run: | + sudo apt-get update + sudo apt-get install google-chrome-stable - name: Test setup and yarn install run: cp config/ci.config.json config/project.json - name: Run tests @@ -142,20 +139,19 @@ jobs: needs: build if: ${{ github.event_name != 'pull_request' }} steps: - - name: Set up Node (20) - uses: actions/setup-node@v4 - with: - node-version: 22.10.0 - - name: install Chrome stable - run: | - sudo apt-get update - sudo apt-get install google-chrome-stable - name: Download build archive uses: actions/download-artifact@v4 with: - name: build.tar.gz + name: build-${{ github.sha }} - name: Unzip build artifact run: tar xf build.tar.gz + - uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + - name: install Chrome stable + run: | + sudo apt-get update + sudo apt-get install google-chrome-stable - name: Test setup against nightly Firestore env: INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.FIRESTORE_SDK_NIGHTLY_PROJECT_JSON }} @@ -173,18 +169,17 @@ jobs: needs: build if: ${{ needs.build.outputs.changed == 'true'}} steps: - - name: install Firefox stable - run: npx @puppeteer/browsers install firefox@stable - - name: Set up Node (20) - uses: actions/setup-node@v4 - with: - node-version: 22.10.0 - name: Download build archive uses: actions/download-artifact@v4 with: - name: build.tar.gz + name: build-${{ github.sha }} - name: Unzip build artifact run: tar xf build.tar.gz + - name: install Firefox stable + run: npx @puppeteer/browsers install firefox@stable + - uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc - name: Test setup and yarn install run: cp config/ci.config.json config/project.json - name: Run compat tests @@ -206,13 +201,12 @@ jobs: - name: Download build archive uses: actions/download-artifact@v4 with: - name: build.tar.gz + name: build-${{ github.sha }} - name: Unzip build artifact run: tar xf build.tar.gz - - name: Set up Node (20) - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: - node-version: 22.10.0 + node-version-file: .nvmrc - name: Test setup and yarn install run: cp config/ci.config.json config/project.json - name: Run tests @@ -227,16 +221,15 @@ jobs: needs: build if: ${{ needs.build.outputs.changed == 'true'}} steps: - - name: Set up Node (20) - uses: actions/setup-node@v3 - with: - node-version: 22.10.0 - name: Download build archive - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: build.tar.gz + name: build-${{ github.sha }} - name: Unzip build artifact run: tar xf build.tar.gz + - uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc - name: Test setup run: | cp config/ci.config.json config/project.json @@ -259,15 +252,14 @@ jobs: if: ${{ needs.build.outputs.changed == 'true'}} steps: - name: Download build archive - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: build.tar.gz + name: build-${{ github.sha }} - name: Unzip build artifact run: tar xf build.tar.gz - - name: Set up Node (20) - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: - node-version: 22.10.0 + node-version-file: .nvmrc - name: Test setup run: | cp config/ci.config.json config/project.json diff --git a/.github/workflows/test-changed-misc.yml b/.github/workflows/test-changed-misc.yml index ebcb2d1d36..5f6b211d41 100644 --- a/.github/workflows/test-changed-misc.yml +++ b/.github/workflows/test-changed-misc.yml @@ -34,7 +34,7 @@ jobs: - name: Set up Node (20) uses: actions/setup-node@v4 with: - node-version: 22.10.0 + node-version-file: '.nvmrc' - name: install Chrome stable run: | sudo apt-get update diff --git a/.github/workflows/test-changed.yml b/.github/workflows/test-changed.yml index 68a3e2b783..8642414ab2 100644 --- a/.github/workflows/test-changed.yml +++ b/.github/workflows/test-changed.yml @@ -17,12 +17,48 @@ name: Test Modified Packages on: pull_request env: + artifactRetentionDays: 14 # Bump Node memory limit NODE_OPTIONS: "--max_old_space_size=4096" jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + # Fetch all Git history so that the build:changed script can use diffs + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile + - name: install Chrome stable + run: | + npx @puppeteer/browsers install chrome@stable + - name: Test setup + run: cp config/ci.config.json config/project.json + - run: yarn build:changed core + - name: Upload build archive + uses: actions/upload-artifact@v4 + with: + name: dists-changed-core-${{ github.sha }} + path: | + packages/**/dist + repo-scripts/**/dist + retention-days: ${{ env.artifactRetentionDays }} + test-chrome: name: Test Packages With Changed Files in Chrome and Node + needs: build runs-on: ubuntu-latest steps: @@ -31,44 +67,60 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 - - name: Set up Node (20) - uses: actions/setup-node@v4 + - name: Download build archive + uses: actions/download-artifact@v4 + with: + name: dists-changed-core-${{ github.sha }} + - uses: actions/setup-node@v4 with: - node-version: 22.10.0 + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile - name: install Chrome stable run: | sudo apt-get update sudo apt-get install google-chrome-stable - - name: Test setup and yarn install - run: | - cp config/ci.config.json config/project.json - yarn - - name: build - run: yarn build:changed core + - run: cp config/ci.config.json config/project.json - name: Run tests on changed packages run: xvfb-run yarn test:changed core test-firefox: name: Test Packages With Changed Files in Firefox + needs: build runs-on: ubuntu-latest - + steps: - name: Checkout Repo uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up Node (20) - uses: actions/setup-node@v4 + - name: Download build archive + uses: actions/download-artifact@v4 + with: + name: dists-changed-core-${{ github.sha }} + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules with: - node-version: 22.10.0 + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile - name: install Firefox stable run: npx @puppeteer/browsers install firefox@stable - name: Test setup and yarn install - run: | - cp config/ci.config.json config/project.json - yarn - - name: build - run: yarn build:changed core + run: cp config/ci.config.json config/project.json - name: Run tests on changed packages run: xvfb-run yarn test:changed core env: @@ -77,6 +129,7 @@ jobs: test-webkit: name: Test Packages With Changed Files in Webkit + needs: build runs-on: macos-latest steps: @@ -84,17 +137,24 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up Node (20) - uses: actions/setup-node@v3 + - name: Download build archive + uses: actions/download-artifact@v4 with: - node-version: 22.10.0 - - name: Test setup and yarn install - run: | - cp config/ci.config.json config/project.json - yarn - npx playwright install webkit - - name: build - run: yarn build:changed core + name: dists-changed-core-${{ github.sha }} + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile + - run: cp config/ci.config.json config/project.json + - run: npx playwright install webkit - name: Run tests on changed packages run: yarn test:changed core env: diff --git a/.github/workflows/test-firebase-integration.yml b/.github/workflows/test-firebase-integration.yml index 26a0cb2ead..2dceaa9694 100644 --- a/.github/workflows/test-firebase-integration.yml +++ b/.github/workflows/test-firebase-integration.yml @@ -34,7 +34,7 @@ jobs: - name: Set up Node (20) uses: actions/setup-node@v4 with: - node-version: 22.10.0 + node-version-file: '.nvmrc' - name: install Chrome stable run: | sudo apt-get update diff --git a/.github/workflows/update-api-reports.yml b/.github/workflows/update-api-reports.yml index c961889de9..cfac4fbc33 100644 --- a/.github/workflows/update-api-reports.yml +++ b/.github/workflows/update-api-reports.yml @@ -30,12 +30,18 @@ jobs: # checkout HEAD commit instead of merge commit ref: ${{ github.event.pull_request.head.ref }} token: ${{ github.token }} - - name: Set up node (20) - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: - node-version: 22.10.0 - - name: Yarn install - run: yarn + node-version-file: '.nvmrc' + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile - name: Update API reports # API reports are generated as part of the build run: yarn build diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000000..e4f846ddb0 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v22.10.0 diff --git a/config/karma.base.js b/config/karma.base.js index 4982429674..71d5dc3421 100644 --- a/config/karma.base.js +++ b/config/karma.base.js @@ -31,7 +31,7 @@ function determineBrowsers() { ); if (validBrowsers.length === 0) { console.error( - `The \'BROWSER\' environment variable was set, but no supported browsers were listed. The supported browsers are ${JSON.stringify( + `he \'BROWSER\' environment variable was set, but no supported browsers were listed. The supported browsers are ${JSON.stringify( supportedBrowsers )}.` ); diff --git a/packages/auth/package.json b/packages/auth/package.json index 3b2904a414..8e52613a2d 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -90,7 +90,7 @@ "build:scripts": "tsc -moduleResolution node --module commonjs scripts/*.ts && ls scripts/*.js | xargs -I % sh -c 'terser % -o %'", "dev": "rollup -c -w", "test": "run-p --npm-path npm lint test:all", - "test:all": "run-p --npm-path npm test:browser:unit test:node:unit test:integration test:browser:integration:prodbackend", + "test:all": "run-s --npm-path npm test:browser:unit test:node:unit test:integration test:browser:integration:prodbackend", "test:integration": "firebase emulators:exec --project emulatedproject --only auth \"run-s --npm-path npm test:browser:integration:local test:node:integration:local test:webdriver\"", "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all", "test:integration:local": "run-s --npm-path npm test:node:integration:local test:browser:integration:local test:webdriver",