From a50ccc7288d7678ea9a5d0bebce848a5f1c7ce9d Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Thu, 31 Oct 2024 13:35:20 -0400 Subject: [PATCH 01/11] 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 )}.` ); From 0fe2dd181f2891823a4ae7f20b011861d0381eb2 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Wed, 6 Nov 2024 12:18:22 -0500 Subject: [PATCH 02/11] Use seperate node_modules for Firestore tests --- .github/workflows/test-changed-firestore.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-changed-firestore.yml b/.github/workflows/test-changed-firestore.yml index 167a6373bb2..b83c75f192e 100644 --- a/.github/workflows/test-changed-firestore.yml +++ b/.github/workflows/test-changed-firestore.yml @@ -131,7 +131,7 @@ jobs: id: node_modules with: path: "**/node_modules" - key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + key: node_modules-firestore-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} - run: yarn install --frozen-lockfile - name: install Chrome stable run: | From 35f460af0996b8ecce063a6e0e010efa35dc2cbb Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Wed, 6 Nov 2024 12:20:44 -0500 Subject: [PATCH 03/11] Apply to all --- .github/workflows/test-changed-firestore.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-changed-firestore.yml b/.github/workflows/test-changed-firestore.yml index b83c75f192e..f1b4d4c19d7 100644 --- a/.github/workflows/test-changed-firestore.yml +++ b/.github/workflows/test-changed-firestore.yml @@ -51,7 +51,7 @@ jobs: id: node_modules with: path: "**/node_modules" - key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + key: node_modules-firestore-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} - run: yarn install --frozen-lockfile - run: cp config/ci.config.json config/project.json - name: build @@ -97,7 +97,7 @@ jobs: id: node_modules with: path: "**/node_modules" - key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + key: node_modules-firestore-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} - run: yarn install --frozen-lockfile - name: install Chrome stable run: | @@ -131,7 +131,7 @@ jobs: id: node_modules with: path: "**/node_modules" - key: node_modules-firestore-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + key: node_modules-firestore-firestore-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} - run: yarn install --frozen-lockfile - name: install Chrome stable run: | @@ -167,7 +167,7 @@ jobs: id: node_modules with: path: "**/node_modules" - key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + key: node_modules-firestore-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} - run: yarn install --frozen-lockfile - name: install Chrome stable run: | @@ -212,7 +212,7 @@ jobs: id: node_modules with: path: "**/node_modules" - key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + key: node_modules-firestore-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} - run: yarn install --frozen-lockfile - name: Download build archive uses: actions/download-artifact@v4 @@ -255,7 +255,7 @@ jobs: id: node_modules with: path: "**/node_modules" - key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + key: node_modules-firestore-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} - run: yarn install --frozen-lockfile - run: cp config/ci.config.json config/project.json - name: Run tests @@ -281,7 +281,7 @@ jobs: id: node_modules with: path: "**/node_modules" - key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + key: node_modules-firestore-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} - run: yarn install --frozen-lockfile - name: Download build archive uses: actions/download-artifact@v4 @@ -321,7 +321,7 @@ jobs: id: node_modules with: path: "**/node_modules" - key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + key: node_modules-firestore-${{ 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 From 179e3b4d691a6e53128904302c8ac95604d497ed Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Wed, 6 Nov 2024 16:09:20 -0500 Subject: [PATCH 04/11] move chrome install earlier --- .github/workflows/test-changed-firestore.yml | 40 ++++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/test-changed-firestore.yml b/.github/workflows/test-changed-firestore.yml index f1b4d4c19d7..79cd12db2b5 100644 --- a/.github/workflows/test-changed-firestore.yml +++ b/.github/workflows/test-changed-firestore.yml @@ -51,7 +51,7 @@ jobs: id: node_modules with: path: "**/node_modules" - key: node_modules-firestore-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + 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 @@ -86,6 +86,10 @@ jobs: needs: build if: ${{ needs.build.outputs.changed == 'true'}} steps: + - name: install Chrome stable + run: | + sudo apt-get update + sudo apt-get install google-chrome-stable - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: @@ -97,12 +101,8 @@ jobs: id: node_modules with: path: "**/node_modules" - key: node_modules-firestore-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + 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@v4 with: @@ -120,6 +120,10 @@ jobs: needs: build if: ${{ needs.build.outputs.changed == 'true'}} steps: + - name: install Chrome stable + run: | + sudo apt-get update + sudo apt-get install google-chrome-stable - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: @@ -131,12 +135,8 @@ jobs: id: node_modules with: path: "**/node_modules" - key: node_modules-firestore-firestore-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + 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@v4 with: @@ -156,6 +156,10 @@ jobs: needs: build if: ${{ github.event_name != 'pull_request' }} steps: + - name: install Chrome stable + run: | + sudo apt-get update + sudo apt-get install google-chrome-stable - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: @@ -167,12 +171,8 @@ jobs: id: node_modules with: path: "**/node_modules" - key: node_modules-firestore-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + 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@v4 with: @@ -212,7 +212,7 @@ jobs: id: node_modules with: path: "**/node_modules" - key: node_modules-firestore-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} - run: yarn install --frozen-lockfile - name: Download build archive uses: actions/download-artifact@v4 @@ -255,7 +255,7 @@ jobs: id: node_modules with: path: "**/node_modules" - key: node_modules-firestore-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + 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 @@ -281,7 +281,7 @@ jobs: id: node_modules with: path: "**/node_modules" - key: node_modules-firestore-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} - run: yarn install --frozen-lockfile - name: Download build archive uses: actions/download-artifact@v4 @@ -321,7 +321,7 @@ jobs: id: node_modules with: path: "**/node_modules" - key: node_modules-firestore-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + 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 From 57fa7e6f3a91af654f7ff40bc32ae8a8f8efddbe Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Thu, 7 Nov 2024 10:00:31 -0500 Subject: [PATCH 05/11] put everything back in the firestore build --- .github/workflows/test-changed-firestore.yml | 90 ++------------------ 1 file changed, 9 insertions(+), 81 deletions(-) diff --git a/.github/workflows/test-changed-firestore.yml b/.github/workflows/test-changed-firestore.yml index 79cd12db2b5..d74e4fb6ff8 100644 --- a/.github/workflows/test-changed-firestore.yml +++ b/.github/workflows/test-changed-firestore.yml @@ -74,10 +74,8 @@ jobs: if: ${{ !cancelled() && steps.build.outcome == 'success' && steps.check-changed.outcome != 'success' }} uses: actions/upload-artifact@v4 with: - name: dists-changed-firestore-${{ github.sha }} - path: | - packages/**/dist - repo-scripts/**/dist + name: build-changed-firestore-${{ github.sha }} + path: . retention-days: ${{ env.artifactRetentionDays }} compat-test-chrome: @@ -94,20 +92,10 @@ jobs: - 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: Download build archive uses: actions/download-artifact@v4 with: - name: dists-changed-firestore-${{ github.sha }} - - run: cp config/ci.config.json config/project.json + name: build-changed-firestore-${{ github.sha }} - name: Run compat tests run: cd packages/firestore-compat && yarn run test:ci @@ -128,20 +116,10 @@ jobs: - 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: Download build archive uses: actions/download-artifact@v4 with: - name: dists-changed-firestore-${{ github.sha }} - - run: cp config/ci.config.json config/project.json + name: build-changed-firestore-${{ github.sha }} - name: Run tests run: cd packages/firestore && yarn run ${{ matrix.test-name }} env: @@ -164,19 +142,10 @@ jobs: - 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: Download build archive uses: actions/download-artifact@v4 with: - name: dists-changed-firestore-${{ github.sha }} + name: build-changed-firestore-${{ github.sha }} - name: Test setup against nightly Firestore env: INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.FIRESTORE_SDK_NIGHTLY_PROJECT_JSON }} @@ -205,20 +174,10 @@ jobs: - 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: Download build archive uses: actions/download-artifact@v4 with: - name: dists-changed-firestore-${{ github.sha }} - - run: cp config/ci.config.json config/project.json + name: build-changed-firestore-${{ github.sha }} - name: Run compat tests run: cd packages/firestore-compat && xvfb-run yarn run test:ci env: @@ -243,21 +202,10 @@ jobs: - name: Download build archive uses: actions/download-artifact@v4 with: - name: dists-changed-firestore-${{ github.sha }} - - uses: actions/checkout@v4 + name: build-changed-firestore-${{ 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 run: cd packages/firestore && xvfb-run yarn run ${{ matrix.test-name }} env: @@ -270,24 +218,13 @@ jobs: needs: build if: ${{ needs.build.outputs.changed == 'true'}} steps: - - 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: Download build archive uses: actions/download-artifact@v4 with: - name: dists-changed-firestore-${{ github.sha }} - - run: cp config/ci.config.json config/project.json + name: build-changed-firestore-${{ github.sha }} - run: npx playwright install webkit - name: Run compat tests run: cd packages/firestore-compat && yarn run test:ci @@ -310,19 +247,10 @@ jobs: - name: Download build archive uses: actions/download-artifact@v4 with: - name: dists-changed-firestore-${{ github.sha }} + name: build-changed-firestore-${{ 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 From 45b32268719e439aa353906337468e3a3118f8c3 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Thu, 7 Nov 2024 10:23:24 -0500 Subject: [PATCH 06/11] revert firestore changes but upgrade to v4 of artifact --- .github/workflows/test-changed-firestore.yml | 121 +++++++++++-------- 1 file changed, 71 insertions(+), 50 deletions(-) diff --git a/.github/workflows/test-changed-firestore.yml b/.github/workflows/test-changed-firestore.yml index d74e4fb6ff8..41f5eacf8d5 100644 --- a/.github/workflows/test-changed-firestore.yml +++ b/.github/workflows/test-changed-firestore.yml @@ -37,23 +37,17 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 + - 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 - - 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: Test setup and yarn install + run: | + cp config/ci.config.json config/project.json + yarn - name: build id: build run: | @@ -70,12 +64,17 @@ 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@v4 with: - name: build-changed-firestore-${{ github.sha }} - path: . + name: build-${{ github.sha }} + path: build.tar.gz retention-days: ${{ env.artifactRetentionDays }} compat-test-chrome: @@ -84,18 +83,21 @@ jobs: needs: build if: ${{ needs.build.outputs.changed == 'true'}} steps: + - 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 - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - name: Download build archive - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v3 with: - name: build-changed-firestore-${{ github.sha }} + name: build-${{ github.sha }} + - 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: Run compat tests run: cd packages/firestore-compat && yarn run test:ci @@ -108,18 +110,21 @@ jobs: needs: build if: ${{ needs.build.outputs.changed == 'true'}} steps: + - 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 - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - name: Download build archive - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v3 with: - name: build-changed-firestore-${{ github.sha }} + name: build-${{ github.sha }} + - 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: Run tests run: cd packages/firestore && yarn run ${{ matrix.test-name }} env: @@ -134,18 +139,19 @@ jobs: needs: build if: ${{ github.event_name != 'pull_request' }} steps: + - 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 - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - name: Download build archive - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v3 with: - name: build-changed-firestore-${{ github.sha }} + name: build-${{ github.sha }} + - name: Unzip build artifact + run: tar xf build.tar.gz - name: Test setup against nightly Firestore env: INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.FIRESTORE_SDK_NIGHTLY_PROJECT_JSON }} @@ -170,14 +176,17 @@ jobs: run: | sudo apt-get update sudo apt-get install firefox - - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version-file: '.nvmrc' + node-version-file: .nvmrc - name: Download build archive - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v3 with: - name: build-changed-firestore-${{ github.sha }} + name: build-${{ github.sha }} + - 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: Run compat tests run: cd packages/firestore-compat && xvfb-run yarn run test:ci env: @@ -200,12 +209,16 @@ jobs: sudo apt-get update sudo apt-get install firefox - name: Download build archive - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v3 with: - name: build-changed-firestore-${{ github.sha }} + name: build-${{ github.sha }} + - name: Unzip build artifact + run: tar xf build.tar.gz - uses: actions/setup-node@v4 with: - node-version-file: '.nvmrc' + node-version-file: .nvmrc + - name: Test setup and yarn install + run: cp config/ci.config.json config/project.json - name: Run tests run: cd packages/firestore && xvfb-run yarn run ${{ matrix.test-name }} env: @@ -220,12 +233,17 @@ jobs: steps: - uses: actions/setup-node@v4 with: - node-version-file: '.nvmrc' + node-version-file: .nvmrc - name: Download build archive - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v3 with: - name: build-changed-firestore-${{ github.sha }} - - run: npx playwright install webkit + name: build-${{ github.sha }} + - 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: Run compat tests run: cd packages/firestore-compat && yarn run test:ci env: @@ -243,16 +261,19 @@ jobs: needs: build if: ${{ needs.build.outputs.changed == 'true'}} steps: - - uses: actions/checkout@v4 - name: Download build archive - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v3 with: - name: build-changed-firestore-${{ github.sha }} + name: build-${{ github.sha }} + - name: Unzip build artifact + run: tar xf build.tar.gz - uses: actions/setup-node@v4 with: - node-version-file: '.nvmrc' - - run: cp config/ci.config.json config/project.json - - run: npx playwright install webkit + node-version-file: .nvmrc + - name: Test setup + run: | + cp config/ci.config.json config/project.json + npx playwright install webkit - name: Run tests run: cd packages/firestore && yarn run ${{ matrix.test-name }} env: From 3aac731f1eba171acf4efe876fdfb75964f73b0c Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Thu, 7 Nov 2024 10:26:22 -0500 Subject: [PATCH 07/11] upgrade to artifact v4 in changed-firestore --- .github/workflows/test-changed-firestore.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-changed-firestore.yml b/.github/workflows/test-changed-firestore.yml index 41f5eacf8d5..603b1a9d1f0 100644 --- a/.github/workflows/test-changed-firestore.yml +++ b/.github/workflows/test-changed-firestore.yml @@ -91,7 +91,7 @@ jobs: 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-${{ github.sha }} - name: Unzip build artifact @@ -118,7 +118,7 @@ jobs: 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-${{ github.sha }} - name: Unzip build artifact @@ -147,7 +147,7 @@ jobs: 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-${{ github.sha }} - name: Unzip build artifact @@ -180,7 +180,7 @@ jobs: with: node-version-file: .nvmrc - name: Download build archive - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: build-${{ github.sha }} - name: Unzip build artifact @@ -209,7 +209,7 @@ 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-${{ github.sha }} - name: Unzip build artifact @@ -235,7 +235,7 @@ jobs: with: node-version-file: .nvmrc - name: Download build archive - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: build-${{ github.sha }} - name: Unzip build artifact @@ -262,7 +262,7 @@ 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-${{ github.sha }} - name: Unzip build artifact From f698d7000d9c9de14ba928a027403658ea231735 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Thu, 7 Nov 2024 10:40:02 -0500 Subject: [PATCH 08/11] get build before node setup --- .github/workflows/test-changed-firestore.yml | 54 ++++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/test-changed-firestore.yml b/.github/workflows/test-changed-firestore.yml index 603b1a9d1f0..27dd1ba4aaa 100644 --- a/.github/workflows/test-changed-firestore.yml +++ b/.github/workflows/test-changed-firestore.yml @@ -83,6 +83,12 @@ jobs: needs: build if: ${{ needs.build.outputs.changed == 'true'}} steps: + - name: Download build archive + uses: actions/download-artifact@v4 + with: + name: build-${{ github.sha }} + - name: Unzip build artifact + run: tar xf build.tar.gz - uses: actions/setup-node@v4 with: node-version-file: .nvmrc @@ -90,12 +96,6 @@ jobs: run: | sudo apt-get update sudo apt-get install google-chrome-stable - - name: Download build archive - uses: actions/download-artifact@v4 - with: - name: build-${{ github.sha }} - - 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: Run compat tests @@ -110,6 +110,12 @@ jobs: needs: build if: ${{ needs.build.outputs.changed == 'true'}} steps: + - name: Download build archive + uses: actions/download-artifact@v4 + with: + name: build-${{ github.sha }} + - name: Unzip build artifact + run: tar xf build.tar.gz - uses: actions/setup-node@v4 with: node-version-file: .nvmrc @@ -117,12 +123,6 @@ jobs: run: | sudo apt-get update sudo apt-get install google-chrome-stable - - name: Download build archive - uses: actions/download-artifact@v4 - with: - name: build-${{ github.sha }} - - 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: Run tests @@ -139,6 +139,12 @@ jobs: needs: build if: ${{ github.event_name != 'pull_request' }} steps: + - name: Download build archive + uses: actions/download-artifact@v4 + with: + name: build-${{ github.sha }} + - name: Unzip build artifact + run: tar xf build.tar.gz - uses: actions/setup-node@v4 with: node-version-file: .nvmrc @@ -146,12 +152,6 @@ jobs: run: | sudo apt-get update sudo apt-get install google-chrome-stable - - name: Download build archive - uses: actions/download-artifact@v4 - with: - name: build-${{ github.sha }} - - name: Unzip build artifact - run: tar xf build.tar.gz - name: Test setup against nightly Firestore env: INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.FIRESTORE_SDK_NIGHTLY_PROJECT_JSON }} @@ -172,6 +172,12 @@ jobs: needs: build if: ${{ needs.build.outputs.changed == 'true'}} steps: + - name: Download build archive + uses: actions/download-artifact@v4 + with: + name: build-${{ github.sha }} + - name: Unzip build artifact + run: tar xf build.tar.gz - name: install Firefox stable run: | sudo apt-get update @@ -179,12 +185,6 @@ jobs: - uses: actions/setup-node@v4 with: node-version-file: .nvmrc - - name: Download build archive - uses: actions/download-artifact@v4 - with: - name: build-${{ github.sha }} - - 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: Run compat tests @@ -231,15 +231,15 @@ jobs: needs: build if: ${{ needs.build.outputs.changed == 'true'}} steps: - - uses: actions/setup-node@v4 - with: - node-version-file: .nvmrc - name: Download build archive uses: actions/download-artifact@v4 with: 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 From d8db7045f40f920500acc1c17f1caf43bc8de4df Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Thu, 7 Nov 2024 11:00:30 -0500 Subject: [PATCH 09/11] move chrome installation up --- .github/workflows/test-all.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 380cde62fff..4164ecab166 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -33,6 +33,11 @@ jobs: build: 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@v4 - uses: actions/setup-node@v4 with: @@ -46,9 +51,6 @@ jobs: 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 @@ -68,11 +70,11 @@ 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 run: | npx @puppeteer/browsers install chrome@stable + - uses: actions/checkout@v4 - name: Download build archive uses: actions/download-artifact@v4 with: @@ -167,11 +169,11 @@ 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 + - 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: From 626b9ba49c5dd48a4be9da0e5adfd094a13a4789 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Thu, 7 Nov 2024 12:58:14 -0500 Subject: [PATCH 10/11] run auth tests sequentially --- .github/workflows/test-all.yml | 16 +--------------- packages/auth/package.json | 2 +- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 4164ecab166..0455b7b25aa 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -51,10 +51,7 @@ jobs: path: "**/node_modules" key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} - run: yarn install --frozen-lockfile - - name: Test setup - run: cp config/ci.config.json config/project.json - - name: yarn build - run: yarn build + - run: yarn build - name: Upload build archive uses: actions/upload-artifact@v4 with: @@ -116,17 +113,6 @@ jobs: 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 - chromeVersionString=$(ls chrome) - if [ "$CHROME_VALIDATED_VERSION" != "$chromeVersionString" ]; then - echo "::warning ::The Chrome version doesn't match the previously validated version. Consider updating CHROME_VALIDATED_VERSION in the GitHub workflow if tests pass." - 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 Env TEMP run: | echo $CHROME_VERSION_NOTES=$CHROME_VERSION_MISMATCH_MESSAGE diff --git a/packages/auth/package.json b/packages/auth/package.json index f6645c35eac..dbb10edb291 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", From 913b73540369677f9203af545b5574be3b435169 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Fri, 8 Nov 2024 12:07:11 -0500 Subject: [PATCH 11/11] add a bunch of test workflows --- .github/workflows/test-changed-auth-2.yml | 144 +++++++++++++++++ .github/workflows/test-changed-auth-3.yml | 175 ++++++++++++++++++++ .github/workflows/test-changed-auth-4.yml | 185 ++++++++++++++++++++++ .github/workflows/test-changed-auth.yml | 120 ++++---------- 4 files changed, 536 insertions(+), 88 deletions(-) create mode 100644 .github/workflows/test-changed-auth-2.yml create mode 100644 .github/workflows/test-changed-auth-3.yml create mode 100644 .github/workflows/test-changed-auth-4.yml diff --git a/.github/workflows/test-changed-auth-2.yml b/.github/workflows/test-changed-auth-2.yml new file mode 100644 index 00000000000..31cd638fa89 --- /dev/null +++ b/.github/workflows/test-changed-auth-2.yml @@ -0,0 +1,144 @@ +# 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: Test Auth With Cached Node Modules + +on: pull_request + +env: + # make chromedriver detect installed Chrome version and download the corresponding driver + DETECT_CHROMEDRIVER_VERSION: true + # The default behavior of chromedriver uses the older Chrome download URLs. We need to override + # the behavior to use the new URLs. + CHROMEDRIVER_CDNURL: https://googlechromelabs.github.io/ + CHROMEDRIVER_CDNBINARIESURL: https://storage.googleapis.com/chrome-for-testing-public + CHROME_VALIDATED_VERSION: linux-120.0.6099.71 + # Bump Node memory limit + NODE_OPTIONS: "--max_old_space_size=4096" + +jobs: + test-chrome: + name: Test Auth on Chrome and Node If Changed + runs-on: ubuntu-latest + steps: + # install Chrome first, so the correct version of webdriver can be installed by chromedriver + # when setting up the repo + # + # Note: we only need to check the chrome version change in one job as the warning annotation + # is appended to the entire workflow results, not just this job's results. + - name: install Chrome stable + env: + CHROME_VERSION_MISMATCH_MESSAGE: "The Chrome version doesn't match the previously validated version. Consider updating CHROME_VALIDATED_VERSION in the GitHub workflow if tests pass." + run: | + npx @puppeteer/browsers install chrome@stable + chromeVersionString=$(ls chrome) + if [ "$CHROME_VALIDATED_VERSION" != "$chromeVersionString" ]; then + echo "::warning ::The Chrome version doesn't match the previously validated version. Consider updating CHROME_VALIDATED_VERSION in the GitHub workflow if tests pass." + 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 + run: | + echo $CHROME_VERSION_NOTES=$CHROME_VERSION_MISMATCH_MESSAGE + - 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 + - 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 + run: yarn build:changed auth + - name: Run tests on changed packages + run: xvfb-run yarn test:changed auth + test-firefox: + name: Test Auth on Firefox If Changed + # Whatever version of Firefox comes with 22.04 is causing Firefox + # startup to hang when launched by karma. Need to look further into + # why. + + runs-on: ubuntu-20.04 + + steps: + - name: install Firefox stable + run: | + sudo apt-get update + sudo apt-get install firefox + sudo apt-get install wget + + - 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 + - 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 + run: yarn build:changed auth + - name: Run tests on auth changed packages + run: xvfb-run yarn test:changed auth + env: + BROWSERS: 'Firefox' + + test-webkit: + name: Test Auth on Webkit if Changed + runs-on: macos-latest + + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + with: + 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: npx playwright install webkit + - name: build + run: yarn build:changed auth + - name: Run tests on changed packages + run: yarn test:changed auth + env: + BROWSERS: 'WebkitHeadless' diff --git a/.github/workflows/test-changed-auth-3.yml b/.github/workflows/test-changed-auth-3.yml new file mode 100644 index 00000000000..04c81e3aaab --- /dev/null +++ b/.github/workflows/test-changed-auth-3.yml @@ -0,0 +1,175 @@ +# 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: Test Auth With Archived Build + +on: pull_request + +env: + # make chromedriver detect installed Chrome version and download the corresponding driver + DETECT_CHROMEDRIVER_VERSION: true + # The default behavior of chromedriver uses the older Chrome download URLs. We need to override + # the behavior to use the new URLs. + CHROMEDRIVER_CDNURL: https://googlechromelabs.github.io/ + CHROMEDRIVER_CDNBINARIESURL: https://storage.googleapis.com/chrome-for-testing-public + CHROME_VALIDATED_VERSION: linux-120.0.6099.71 + # Bump Node memory limit + NODE_OPTIONS: "--max_old_space_size=4096" + +jobs: + 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 + # + # Note: we only need to check the chrome version change in one job as the warning annotation + # is appended to the entire workflow results, not just this job's results. + - name: install Chrome stable + env: + CHROME_VERSION_MISMATCH_MESSAGE: "The Chrome version doesn't match the previously validated version. Consider updating CHROME_VALIDATED_VERSION in the GitHub workflow if tests pass." + run: | + npx @puppeteer/browsers install chrome@stable + chromeVersionString=$(ls chrome) + if [ "$CHROME_VALIDATED_VERSION" != "$chromeVersionString" ]; then + echo "::warning ::The Chrome version doesn't match the previously validated version. Consider updating CHROME_VALIDATED_VERSION in the GitHub workflow if tests pass." + 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 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' + - run: yarn + - 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 + runs-on: ubuntu-latest + steps: + # install Chrome first, so the correct version of webdriver can be installed by chromedriver + # when setting up the repo + # + # Note: we only need to check the chrome version change in one job as the warning annotation + # is appended to the entire workflow results, not just this job's results. + - name: install Chrome stable + env: + CHROME_VERSION_MISMATCH_MESSAGE: "The Chrome version doesn't match the previously validated version. Consider updating CHROME_VALIDATED_VERSION in the GitHub workflow if tests pass." + run: | + npx @puppeteer/browsers install chrome@stable + chromeVersionString=$(ls chrome) + if [ "$CHROME_VALIDATED_VERSION" != "$chromeVersionString" ]; then + echo "::warning ::The Chrome version doesn't match the previously validated version. Consider updating CHROME_VALIDATED_VERSION in the GitHub workflow if tests pass." + 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 + run: | + echo $CHROME_VERSION_NOTES=$CHROME_VERSION_MISMATCH_MESSAGE + - 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 + - uses: actions/setup-node@v4 + with: + node-version: .nvmrc + - name: Test setup and yarn install + run: | + cp config/ci.config.json config/project.json + yarn + - name: Download build archive + uses: actions/download-artifact@v4 + with: + name: dists-changed-auth-${{ github.sha }} + - name: Run tests on changed packages + run: xvfb-run yarn test:changed auth + test-firefox: + name: Test Auth on Firefox If Changed + # Whatever version of Firefox comes with 22.04 is causing Firefox + # startup to hang when launched by karma. Need to look further into + # why. + + runs-on: ubuntu-20.04 + + steps: + - name: install Firefox stable + run: | + sudo apt-get update + sudo apt-get install firefox + sudo apt-get install wget + + - 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 + with: + node-version-file: .nvmrc + - name: Test setup and yarn install + run: | + cp config/ci.config.json config/project.json + yarn + - name: Download build archive + uses: actions/download-artifact@v4 + with: + name: dists-changed-auth-${{ github.sha }} + - name: Run tests on auth changed packages + run: xvfb-run yarn test:changed auth + env: + BROWSERS: 'Firefox' + + test-webkit: + name: Test Auth on Webkit if Changed + runs-on: macos-latest + + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Node (20) + 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 + yarn + npx playwright install webkit + - name: Download build archive + uses: actions/download-artifact@v4 + with: + name: dists-changed-auth-${{ github.sha }} + - name: Run tests on changed packages + run: yarn test:changed auth + env: + BROWSERS: 'WebkitHeadless' diff --git a/.github/workflows/test-changed-auth-4.yml b/.github/workflows/test-changed-auth-4.yml new file mode 100644 index 00000000000..38a0715d74e --- /dev/null +++ b/.github/workflows/test-changed-auth-4.yml @@ -0,0 +1,185 @@ +# 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: Test Auth With All Changes + +on: pull_request + +env: + # make chromedriver detect installed Chrome version and download the corresponding driver + DETECT_CHROMEDRIVER_VERSION: true + # The default behavior of chromedriver uses the older Chrome download URLs. We need to override + # the behavior to use the new URLs. + 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: + 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 + # + # Note: we only need to check the chrome version change in one job as the warning annotation + # is appended to the entire workflow results, not just this job's results. + - name: install Chrome stable + env: + CHROME_VERSION_MISMATCH_MESSAGE: "The Chrome version doesn't match the previously validated version. Consider updating CHROME_VALIDATED_VERSION in the GitHub workflow if tests pass." + run: | + npx @puppeteer/browsers install chrome@stable + chromeVersionString=$(ls chrome) + if [ "$CHROME_VALIDATED_VERSION" != "$chromeVersionString" ]; then + echo "::warning ::The Chrome version doesn't match the previously validated version. Consider updating CHROME_VALIDATED_VERSION in the GitHub workflow if tests pass." + 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 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: Download build archive + uses: actions/download-artifact@v4 + with: + 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. + + runs-on: ubuntu-20.04 + + steps: + - name: install Firefox stable + run: | + sudo apt-get update + sudo apt-get install firefox + sudo apt-get install wget + + - 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: Download build archive + uses: actions/download-artifact@v4 + with: + 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: + BROWSERS: 'Firefox' + + test-webkit: + name: Test Auth on Webkit if Changed + needs: build + runs-on: macos-latest + + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Download build archive + uses: actions/download-artifact@v4 + with: + 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 diff --git a/.github/workflows/test-changed-auth.yml b/.github/workflows/test-changed-auth.yml index 6db2b1ee81d..080e3d15bba 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: - build: + test-chrome: + name: Test Auth on Chrome and Node If Changed runs-on: ubuntu-latest steps: # install Chrome first, so the correct version of webdriver can be installed by chromedriver @@ -48,69 +48,28 @@ 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 Env TEMP + - name: Test Evn 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: Download build archive - uses: actions/download-artifact@v4 - with: - 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 + - name: Set up Node (20) + uses: actions/setup-node@v3 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 + 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: 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. @@ -129,23 +88,16 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 - - name: Download build archive - uses: actions/download-artifact@v4 - with: - name: dists-changed-auth-${{ github.sha }} - - uses: actions/setup-node@v4 + - name: Set up Node (20) + uses: actions/setup-node@v3 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 + 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: Run tests on auth changed packages run: xvfb-run yarn test:changed auth env: @@ -153,7 +105,6 @@ jobs: test-webkit: name: Test Auth on Webkit if Changed - needs: build runs-on: macos-latest steps: @@ -161,25 +112,18 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Download build archive - uses: actions/download-artifact@v4 - with: - name: dists-changed-auth-${{ github.sha }} - - uses: actions/setup-node@v4 + - name: Set up Node (20) + uses: actions/setup-node@v3 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 + 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: Run tests on changed packages run: yarn test:changed auth env: - BROWSERS: 'WebkitHeadless' \ No newline at end of file + BROWSERS: 'WebkitHeadless'