Skip to content

Commit cbdf188

Browse files
authored
chore(ci): only install chrome when needed in unit test workflow (#5599)
* chore(ci): only install chrome when needed let fast failures fail faster * chore(ci): avoid rebuilding lwc when installing chromedriver * chore(ci): use setup-chrome@v2 * Apply suggestion from @wjhsf
1 parent 537a1ff commit cbdf188

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

.github/workflows/unit.yml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,22 @@ on:
1818

1919
env:
2020
PUPPETEER_SKIP_DOWNLOAD: 'true' # only needed for @best/runner-local, unused here
21+
CHROME_VERSION: 130
2122

2223
jobs:
2324
run-unit-tests:
2425
runs-on: ubuntu-22.04
2526
steps:
2627
- name: Checkout repository
2728
uses: actions/checkout@v4
28-
2929
- name: Setup Node
3030
uses: actions/setup-node@v4
3131
with:
3232
node-version: '20.19.4'
3333
cache: 'yarn'
34-
35-
# Needed for perf smoke tests, matches the chromedriver version installed by tachometer (https://github.com/google/tachometer/blob/main/README.md#on-demand-dependencies)
36-
# chrome-version documentation can be found here: https://github.com/browser-actions/setup-chrome?tab=readme-ov-file#usage
37-
- name: Setup chrome
38-
uses: browser-actions/setup-chrome@v1
39-
with:
40-
chrome-version: 130
41-
id: setup-chrome
42-
4334
- name: Install dependencies
4435
run: yarn install --frozen-lockfile
4536

46-
# Pin chromedriver to the same version as Chrome above, so Tachometer uses this version.
47-
# See: https://github.com/google/tachometer#on-demand-dependencies
48-
- name: Install chromedriver
49-
run: yarn add -W chromedriver@^130
50-
5137
- name: Check package.json integrity
5238
run: node ./scripts/tasks/check-and-rewrite-package-json.js --test
5339
- name: Check licenses are up to date
@@ -73,8 +59,26 @@ jobs:
7359
with:
7460
name: test-coverage-report
7561
path: coverage/
62+
63+
# Needed for perf smoke tests, matches the chromedriver version installed by tachometer (https://github.com/google/tachometer/blob/main/README.md#on-demand-dependencies)
64+
# chrome-version documentation can be found here: https://github.com/browser-actions/setup-chrome?tab=readme-ov-file#usage
65+
- name: Setup chrome
66+
uses: browser-actions/setup-chrome@v2
67+
with:
68+
chrome-version: ${{ env.CHROME_VERSION }}
69+
id: setup-chrome
70+
71+
# Pin chromedriver to the same version as Chrome above, so Tachometer uses this version.
72+
# See: https://github.com/google/tachometer#on-demand-dependencies
73+
- name: Install chromedriver
74+
run: yarn add -W chromedriver@^${{ env.CHROME_VERSION }} --ignore-scripts
75+
7676
- name: Run benchmark smoke tests
77-
run: CHROME_BINARY=${{ steps.setup-chrome.outputs.chrome-path }} BENCHMARK_SMOKE_TEST=1 yarn test:performance
77+
run: yarn test:performance
78+
env:
79+
BENCHMARK_SMOKE_TEST: 1
80+
CHROME_BINARY: ${{ steps.setup-chrome.outputs.chrome-path }}
81+
7882
- name: Add step summary
7983
# 1. Remove leading/trailing "border" lines from output
8084
# 2. Wrap file names in backticks

0 commit comments

Comments
 (0)