forked from GoogleChrome/lighthouse
-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (88 loc) · 3.2 KB
/
unit.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: unit
on:
push:
branches: [main]
pull_request: # run on all PRs, not just PRs to a particular branch
env:
PUPPETEER_SKIP_DOWNLOAD: 1
jobs:
# `unit` includes just unit and proto tests.
unit:
strategy:
matrix:
node: ['16', '18']
fail-fast: false
runs-on: ubuntu-latest
name: node ${{ matrix.node }}
env:
LATEST_NODE: '18'
FORCE_COLOR: true
steps:
- name: git clone
uses: actions/checkout@v2
with:
# Depth of at least 2 for codecov coverage diffs. See https://github.com/GoogleChrome/lighthouse/pull/12079
fetch-depth: 2
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Set up protoc
uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3
with:
version: '3.20'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3
- name: Install Python dependencies
run: |
python3 -m pip install --upgrade pip
pip install protobuf==3.20
- run: yarn install --frozen-lockfile --network-timeout 1000000
- run: yarn build-report
- run: yarn reset-link
# Run pptr tests using ToT Chrome instead of stable default.
- name: Define ToT chrome path
run: echo "CHROME_PATH=/home/runner/chrome-linux-tot/chrome" >> $GITHUB_ENV
- name: Install Chrome ToT
working-directory: /home/runner
run: bash $GITHUB_WORKSPACE/core/scripts/download-chrome.sh && mv chrome-linux chrome-linux-tot
- run: yarn test-proto # Run before unit-core because the roundtrip json is needed for proto tests.
- run: sudo apt-get install xvfb
- name: yarn unit
if: ${{ matrix.node != env.LATEST_NODE }}
run: xvfb-run --auto-servernum yarn unit:ci
# Only gather coverage on latest node, where c8 is the most accurate.
- name: yarn unit:cicoverage
if: ${{ matrix.node == env.LATEST_NODE }}
run: |
xvfb-run --auto-servernum yarn unit:cicoverage
yarn c8 report --reporter text-lcov > unit-coverage.lcov
- name: Upload test coverage to Codecov
if: ${{ matrix.node == env.LATEST_NODE }}
uses: codecov/codecov-action@6004246f47ab62d32be025ce173b241cd84ac58e
with:
flags: unit
file: ./unit-coverage.lcov
# Runs here because it needs the roundtrip proto.
- name: yarn test-viewer
run: yarn build-viewer && xvfb-run --auto-servernum bash $GITHUB_WORKSPACE/.github/scripts/test-retry.sh yarn test-viewer
# For windows, just test the potentially platform-specific code.
unit-windows:
runs-on: windows-latest
name: Windows unit
steps:
- name: git clone
uses: actions/checkout@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- run: yarn install --frozen-lockfile --network-timeout 1000000
- run: yarn build-report
- run: yarn unit-cli
- run: yarn diff:sample-json
# Fail if any changes were written to any source files or generated untracked files (ex, from -GA).
- run: git add -A && git diff --cached --exit-code