Repository navigation
254 lines (210 loc) · 7.44 KB
/
Copy pathrelease.yml
File metadata and controls
254 lines (210 loc) · 7.44 KB
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
---
name: Test, build and release
"on":
push:
tags: ["v*"]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
jobs:
test-linux:
name: Test Linux shell workflow
runs-on: ubuntu-latest
timeout-minutes: 20
env:
QT_QPA_PLATFORM: offscreen
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Install Qt runtime libraries
run: |
sudo apt-get update
sudo apt-get install --yes --no-install-recommends libegl1 libgl1
- name: Install uv and Python
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9
with:
version: "0.12.9"
python-version: "3.13"
enable-cache: true
cache-dependency-glob: uv.lock
- name: Install locked dependencies
run: uv sync --locked --group dev
- name: Verify generated Qt sources
run: bash scripts/sh/generate-qt.sh
- name: Run tests
run: bash scripts/sh/test.sh
- name: Run static checks
run: bash scripts/sh/lint.sh
build-linux:
name: Build Linux executables
needs: test-linux
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Install Qt runtime libraries
run: |
sudo apt-get update
sudo apt-get install --yes --no-install-recommends libegl1 libgl1
- name: Install uv and Python
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9
with:
version: "0.12.9"
python-version: "3.13"
enable-cache: true
cache-dependency-glob: uv.lock
- name: Verify release tag matches project version
if: startsWith(github.ref, 'refs/tags/')
run: |
version=$(uv version --short)
if [[ "v$version" != "$GITHUB_REF_NAME" ]]; then
printf 'Tag %s does not match pyproject version v%s\n' "$GITHUB_REF_NAME" "$version" >&2
exit 1
fi
- name: Build executables
run: bash scripts/sh/build.sh --skip-tests
- name: Smoke test packaged CLI
run: ./dist/easy_gcode_plot_cli --help
- name: Package Linux executables
run: |
version=$(uv version --short)
archive="Easy-G-Code-Plot-$version-Linux-x64.tar.gz"
test -x dist/easy_gcode_plot
test -x dist/easy_gcode_plot_cli
tar -C dist -czf "dist/$archive" easy_gcode_plot easy_gcode_plot_cli
(cd dist && sha256sum "$archive" > "$archive.sha256")
(cd dist && sha256sum -c "$archive.sha256")
tar -tzf "dist/$archive"
- name: Upload Linux artifact
uses: actions/upload-artifact@v7
with:
name: Easy-G-Code-Plot-Linux-x64
path: |
dist/Easy-G-Code-Plot-*-Linux-x64.tar.gz
dist/Easy-G-Code-Plot-*-Linux-x64.tar.gz.sha256
if-no-files-found: error
retention-days: 14
build:
name: Test and build Windows EXE
runs-on: windows-latest
timeout-minutes: 30
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Install uv and Python
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9
with:
version: "0.12.9"
python-version: "3.13"
enable-cache: true
cache-dependency-glob: uv.lock
- name: Install locked dependencies
shell: pwsh
run: uv sync --locked --group dev
- name: Verify generated Qt sources
shell: pwsh
run: ./scripts/ps1/generate-translations.ps1
- name: Run tests
shell: pwsh
run: ./scripts/ps1/test.ps1
- name: Run static checks
shell: pwsh
run: ./scripts/ps1/lint.ps1
- name: Verify release tag matches project version
if: startsWith(github.ref, 'refs/tags/')
shell: pwsh
run: |
$version = uv version --short
if ("v$version" -ne "${{ github.ref_name }}") {
throw (
"Tag ${{ github.ref_name }} does not match " +
"pyproject version v$version"
)
}
- name: Build executable
shell: pwsh
run: ./scripts/ps1/build.ps1 -SkipTests
- name: Smoke test packaged CLI
shell: pwsh
run: |
& dist/easy_gcode_plot_cli.exe --help
if ($LASTEXITCODE -ne 0) { throw "Packaged CLI failed to start." }
- name: Give executables versioned names
shell: pwsh
run: |
$version = uv version --short
$releaseExe = "dist/Easy-G-Code-Plot-$version-Windows-x64.exe"
$releaseCli = "dist/easy_gcode_plot_cli.exe"
Copy-Item dist/easy_gcode_plot.exe $releaseExe
@($releaseExe, $releaseCli) | ForEach-Object {
$hash = (Get-FileHash $_ -Algorithm SHA256).Hash.ToLower()
"$hash $(Split-Path $_ -Leaf)"
} | Set-Content dist/SHA256SUMS.txt -Encoding ascii
- name: Upload executable artifact
uses: actions/upload-artifact@v7
with:
name: Easy-G-Code-Plot-Windows-x64
path: |
dist/Easy-G-Code-Plot-*-Windows-x64.exe
dist/easy_gcode_plot_cli.exe
dist/SHA256SUMS.txt
if-no-files-found: error
retention-days: 14
release:
name: Publish GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
needs: [build, build-linux]
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Download executable artifact
uses: actions/download-artifact@v8
with:
name: Easy-G-Code-Plot-Windows-x64
path: dist
- name: Download Linux artifact
uses: actions/download-artifact@v8
with:
name: Easy-G-Code-Plot-Linux-x64
path: dist/linux
- name: Create release or replace its executables
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
$tag = "${{ github.ref_name }}"
$guiAsset = @(Get-ChildItem dist/Easy-G-Code-Plot-*-Windows-x64.exe -File -ErrorAction Stop)
if ($guiAsset.Count -ne 1) { throw "Expected exactly one GUI executable." }
$assets = @(
$guiAsset[0].FullName,
(Resolve-Path dist/easy_gcode_plot_cli.exe).Path
)
$checksum = (Resolve-Path dist/SHA256SUMS.txt).Path
$linuxAsset = @(
Get-ChildItem dist/linux/Easy-G-Code-Plot-*-Linux-x64.tar.gz `
-File -ErrorAction Stop
)
if ($linuxAsset.Count -ne 1) {
throw "Expected exactly one Linux archive."
}
$linuxChecksum = (
Resolve-Path "$($linuxAsset[0].FullName).sha256"
).Path
$assets += $linuxAsset[0].FullName
$assets += $checksum
$assets += $linuxChecksum
if (gh release view $tag 2>$null) {
gh release upload $tag @assets --clobber
} else {
gh release create $tag @assets `
--verify-tag `
--generate-notes `
--title "Easy G-Code Plot $tag"
}
gh release edit $tag --draft=false --latest