Skip to content

Commit cc58f7d

Browse files
committed
new build workflow and add .nvmrc
1 parent caf3090 commit cc58f7d

26 files changed

+146
-76
lines changed

.github/workflows/build.yaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Build
16+
17+
on: push
18+
19+
env:
20+
# make chromedriver detect installed Chrome version and download the corresponding driver
21+
DETECT_CHROMEDRIVER_VERSION: true
22+
# The default behavior of chromedriver uses the older Chrome download URLs. We need to override
23+
# the behavior to use the new URLs.
24+
CHROMEDRIVER_CDNURL: https://googlechromelabs.github.io/
25+
CHROMEDRIVER_CDNBINARIESURL: https://storage.googleapis.com/chrome-for-testing-public
26+
CHROME_VALIDATED_VERSION: linux-120.0.6099.71
27+
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."
28+
artifactRetentionDays: 14
29+
# Bump Node memory limit
30+
NODE_OPTIONS: "--max_old_space_size=4096"
31+
32+
jobs:
33+
build:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
- uses: actions/setup-node@v4
38+
with:
39+
node-version-file: '.nvmrc'
40+
cache: yarn
41+
cache-dependency-path: yarn.lock
42+
- name: Restore cached node_modules
43+
uses: actions/cache@v4
44+
id: node_modules
45+
with:
46+
path: "**/node_modules"
47+
key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
48+
- run: yarn install --frozen-lockfile
49+
- name: install Chrome stable
50+
run: |
51+
npx @puppeteer/browsers install chrome@stable
52+
- name: Test setup and yarn install
53+
run: |
54+
cp config/ci.config.json config/project.json
55+
yarn
56+
- name: yarn build
57+
run: yarn build
58+
- name: Archive build
59+
if: ${{ !cancelled() }}
60+
run: |
61+
tar -cf build.tar --exclude=.git .
62+
gzip build.tar
63+
- name: Upload build archive
64+
if: ${{ !cancelled() }}
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: build.tar.gz
68+
path: build.tar.gz
69+
retention-days: ${{ env.artifactRetentionDays }}

.github/workflows/canary-deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ jobs:
3232
# Canary release script requires git history and tags.
3333
fetch-depth: 0
3434
- name: Set up Node (20)
35-
uses: actions/setup-node@v3
35+
uses: actions/setup-node@v4
3636
with:
37-
node-version: 22.10.0
37+
node-version-file: '.nvmrc'
3838
- name: Yarn install
3939
run: yarn
4040
- name: Deploy canary

.github/workflows/check-changeset.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ jobs:
3535
# This makes Actions fetch all Git history so check_changeset script can diff properly.
3636
fetch-depth: 0
3737
- name: Set up Node (20)
38-
uses: actions/setup-node@v3
38+
uses: actions/setup-node@v4
3939
with:
40-
node-version: 22.10.0
40+
node-version-file: '.nvmrc'
4141
- name: Yarn install
4242
run: yarn
4343
- name: Run changeset script

.github/workflows/check-docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ jobs:
2828
# get all history for the diff
2929
fetch-depth: 0
3030
- name: Set up Node (20)
31-
uses: actions/setup-node@v3
31+
uses: actions/setup-node@v4
3232
with:
33-
node-version: 22.10.0
33+
node-version-file: '.nvmrc'
3434
- name: Yarn install
3535
run: yarn
3636
- name: Run doc generation

.github/workflows/check-pkg-paths.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ jobs:
2828
# This makes Actions fetch all Git history so run-changed script can diff properly.
2929
fetch-depth: 0
3030
- name: Set up Node (20)
31-
uses: actions/setup-node@v3
31+
uses: actions/setup-node@v4
3232
with:
33-
node-version: 22.10.0
33+
node-version-file: '.nvmrc'
3434
- name: Yarn install
3535
run: yarn
3636
- name: Yarn build

.github/workflows/deploy-config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ jobs:
3636
# This makes Actions fetch all Git history so run-changed script can diff properly.
3737
fetch-depth: 0
3838
- name: Set up node (20)
39-
uses: actions/setup-node@v3
39+
uses: actions/setup-node@v4
4040
with:
41-
node-version: 22.10.0
41+
node-version-file: '.nvmrc'
4242
- name: Yarn install
4343
run: yarn
4444
- name: Deploy project config if needed

.github/workflows/e2e-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- name: Set up Node (20)
4040
uses: actions/setup-node@master
4141
with:
42-
node-version: 22.10.0
42+
node-version-file: '.nvmrc'
4343
- name: install Chrome stable
4444
run: |
4545
sudo apt-get update

.github/workflows/format.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ jobs:
3232
# get all history for the diff
3333
fetch-depth: 0
3434
- name: Set up node (20)
35-
uses: actions/setup-node@v3
35+
uses: actions/setup-node@v4
3636
with:
37-
node-version: 22.10.0
37+
node-version-file: '.nvmrc'
3838
- name: Yarn install
3939
run: yarn
4040
- name: Run formatting script

.github/workflows/health-metrics-pull-request.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ jobs:
3939
runs-on: ubuntu-latest
4040
steps:
4141
- uses: actions/checkout@v3
42-
- uses: actions/setup-node@v3
42+
- uses: actions/setup-node@v4
4343
with:
44-
node-version: 22.10.0
44+
node-version-file: '.nvmrc'
4545
- uses: 'google-github-actions/auth@v0'
4646
with:
4747
credentials_json: '${{ secrets.GCP_SA_KEY }}'
@@ -56,9 +56,9 @@ jobs:
5656
runs-on: ubuntu-latest
5757
steps:
5858
- uses: actions/checkout@v3
59-
- uses: actions/setup-node@v3
59+
- uses: actions/setup-node@v4
6060
with:
61-
node-version: 22.10.0
61+
node-version-file: '.nvmrc'
6262
- uses: 'google-github-actions/auth@v0'
6363
with:
6464
credentials_json: '${{ secrets.GCP_SA_KEY }}'

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ jobs:
2424
steps:
2525
- uses: actions/checkout@v3
2626
- name: Set up node (20)
27-
uses: actions/setup-node@v3
27+
uses: actions/setup-node@v4
2828
with:
29-
node-version: 22.10.0
29+
node-version-file: '.nvmrc'
3030
- name: yarn install
3131
run: yarn
3232
- name: yarn lint

0 commit comments

Comments
 (0)