diff --git a/.github/workflows/check-pkg-paths.yml b/.github/workflows/check-pkg-paths.yml index 757f70b5ab6..dcfd6e4dc75 100644 --- a/.github/workflows/check-pkg-paths.yml +++ b/.github/workflows/check-pkg-paths.yml @@ -14,10 +14,16 @@ name: Test Package Paths -on: pull_request +on: + workflow_run: + workflows: ["Build"] + types: + - completed + pull_request: jobs: test: + if: ${{ github.event.workflow_run.conclusion }} == 'success' name: Test Package Paths runs-on: ubuntu-latest @@ -27,14 +33,22 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 - - name: Set up Node (20) - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' - - name: Yarn install - run: yarn - - name: Yarn build - run: yarn build + 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-${{ github.sha }} - name: Swap in public typings run: yarn release:prepare - name: Check paths diff --git a/.github/workflows/health-metrics-pull-request.yml b/.github/workflows/health-metrics-pull-request.yml index 93aaf81a26f..b8663e85626 100644 --- a/.github/workflows/health-metrics-pull-request.yml +++ b/.github/workflows/health-metrics-pull-request.yml @@ -15,6 +15,10 @@ name: Health Metrics on: + workflow_run: + workflows: ["Build"] + types: + - completed push: branches: ['**'] pull_request: @@ -35,24 +39,35 @@ env: jobs: binary-size: name: Binary Size - if: (github.event_name == 'push' || !(github.event.pull_request.head.repo.fork)) && (github.actor != 'dependabot[bot]') + if: (${{ github.event.workflow_run.conclusion }} == 'success' && (github.event_name == 'push' || !(github.event.pull_request.head.repo.fork)) && (github.actor != 'dependabot[bot]')) runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - 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 - 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: Download build archive + uses: actions/download-artifact@v4 + with: + name: dists-${{ github.sha }} - name: Run health-metrics/binary-size test run: yarn size-report modular-export-size: name: Binary Size For Modular Exports - if: (github.event_name == 'push' || !(github.event.pull_request.head.repo.fork)) && (github.actor != 'dependabot[bot]') + if: (${{ github.event.workflow_run.conclusion }} == 'success' && (github.event_name == 'push' || !(github.event.pull_request.head.repo.fork)) && (github.actor != 'dependabot[bot]')) runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -63,8 +78,17 @@ jobs: with: credentials_json: '${{ secrets.GCP_SA_KEY }}' - uses: google-github-actions/setup-gcloud@v2 - - run: yarn install - - run: yarn build + - 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-${{ github.sha }} - name: Run health-metrics/modular-exports-binary-size test run: yarn modular-export-size-report # TODO(yifany): Enable startup times testing on CI. diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 590d59d2700..feefa755eb0 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -19,6 +19,7 @@ on: workflows: ["Build"] types: - completed + pull_request: env: # make chromedriver detect installed Chrome version and download the corresponding driver @@ -36,8 +37,8 @@ env: jobs: # Auth and Firestore are built and executed in their own jobs in an attempt to reduce flakiness. test-the-rest: - if: ${{ github.event.workflow_run.conclusion == 'success'}} name: (bulk) Node.js and Browser (Chrome) Tests + if: ${{ github.event.workflow_run.conclusion }} == 'success' runs-on: ubuntu-latest steps: # install Chrome first, so the correct version of webdriver can be installed by chromedriver when setting up the repo @@ -81,8 +82,8 @@ jobs: continue-on-error: true test-auth: - if: ${{ github.event.workflow_run.conclusion == 'success' }} name: (Auth) Node.js and Browser (Chrome) Tests + if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest steps: # install Chrome first, so the correct version of webdriver can be installed by chromedriver @@ -135,8 +136,8 @@ jobs: continue-on-error: true test-firestore: - if: ${{ github.event.workflow_run.conclusion == 'success'}} name: (Firestore) Node.js and Browser (Chrome) Tests + if: ${{ github.event.workflow_run.conclusion }} == 'success' runs-on: ubuntu-latest steps: # install Chrome so the correct version of webdriver can be installed by chromedriver when setting up the repo @@ -179,7 +180,7 @@ jobs: path-to-lcov: ./lcov-all.info continue-on-error: true test-firestore-integration: - if: ${{ github.event.workflow_run.conclusion == 'success'}} + if: ${{ github.event.workflow_run.conclusion }} == 'success' strategy: fail-fast: false matrix: