forked from GoogleChrome/lighthouse
-
Notifications
You must be signed in to change notification settings - Fork 0
179 lines (152 loc) · 5.88 KB
/
devtools.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
name: DevTools
on:
push:
branches: [main]
pull_request: # run on all PRs, not just PRs to a particular branch
env:
DEPOT_TOOLS_PATH: ${{ github.workspace }}/depot-tools
DEVTOOLS_PATH: ${{ github.workspace }}/devtools-frontend
PUPPETEER_SKIP_DOWNLOAD: 1
jobs:
build:
runs-on: ubuntu-latest
env:
FORCE_COLOR: true
steps:
- name: Set $PATH
run: echo "$DEPOT_TOOLS_PATH" >> $GITHUB_PATH
- name: git clone
uses: actions/checkout@v2
with:
path: lighthouse
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Generate cache hash
run: bash $GITHUB_WORKSPACE/lighthouse/.github/scripts/generate-devtools-hash.sh > cdt-test-hash.txt
- name: Set week of the year
run: echo "WEEK_OF_THE_YEAR=$(date +%V)" >> $GITHUB_ENV
# Caches are invalidated at least once a week, so that's the max time between testing
# with the latest dependencies. Any commit to the DevTools repo touching Lighthouse
# code will invalidate the cache sooner.
- name: Cache depot tools and devtools
id: devtools-cache
uses: actions/cache@v3
with:
path: |
${{ env.DEPOT_TOOLS_PATH }}
${{ env.DEVTOOLS_PATH }}
${{ github.workspace }}/.gclient
${{ github.workspace }}/.gclient_entries
# This hash key changes:
# 1) every monday (so invalidates once a week)
# 2) every commit to CDT touching files important to Lighthouse web tests
# 3) every change to file in Lighthouse repo important to running these tests.
#
# The number is how many times this hash key was manually updated to break the cache.
key: ${{ runner.os }}-11-${{ env.WEEK_OF_THE_YEAR }}-${{ hashFiles('cdt-test-hash.txt') }}
restore-keys: ${{ runner.os }}-11
- name: Set GHA_DEVTOOLS_CACHE_HIT
if: steps.devtools-cache.outputs.cache-hit == 'true'
run: echo "GHA_DEVTOOLS_CACHE_HIT=1" >> $GITHUB_ENV
- run: yarn --frozen-lockfile --network-timeout 1000000
working-directory: ${{ github.workspace }}/lighthouse
- name: Download depot tools
run: bash $GITHUB_WORKSPACE/lighthouse/core/test/devtools-tests/download-depot-tools.sh
- name: Download DevTools Frontend
run: bash $GITHUB_WORKSPACE/lighthouse/core/test/devtools-tests/download-devtools.sh
- name: Roll Lighthouse + build DevTools
run: bash $GITHUB_WORKSPACE/lighthouse/core/test/devtools-tests/roll-devtools.sh
- name: Cache build artifacts
id: devtools-build-artifacts
uses: actions/cache@v3
with:
path: |
${{ env.DEVTOOLS_PATH }}
${{ github.workspace }}/.gclient
${{ github.workspace }}/.gclient_entries
key: devtools-build-artifacts-${{ github.run_id }}
e2e:
needs: [build]
runs-on: ubuntu-latest
env:
FORCE_COLOR: true
steps:
- name: git clone
uses: actions/checkout@v2
with:
path: lighthouse
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- run: yarn --frozen-lockfile --network-timeout 1000000
working-directory: ${{ github.workspace }}/lighthouse
- name: Set $PATH
run: echo "$DEPOT_TOOLS_PATH" >> $GITHUB_PATH
# For vpython.
- name: Download depot tools
run: bash $GITHUB_WORKSPACE/lighthouse/core/test/devtools-tests/download-depot-tools.sh
- name: Load build artifacts
id: devtools-build-artifacts
uses: actions/cache@v3
with:
path: |
${{ env.DEVTOOLS_PATH }}
${{ github.workspace }}/.gclient
${{ github.workspace }}/.gclient_entries
key: devtools-build-artifacts-${{ github.run_id }}
- name: Run e2e tests
run: bash $GITHUB_WORKSPACE/lighthouse/core/test/devtools-tests/run-e2e-tests.sh
smoke:
needs: [build]
strategy:
matrix:
smoke-test-shard: [1, 2, 3]
# e.g. if set 1 fails, continue with set 2 anyway
fail-fast: false
runs-on: ubuntu-latest
env:
FORCE_COLOR: true
name: DevTools smoke ${{ matrix.smoke-test-shard }}/${{ strategy.job-total }}
steps:
- name: git clone
uses: actions/checkout@v2
with:
path: lighthouse
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Load build artifacts
id: devtools-build-artifacts
uses: actions/cache@v3
with:
path: |
${{ env.DEVTOOLS_PATH }}
${{ github.workspace }}/.gclient
${{ github.workspace }}/.gclient_entries
key: devtools-build-artifacts-${{ github.run_id }}
- run: yarn --frozen-lockfile --network-timeout 1000000
working-directory: ${{ github.workspace }}/lighthouse
# This is only done because the import of `parseChromeFlags` in pptr-run-devtool.js triggers imports that eventually
# fail because of how report-assets.js reads generated files.
- run: yarn build-report
working-directory: ${{ github.workspace }}/lighthouse
- 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 }}/lighthouse/core/scripts/download-chrome.sh && mv chrome-linux chrome-linux-tot
- run: mkdir latest-run
working-directory: ${{ github.workspace }}/lighthouse
- name: yarn smoke --runner devtools
run: xvfb-run --auto-servernum yarn smoke --runner devtools --shard=${{ matrix.smoke-test-shard }}/${{ strategy.job-total }} --jobs=3 --retries=2
working-directory: ${{ github.workspace }}/lighthouse
- name: Upload failures
if: failure()
uses: actions/upload-artifact@v1
with:
name: Smokehouse (devtools smoke)
path: ${{ github.workspace }}/lighthouse/.tmp/smokehouse-failures/