-
Notifications
You must be signed in to change notification settings - Fork 6
344 lines (288 loc) · 11 KB
/
test.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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
---
name: "Test"
on: # yamllint disable-line rule:truthy
push:
branches: [main]
tags: ["*"]
pull_request:
# The branches below must be a subset of the branches above
branches: [main]
schedule:
- cron: '43 16 * * 5'
env:
# How long to run the executable automated tests
TEST_DURATION_SECONDS: 60
# https://github.com/upx/upx/releases
UPX_VERSION: "4.2.4"
jobs:
precommit:
name: Pre-commit
runs-on: windows-latest
steps:
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python
# https://github.com/actions/setup-python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version-file: ".python-version"
- name: Enable cache for pre-commit hooks
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
pre-commit|${{ env.pythonLocation }}
pre-commit|
# Add Scripts directory to the path so that pipenv (and associated
# utilities) can be used once installed
- name: Add python Scripts directory to path
shell: cmd
# Code-page switch is needed to write the env file as utf-8
run: |
chcp 65001
python -c "import site; print(site.USER_SITE.replace('site-packages', 'Scripts'))" >> %GITHUB_PATH%
chcp 1252
- name: Install pre-commit
shell: cmd
run: python -m pip install pre-commit
- name: Install pre-commit hooks
shell: cmd
run: pre-commit install-hooks
- name: Run pre-commit checks
shell: cmd
run: pre-commit run -a
- name: Run pre-commit gc
shell: cmd
run: pre-commit gc
docs:
name: Documentation
runs-on: windows-latest
steps:
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install uv
# https://github.com/astral-sh/setup-uv
uses: astral-sh/setup-uv@4e3dbecc19008549e0deaff33911d7a8662627b2 # v5.2.0
- name: Set up Python
# https://github.com/actions/setup-python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version-file: ".python-version"
# Add Scripts directory to the path so that pipenv (and associated
# utilities) can be used once installed
- name: Add python Scripts directory to path
shell: cmd
# Code-page switch is needed to write the env file as utf-8
run: |
chcp 65001
python -c "import site; print(site.USER_SITE.replace('site-packages', 'Scripts'))" >> %GITHUB_PATH%
chcp 1252
- name: Build docs
shell: cmd
run: uv run --locked --only-group docs mkdocs build --verbose --strict
test:
name: Test
runs-on: windows-latest
steps:
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install uv
# https://github.com/astral-sh/setup-uv
uses: astral-sh/setup-uv@4e3dbecc19008549e0deaff33911d7a8662627b2 # v5.2.0
- name: Set up Python
# https://github.com/actions/setup-python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version-file: ".python-version"
# Add Scripts directory to the path so that pipenv (and associated
# utilities) can be used once installed
- name: Add python Scripts directory to path
shell: cmd
# Code-page switch is needed to write the env file as utf-8
run: |
chcp 65001
python -c "import site; print(site.USER_SITE.replace('site-packages', 'Scripts'))" >> %GITHUB_PATH%
chcp 1252
- name: Run tests
shell: cmd
run: uv run --locked --group dev pytest
sbom:
name: Software Bill of Materials
permissions:
actions: read
contents: write
runs-on: windows-latest
steps:
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Install uv
# https://github.com/astral-sh/setup-uv
uses: astral-sh/setup-uv@4e3dbecc19008549e0deaff33911d7a8662627b2 # v5.2.0
- name: Set up Python
# https://github.com/actions/setup-python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version-file: ".python-version"
# Add Scripts directory to the path so that pipenv (and associated
# utilities) can be used once installed
- name: Add python Scripts directory to path
shell: cmd
# Code-page switch is needed to write the env file as utf-8
run: |
chcp 65001
python -c "import site; print(site.USER_SITE.replace('site-packages', 'Scripts'))" >> %GITHUB_PATH%
chcp 1252
- name: Generate requirements.txt
shell: cmd
run: uv export --locked --format requirements-txt > requirements.txt
- name: Generate & upload SBOM
# https://github.com/anchore/sbom-action
uses: anchore/sbom-action@df80a981bc6edbc4e220a492d3cbe9f5547a6e75 # v0.17.9
with:
artifact-name: sbom-spdx.json
dependency-snapshot: true
file: requirements.txt
format: spdx-json
# This action is currently disabled because it breaks PRs that aren't
# introducing new vulnerabilities
# - name: Check for security vulnerabilities
# # https://github.com/pypa/gh-action-pip-audit/
# uses: pypa/gh-action-pip-audit@1220774d901786e6f652ae159f7b6bc8fea6d266 # v1.1.0
# with:
# inputs: requirements.txt
# require-hashes: true
# summary: true
build:
name: Build
runs-on: windows-latest
steps:
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Install uv
# https://github.com/astral-sh/setup-uv
uses: astral-sh/setup-uv@4e3dbecc19008549e0deaff33911d7a8662627b2 # v5.2.0
- name: Set up Python
# https://github.com/actions/setup-python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version-file: ".python-version"
# Add Scripts directory to the path so that pipenv (and associated
# utilities) can be used once installed
- name: Add python Scripts directory to path
shell: cmd
# Code-page switch is needed to write the env file as utf-8
run: |
chcp 65001
python -c "import site; print(site.USER_SITE.replace('site-packages', 'Scripts'))" >> %GITHUB_PATH%
chcp 1252
- name: Install UPX
shell: cmd
run: choco install -y upx --version ${{ env.UPX_VERSION }}
- name: Build executable
shell: cmd
env:
IPINFO_TOKEN: ${{ secrets.IPINFO_TOKEN }}
SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
run: uv run --locked --no-dev python build.py
- name: Save executable as artifact
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: wahoo-results.exe
path: wahoo-results.exe
if-no-files-found: error
autotest:
name: Autotest
needs: [build]
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Load executable artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: wahoo-results.exe
- name: Ensure config file does not exist
shell: bash
run: |
[[ ! -e wahoo-results.ini ]]
- name: Run autotest (no config file)
timeout-minutes: 3
shell: cmd
run: wahoo-results.exe --loglevel=debug --test scripted:${{ env.TEST_DURATION_SECONDS }}
- name: Ensure config file exists
shell: bash
run: |
[[ -e wahoo-results.ini ]]
- name: Run autotest (with config file)
timeout-minutes: 3
shell: cmd
run: wahoo-results.exe --loglevel=debug --test scripted:${{ env.TEST_DURATION_SECONDS }}
success:
name: Successful CI
needs: [autotest, docs, precommit, sbom, test]
runs-on: windows-latest
steps:
- name: Success
shell: cmd
run: echo "CI was successful"
release:
name: Publish release
if: startsWith(github.ref, 'refs/tags/v')
needs: [success]
runs-on: windows-latest
permissions:
contents: write
discussions: write
steps:
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version-file: ".python-version"
# Add Scripts directory to the path so that utilities can be used once installed
- name: Add python Scripts directory to path
shell: cmd
# Code-page switch is needed to write the env file as utf-8
run: |
chcp 65001
python -c "import site; print(site.USER_SITE.replace('site-packages', 'Scripts'))" >> %GITHUB_PATH%
chcp 1252
- name: Install sentry-cli
shell: cmd
run: python -m pip install --user sentry-cli
- name: Download executable as artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: wahoo-results.exe
- name: Create sentry release
shell: cmd
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: wahoo-results
SENTRY_PROJECT: wahoo-results
run: |
sentry-cli releases new --finalize wahoo-results@${{ github.ref_name }}
sentry-cli releases set-commits wahoo-results@${{ github.ref_name }} --commit JohnStrunk/wahoo-results@${{ github.ref_name }}
- name: Publish release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
with:
name: Release ${{ github.ref_name }}
draft: true
files: |
wahoo-results.exe