-
Notifications
You must be signed in to change notification settings - Fork 25
278 lines (244 loc) · 7.91 KB
/
built-tests.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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
name: Tests and build
on:
push:
branches:
- master
pull_request:
permissions: read-all
jobs:
build-ui:
name: Build Web UI
permissions:
contents: write
uses: ./.github/workflows/build-webui.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
release: ${{ github.event_name == 'push' }}
build-wasm:
name: Build Wasm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version: '1.23.2'
cache: true
check-latest: true
- name: Setup Binaryen
# fixme: use acifani/setup-tinygo after pr acceptance
uses: Zxilly/setup-tinygo@da87f9a9d5f7f1fcd8b6fcbd0af84d8789742c34 # main
with:
install-tinygo: false
binaryen-version: '119'
- name: Download deps
run: go mod download
- name: Build wasm
uses: ./.github/actions/setup-script
with:
script: 'wasm.py'
- name: Upload wasm artifact
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
path: 'ui/gsa.wasm'
name: wasm
tests:
name: Tests
needs:
- build-ui
permissions:
contents: write
checks: write
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-13, macos-14, self-hosted ]
test: [ unit, integration-example, integration-real ]
include:
- test: unit
test-type: unit
- test: integration-example
test-type: integration
- test: integration-real
test-type: integration
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version: '1.23.2'
cache: true
check-latest: true
- name: Setup Go global dependencies
run: |
go install github.com/jstemmer/go-junit-report/v2@85bf4716ac1f025f2925510a9f5e9f5bb347c009
go install github.com/Zxilly/go_js_wasm_exec@5505618db20faa92d284470ef5c8f0fda6b92bcb
- name: Download UI file
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: ui
path: internal/webui
- name: Download deps
run: go mod download
- name: Run ${{ matrix.test }} tests
uses: ./.github/actions/setup-script
with:
cache: ${{ matrix.test }}
script: 'tests.py --${{ matrix.test }}'
report: 'true'
coverage: 'true'
setup-python: ${{ matrix.os != 'self-hosted' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload coverage
uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7
if: ${{ !cancelled() && matrix.os != 'self-hosted' }}
with:
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ matrix.test-type }}.profile
flags: ${{ matrix.test-type }}
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() && matrix.test-type == 'unit' && matrix.os != 'self-hosted' }}
uses: codecov/test-results-action@9739113ad922ea0a9abb4b2c0f8bf6a4aa8ef820 # v1.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: ${{ matrix.os }} unit tests
flags: ${{ matrix.os }}-unit
files: unit.xml,unit_embed.xml,unit_wasm.xml
verbose: true
- name: Upload results
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: ${{ !cancelled() }}
with:
name: ${{ matrix.os }}-${{ matrix.test }}-results
path: results/
merge:
name: Merge Go test results
needs: tests
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-13, macos-14 ]
steps:
- name: Merge
uses: actions/upload-artifact/merge@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: ${{ matrix.os }}-results
compression-level: '9'
pattern: ${{ matrix.os }}-*-results
delete-merged: true
retention-days: 7
tests-result:
name: Tests result
needs: tests
runs-on: ubuntu-latest
steps:
- run: exit 1
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
|| contains(needs.*.result, 'skipped')
}}
tests-ui:
name: UI Tests
runs-on: ubuntu-latest
needs: build-wasm
permissions:
contents: write
checks: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Setup UI dependencies
uses: ./.github/actions/setup-ui-deps
- name: Install dependencies
working-directory: ./ui
run: pnpm install
- name: Download WASM
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: wasm
path: ui/
- name: Run tests
working-directory: ./ui
run: pnpm test
- name: Upload coverage
if: ${{ !cancelled() }}
uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: ui
name: Web UI tests
directory: ./ui
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@9739113ad922ea0a9abb4b2c0f8bf6a4aa8ef820 # v1.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: Web UI tests
flags: ui
files: ./ui/test-results.xml
verbose: true
build-explorer:
name: Build go-size-analyzer explorer
runs-on: ubuntu-latest
needs:
- build-wasm
- tests-ui
- tests
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Setup UI dependencies
uses: ./.github/actions/setup-ui-deps
- name: Download WASM
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: wasm
path: ui/
- name: Build
working-directory: ./ui
run: pnpm run build:explorer
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
PULL_REQUEST_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
GSA_TELEMETRY: true
- name: Upload pages artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
path: 'ui/dist/explorer/'
deploy:
name: Deploy explorer to GitHub Pages
if: ${{ github.event_name == 'push' }}
needs: build-explorer
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-pages-deploy
cancel-in-progress: true
permissions:
pages: write
id-token: write
runs-on: ubuntu-latest
steps:
- name: Setup Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5