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 }}
0 commit comments