Skip to content

Commit

Permalink
new build workflow and add .nvmrc
Browse files Browse the repository at this point in the history
  • Loading branch information
dlarocque committed Oct 31, 2024
1 parent caf3090 commit cc58f7d
Show file tree
Hide file tree
Showing 26 changed files with 146 additions and 76 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Copyright 2024 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: Build

on: push

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
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."
artifactRetentionDays: 14
# Bump Node memory limit
NODE_OPTIONS: "--max_old_space_size=4096"

jobs:
build:
runs-on: ubuntu-latest
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: install Chrome stable
run: |
npx @puppeteer/browsers install chrome@stable
- name: Test setup and yarn install
run: |
cp config/ci.config.json config/project.json
yarn
- name: yarn build
run: yarn build
- name: Archive build
if: ${{ !cancelled() }}
run: |
tar -cf build.tar --exclude=.git .
gzip build.tar
- name: Upload build archive
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: build.tar.gz
path: build.tar.gz
retention-days: ${{ env.artifactRetentionDays }}
4 changes: 2 additions & 2 deletions .github/workflows/canary-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ jobs:
# 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
node-version-file: '.nvmrc'
- name: Yarn install
run: yarn
- name: Deploy canary
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-changeset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ jobs:
# 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
node-version-file: '.nvmrc'
- name: Yarn install
run: yarn
- name: Run changeset script
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
# 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
node-version-file: '.nvmrc'
- name: Yarn install
run: yarn
- name: Run doc generation
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-pkg-paths.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,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: Yarn install
run: yarn
- name: Yarn build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,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: Yarn install
run: yarn
- name: Deploy project config if needed
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Set up Node (20)
uses: actions/setup-node@master
with:
node-version: 22.10.0
node-version-file: '.nvmrc'
- name: install Chrome stable
run: |
sudo apt-get update
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ jobs:
# 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
node-version-file: '.nvmrc'
- name: Yarn install
run: yarn
- name: Run formatting script
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/health-metrics-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ 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 }}'
Expand All @@ -56,9 +56,9 @@ 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 }}'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ 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
node-version-file: '.nvmrc'
- name: yarn install
run: yarn
- name: yarn lint
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prerelease-manual-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ jobs:
# 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
node-version-file: '.nvmrc'
- name: Yarn install
run: yarn
- name: Deploy prerelease
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-log.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Setup Node.js 20.x
uses: actions/setup-node@master
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
2 changes: 1 addition & 1 deletion .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Setup Node.js 20.x
uses: actions/setup-node@master
with:
node-version: 22.10.0
node-version-file: '.nvmrc'

- name: Install Dependencies
run: yarn
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ jobs:

steps:
- 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: Checkout release branch (with history)
uses: actions/checkout@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ jobs:
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
uses: actions/setup-node@v4
with:
node-version: 22.10.0
node-version-file: '.nvmrc'
- name: Merge main into release
uses: actions/github-script@v6
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-tweet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Setup Node.js 20.x
uses: actions/setup-node@master
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
20 changes: 10 additions & 10 deletions .github/workflows/test-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ jobs:
npx @puppeteer/browsers install chrome@stable
- 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
node-version-file: '.nvmrc'
- name: Test setup and yarn install
run: |
cp config/ci.config.json config/project.json
Expand Down Expand Up @@ -80,9 +80,9 @@ jobs:
- name: Unzip build artifact
run: tar xf build.tar.gz
- name: Set up Node (20)
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 22.10.0
node-version-file: '.nvmrc'
- name: Test setup and yarn install
run: |
cp config/ci.config.json config/project.json
Expand Down Expand Up @@ -131,9 +131,9 @@ jobs:
- name: Unzip build artifact
run: tar xf build.tar.gz
- name: Set up Node (20)
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 22.10.0
node-version-file: '.nvmrc'
- name: Test setup and yarn install
run: |
cp config/ci.config.json config/project.json
Expand Down Expand Up @@ -171,9 +171,9 @@ jobs:
- name: Unzip build artifact
run: tar xf build.tar.gz
- name: Set up Node (20)
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 22.10.0
node-version-file: '.nvmrc'
- name: Test setup and yarn install
run: |
cp config/ci.config.json config/project.json
Expand Down Expand Up @@ -215,9 +215,9 @@ jobs:
- name: Unzip build artifact
run: tar xf build.tar.gz
- name: Set up Node (20)
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 22.10.0
node-version-file: '.nvmrc'
- run: cp config/ci.config.json config/project.json
- run: yarn
- run: yarn build:${{ matrix.persistence }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test-changed-auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,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
Expand Down Expand Up @@ -89,9 +89,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
Expand All @@ -113,9 +113,9 @@ jobs:
with:
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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-changed-fcm-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-changed-firestore-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ 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
Expand Down
Loading

0 comments on commit cc58f7d

Please sign in to comment.