From a50ccc7288d7678ea9a5d0bebce848a5f1c7ce9d Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Thu, 31 Oct 2024 13:35:20 -0400 Subject: [PATCH] Cache dependencies and archive builds in all workflows --- .github/workflows/canary-deploy.yml | 16 +- .github/workflows/check-changeset.yml | 16 +- .github/workflows/check-docs.yml | 16 +- .github/workflows/check-pkg-paths.yml | 19 +- .github/workflows/deploy-config.yml | 16 +- .github/workflows/e2e-test.yml | 7 +- .github/workflows/format.yml | 16 +- .../workflows/health-metrics-pull-request.yml | 26 ++- .github/workflows/lint.yml | 16 +- .../workflows/prerelease-manual-deploy.yml | 16 +- .github/workflows/release-log.yml | 5 +- .github/workflows/release-pr.yml | 17 +- .github/workflows/release-prod.yml | 12 +- .github/workflows/release-staging.yml | 12 +- .github/workflows/release-tweet.yml | 5 +- .github/workflows/test-all.yml | 160 ++++++++------ .github/workflows/test-changed-auth.yml | 118 +++++++--- .../test-changed-fcm-integration.yml | 4 +- .../test-changed-firestore-integration.yml | 7 +- .github/workflows/test-changed-firestore.yml | 205 +++++++++++------- .github/workflows/test-changed-misc.yml | 4 +- .github/workflows/test-changed.yml | 114 +++++++--- .../workflows/test-firebase-integration.yml | 4 +- .github/workflows/update-api-reports.yml | 16 +- .nvmrc | 1 + config/karma.base.js | 2 +- 26 files changed, 550 insertions(+), 300 deletions(-) create mode 100644 .nvmrc diff --git a/.github/workflows/canary-deploy.yml b/.github/workflows/canary-deploy.yml index b2139d4df0c..b92a6677601 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@v3 + - 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 fa93c2c6cc9..a2b3081aab9 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@v3 + - 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 34ad997fbc4..a9c1beb99a7 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@v3 + - 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 3d6fb1099e3..9a6d8e0675a 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@v3 + - 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 f01d8dcc9b3..8b4b426bbcf 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@v3 + - 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 f22f77e0fe5..08229df2427 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 8dc971a1a8c..08cfbfbf479 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@v3 + - 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 8c7aba8fb50..d7eb0fb4af8 100644 --- a/.github/workflows/health-metrics-pull-request.yml +++ b/.github/workflows/health-metrics-pull-request.yml @@ -39,14 +39,22 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@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 @@ -56,14 +64,20 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@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 82bb1410226..6ce41d065eb 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@v3 + - 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 7821734e85a..431e1085230 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@v3 + - 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 eaee66ce962..a27cc3eb891 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 ddfff2ed8eb..77524f8ab72 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 1ac9d1f3ee7..1d0fc399c82 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@v3 - 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 94b66c6c7a5..6b8fb86fc4c 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@v3 - 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 index ac446bed7ff..fe04f30debb 100644 --- a/.github/workflows/release-tweet.yml +++ b/.github/workflows/release-tweet.yml @@ -34,10 +34,9 @@ jobs: steps: - 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: Poll release notes page on devsite run: node scripts/ci/poll_release_notes.js env: diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 68983f50a38..380cde62fff 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -31,62 +31,65 @@ 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@v3 - 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@v3 - with: - name: build.tar.gz - path: build.tar.gz + - 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 + - name: install Chrome stable + run: | + npx @puppeteer/browsers install chrome@stable + - name: Test setup + run: cp config/ci.config.json config/project.json + - name: yarn build + 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 needs: build runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 # install Chrome first, 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 - name: Download build archive - uses: actions/download-artifact@v3 + 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@v3 + 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,6 +113,7 @@ jobs: needs: build runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 # install Chrome first, so the correct version of webdriver can be installed by chromedriver # when setting up the repo - name: install Chrome stable @@ -121,23 +125,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@v3 + 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@v3 + 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 +167,28 @@ 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: | npx @puppeteer/browsers install chrome@stable - name: Download build archive - uses: actions/download-artifact@v3 + 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@v3 + 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 +206,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,22 +216,28 @@ 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: | npx @puppeteer/browsers install chrome@stable - name: Download build archive - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 + with: + name: dists-${{ github.sha }} + - uses: actions/setup-node@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@v3 + 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 f94d058fb04..6db2b1ee81d 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,28 +48,69 @@ 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@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 - - 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 # Whatever version of Firefox comes with 22.04 is causing Firefox # startup to hang when launched by karma. Need to look further into # why. @@ -88,16 +129,23 @@ 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@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 - - 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: @@ -105,6 +153,7 @@ jobs: test-webkit: name: Test Auth on Webkit if Changed + needs: build runs-on: macos-latest steps: @@ -112,17 +161,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 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: diff --git a/.github/workflows/test-changed-fcm-integration.yml b/.github/workflows/test-changed-fcm-integration.yml index ee7b680f70d..68ebcca5c9b 100644 --- a/.github/workflows/test-changed-fcm-integration.yml +++ b/.github/workflows/test-changed-fcm-integration.yml @@ -39,9 +39,9 @@ jobs: # 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@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 diff --git a/.github/workflows/test-changed-firestore-integration.yml b/.github/workflows/test-changed-firestore-integration.yml index b288ea49ed0..137076bf4a0 100644 --- a/.github/workflows/test-changed-firestore-integration.yml +++ b/.github/workflows/test-changed-firestore-integration.yml @@ -69,15 +69,14 @@ jobs: continue-on-error: true - 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: 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 7a181702d35..167a6373bb2 100644 --- a/.github/workflows/test-changed-firestore.yml +++ b/.github/workflows/test-changed-firestore.yml @@ -37,18 +37,23 @@ 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@v3 - with: - node-version: 22.10.0 - 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 + - 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: build id: build run: | @@ -65,17 +70,14 @@ jobs: if: steps.check-changed.outcome != 'success' id: set-output run: echo "CHANGED=true" >> "$GITHUB_OUTPUT"; - - name: Archive build - if: ${{ !cancelled() && steps.build.outcome == 'success' && steps.check-changed.outcome != 'success' }} - run: | - tar -cf build.tar --exclude=.git . - gzip build.tar - name: Upload build archive if: ${{ !cancelled() && steps.build.outcome == 'success' && steps.check-changed.outcome != 'success' }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: build.tar.gz - path: build.tar.gz + name: dists-changed-firestore-${{ github.sha }} + path: | + packages/**/dist + repo-scripts/**/dist retention-days: ${{ env.artifactRetentionDays }} compat-test-chrome: @@ -84,22 +86,28 @@ jobs: needs: build if: ${{ needs.build.outputs.changed == 'true'}} steps: - - name: Set up Node (20) - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - 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: Download build archive - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: build.tar.gz - - name: Unzip build artifact - run: tar xf build.tar.gz - - name: Test setup and yarn install - run: cp config/ci.config.json config/project.json + name: dists-changed-firestore-${{ github.sha }} + - run: cp config/ci.config.json config/project.json - name: Run compat tests run: cd packages/firestore-compat && yarn run test:ci @@ -112,22 +120,28 @@ jobs: needs: build if: ${{ needs.build.outputs.changed == 'true'}} steps: - - name: Set up Node (20) - uses: actions/setup-node@v3 + - 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: - 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 Chrome stable run: | sudo apt-get update sudo apt-get install google-chrome-stable - name: Download build archive - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: build.tar.gz - - name: Unzip build artifact - run: tar xf build.tar.gz - - name: Test setup and yarn install - run: cp config/ci.config.json config/project.json + name: dists-changed-firestore-${{ github.sha }} + - run: cp config/ci.config.json config/project.json - name: Run tests run: cd packages/firestore && yarn run ${{ matrix.test-name }} env: @@ -142,20 +156,27 @@ jobs: needs: build if: ${{ github.event_name != 'pull_request' }} steps: - - name: Set up Node (20) - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - 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: Download build archive - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: build.tar.gz - - name: Unzip build artifact - run: tar xf build.tar.gz + name: dists-changed-firestore-${{ github.sha }} - name: Test setup against nightly Firestore env: INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.FIRESTORE_SDK_NIGHTLY_PROJECT_JSON }} @@ -180,18 +201,24 @@ jobs: run: | sudo apt-get update sudo apt-get install firefox - - name: Set up Node (20) - uses: actions/setup-node@v3 + - 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: - node-version: 22.10.0 + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile - name: Download build archive - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: build.tar.gz - - name: Unzip build artifact - run: tar xf build.tar.gz - - name: Test setup and yarn install - run: cp config/ci.config.json config/project.json + name: dists-changed-firestore-${{ github.sha }} + - run: cp config/ci.config.json config/project.json - name: Run compat tests run: cd packages/firestore-compat && xvfb-run yarn run test:ci env: @@ -214,17 +241,23 @@ jobs: sudo apt-get update sudo apt-get install firefox - name: Download build archive - uses: actions/download-artifact@v3 + 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@v3 + name: dists-changed-firestore-${{ github.sha }} + - uses: actions/checkout@v4 + - 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 + 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 run: cd packages/firestore && xvfb-run yarn run ${{ matrix.test-name }} env: @@ -237,20 +270,25 @@ jobs: needs: build if: ${{ needs.build.outputs.changed == 'true'}} steps: - - name: Set up Node (20) - uses: actions/setup-node@v3 + - 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: - node-version: 22.10.0 + path: "**/node_modules" + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile - name: Download build archive - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: build.tar.gz - - name: Unzip build artifact - run: tar xf build.tar.gz - - name: Test setup - run: | - cp config/ci.config.json config/project.json - npx playwright install webkit + name: dists-changed-firestore-${{ github.sha }} + - run: cp config/ci.config.json config/project.json + - run: npx playwright install webkit - name: Run compat tests run: cd packages/firestore-compat && yarn run test:ci env: @@ -268,20 +306,25 @@ jobs: needs: build if: ${{ needs.build.outputs.changed == 'true'}} steps: + - uses: actions/checkout@v4 - name: Download build archive - uses: actions/download-artifact@v3 + 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@v3 + name: dists-changed-firestore-${{ github.sha }} + - uses: actions/setup-node@v4 with: - node-version: 22.10.0 - - name: Test setup - run: | - cp config/ci.config.json config/project.json - npx playwright install webkit + 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 run: cd packages/firestore && yarn run ${{ matrix.test-name }} env: diff --git a/.github/workflows/test-changed-misc.yml b/.github/workflows/test-changed-misc.yml index 3cabe64f2b3..5f6b211d41e 100644 --- a/.github/workflows/test-changed-misc.yml +++ b/.github/workflows/test-changed-misc.yml @@ -32,9 +32,9 @@ jobs: # 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@v3 + 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 6499a825725..bdc3dd98ac1 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,25 +67,33 @@ 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@v3 + - 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 # Whatever version of Firefox comes with 22.04 is causing Firefox # startup to hang when launched by karma. Need to look further into # why. @@ -60,20 +104,28 @@ 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: + 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: | sudo apt-get update sudo apt-get install firefox - 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: @@ -82,6 +134,7 @@ jobs: test-webkit: name: Test Packages With Changed Files in Webkit + needs: build runs-on: macos-latest steps: @@ -89,17 +142,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 9a99e6f82a3..2dceaa9694a 100644 --- a/.github/workflows/test-firebase-integration.yml +++ b/.github/workflows/test-firebase-integration.yml @@ -32,9 +32,9 @@ jobs: # 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@v3 + 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 761d7020c7a..cfac4fbc331 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@v3 + - 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 00000000000..e4f846ddb04 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v22.10.0 diff --git a/config/karma.base.js b/config/karma.base.js index 49824296740..71d5dc34210 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 )}.` );