forked from GoogleChrome/lighthouse
-
Notifications
You must be signed in to change notification settings - Fork 0
229 lines (188 loc) · 7 KB
/
ci.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
name: 💡🏠
on:
push:
branches: [master]
pull_request: # run on all PRs, not just PRs to a particular branch
jobs:
# `basics` includes all non-smoke CI, except for unit and proto
basics:
runs-on: ubuntu-latest
# A few steps are duplicated across all jobs. Can be done better when this feature lands:
# https://github.community/t/reusing-sharing-inheriting-steps-between-jobs-declarations/16851
# https://github.com/actions/runner/issues/438
steps:
- name: git clone
uses: actions/checkout@v2
with:
fetch-depth: 100
- run: bash lighthouse-core/scripts/github-actions-commit-range.sh
env:
GITHUB_CONTEXT_PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
GITHUB_CONTEXT_BASE_SHA: ${{ github.event.before }}
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- run: yarn --frozen-lockfile
- run: yarn build-all
# Run tests that require headfull Chrome.
- run: sudo apt-get install xvfb
- name: yarn test-clients
run: xvfb-run --auto-servernum yarn test-clients
- name: yarn test-docs
run: xvfb-run --auto-servernum yarn test-docs
- name: yarn test-viewer
run: xvfb-run --auto-servernum yarn test-viewer
- name: yarn test-treemap
run: xvfb-run --auto-servernum yarn test-treemap
- run: yarn diff:sample-json
- run: yarn type-check
- run: yarn lint
- run: yarn test-lantern
- run: yarn test-legacy-javascript
- run: yarn i18n:checks
- run: yarn dogfood-lhci
# Fail if any changes were written to any source files or generated untracked files (ex, from: build/build-cdt-lib.js).
- run: git add -A && git diff --cached --exit-code
# buildtracker needs history and a common merge commit.
- name: Fixup git history (for buildtracker)
run: bash $GITHUB_WORKSPACE/.github/scripts/git-get-shared-history.sh
env:
# https://buildtracker.dev/docs/guides/github-actions#configuration
BT_API_AUTH_TOKEN: ${{ secrets.BT_API_AUTH_TOKEN }}
- name: Store in buildtracker
# TODO(paulirish): Don't allow this to fail the build. https://github.com/paularmstrong/build-tracker/issues/200
run: yarn bt-cli upload-build || true
env:
# https://buildtracker.dev/docs/guides/github-actions#configuration
BT_API_AUTH_TOKEN: ${{ secrets.BT_API_AUTH_TOKEN }}
- name: Upload dist
uses: actions/upload-artifact@v1
with:
name: dist
path: dist/
# `unit` includes just unit and proto tests.
unit:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
name: unit_${{ matrix.os }}
steps:
- name: git clone
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Set up protoc
uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3
with:
version: '3.7.1'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 2.7
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install protobuf==3.7.1
- run: yarn --frozen-lockfile
- run: yarn test-proto # Run before unit-core because the roundtrip json is needed for proto tests.
- run: sudo apt-get install xvfb
if: matrix.os == 'ubuntu-latest'
- name: yarn unit
run: xvfb-run --auto-servernum yarn unit:cicoverage
if: matrix.os == 'ubuntu-latest'
- name: Upload test coverage to Codecov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@6004246f47ab62d32be025ce173b241cd84ac58e
with:
flags: unit
file: ./unit-coverage.lcov
# For windows, just test the potentially platform-specific code.
- name: yarn unit-cli
run: yarn unit-cli
if: matrix.os == 'windows-latest'
- run: yarn diff:sample-json
if: matrix.os == 'windows-latest'
# 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
# `smoke` runs as a matrix across 4 jobs:
# * The smoketest groups are split across two runners, to parallelize.
# * Then, those are run with both Chrome stable and ToT Chromium, in parallel
smoke:
strategy:
matrix:
chrome-channel: ['stable', 'ToT']
smoke-test-invert: [false, true]
# e.g. if smoke 0 fails, continue with smoke 1 anyway
fail-fast: false
runs-on: ubuntu-latest
env:
# The smokehouse tests run by job `smoke_0`. `smoke_1` will run the rest.
SMOKE_GROUP_1: a11y oopif pwa pwa2 pwa3 dbw redirects errors offline
name: smoke_${{ strategy.job-index }}_${{ matrix.chrome-channel }}
steps:
- name: git clone
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Define ToT chrome path
if: matrix.chrome-channel == 'ToT'
run: echo "CHROME_PATH=/home/runner/chrome-linux-tot/chrome" >> $GITHUB_ENV
# Chrome Stable is already installed by default.
- name: Install Chrome ToT
if: matrix.chrome-channel == 'ToT'
working-directory: /home/runner
run: bash $GITHUB_WORKSPACE/lighthouse-core/scripts/download-chrome.sh && mv chrome-linux chrome-linux-tot
- run: yarn --frozen-lockfile
- run: sudo apt-get install xvfb
- name: Run smoke tests
run: xvfb-run --auto-servernum yarn smoke:cicoverage --debug -j=1 --retries=2 --invert-match ${{ matrix.smoke-test-invert }} $SMOKE_GROUP_1
- name: Upload test coverage to Codecov
if: matrix.chrome-channel == 'ToT'
uses: codecov/codecov-action@6004246f47ab62d32be025ce173b241cd84ac58e
with:
flags: smoke
file: ./smoke-coverage.lcov
# Fail if any changes were written to source files.
- run: git diff --exit-code
# Only run smoke tests for windows against stable chrome.
smoke-windows:
runs-on: windows-latest
name: smoke_stable_windows
steps:
- name: git clone
uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- run: yarn --frozen-lockfile
- name: Run smoke tests
run: yarn smoke --debug -j=1 --retries=2 dbw oopif offline lantern metrics
smoke-bundle:
runs-on: ubuntu-latest
name: smoke_bundle
steps:
- name: git clone
uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- run: yarn --frozen-lockfile
- run: yarn build-devtools
- run: sudo apt-get install xvfb
- name: yarn test-bundle
run: xvfb-run --auto-servernum yarn test-bundle
# Fail if any changes were written to source files.
- run: git diff --exit-code