Skip to content

Commit

Permalink
Cache dependencies and archive builds in all workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
dlarocque committed Nov 6, 2024
1 parent e3e2078 commit a50ccc7
Show file tree
Hide file tree
Showing 26 changed files with 550 additions and 300 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/canary-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/check-changeset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/check-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 12 additions & 7 deletions .github/workflows/check-pkg-paths.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/deploy-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
26 changes: 20 additions & 6 deletions .github/workflows/health-metrics-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 11 additions & 5 deletions .github/workflows/prerelease-manual-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/release-log.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ 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:
# Release script requires git history and tags.
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
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/release-tweet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading

0 comments on commit a50ccc7

Please sign in to comment.