Repository navigation
429 lines (376 loc) · 15.4 KB
/
Copy pathbuild-artifacts.yml
File metadata and controls
429 lines (376 loc) · 15.4 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
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
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
name: Build Artifacts
on:
# Branch pushes only; a tag push is a release and has its own workflow.
push:
branches:
- "**"
workflow_dispatch:
env:
# The Qt every job installs; bump it here and in the other workflows.
QT_VERSION: 6.12.0
jobs:
build:
name: Build (${{ matrix.name }})
runs-on: ${{ matrix.runner }}
continue-on-error: ${{ matrix.experimental == true }}
strategy:
fail-fast: false
matrix:
include:
- name: windows-x86_64
runner: windows-latest
target: x86_64-pc-windows-msvc
qt_host: windows
qt_arch: win64_msvc2022_64
artifact_name: blockwork-windows-x86_64.zip
installer_arch: x64compatible
experimental: false
- name: windows-arm64
runner: windows-11-arm
target: aarch64-pc-windows-msvc
artifact_name: blockwork-windows-arm64.zip
installer_arch: arm64
qt_host: windows_arm64
qt_arch: win64_msvc2022_arm64
experimental: true
- name: macos-arm64
runner: macos-latest
target: aarch64-apple-darwin
artifact_name: blockwork-macos-arm64
qt_host: mac
qt_arch: clang_64
experimental: false
- name: macos-x86_64
runner: macos-15-intel
target: x86_64-apple-darwin
artifact_name: blockwork-macos-x86_64
qt_host: mac
qt_arch: clang_64
experimental: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout Blockstitch QML module
shell: bash
run: |
scripts/fetch-blockstitch.sh ../blockstitch
# Official Qt builds where CXX-Qt's Qt download is missing or broken.
- name: Set up Python
if: matrix.qt_arch
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install Qt
if: matrix.qt_arch
shell: bash
run: |
python -m pip install py7zr==1.1.3 "aqtinstall @ git+https://github.com/miurahr/aqtinstall.git@076e1659807d0b362a3ed684d54c2e9c775eb9c7"
# A Qt mirror sometimes serves a broken archive, so try a few times.
for attempt in 1 2 3; do
rm -rf "$RUNNER_TEMP/Qt"
python -m aqt install-qt ${{ matrix.qt_host }} desktop ${{ env.QT_VERSION }} ${{ matrix.qt_arch }} --outputdir "$RUNNER_TEMP/Qt" && break
if [ "$attempt" = 3 ]; then exit 1; fi
echo "::warning::Qt install failed (attempt $attempt), retrying"
sleep 15
done
qmake=$(find "$RUNNER_TEMP/Qt/${{ env.QT_VERSION }}" -maxdepth 3 -path '*/bin/*' \( -name qmake -o -name qmake.exe \) | head -n 1)
test -n "$qmake"
if [[ "$RUNNER_OS" == Windows ]]; then qmake=$(cygpath -w "$qmake"); fi
echo "QMAKE=$qmake" >> "$GITHUB_ENV"
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build (release, Windows)
if: runner.os == 'Windows'
env:
# Allow transient registry DNS failures to recover before failing the build.
CARGO_NET_RETRY: '10'
run: cargo build --release --target ${{ matrix.target }} --workspace --exclude blockwork-linux-bridge
- name: Stage Qt application (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
./scripts/deploy-qt-windows.ps1 -Target ${{ matrix.target }}
./scripts/package-portable-windows.ps1 -Target ${{ matrix.target }} -Output "${{ matrix.artifact_name }}"
- name: Upload artifact
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_name }}
if-no-files-found: error
retention-days: 14
- name: Locate or install Inno Setup
if: runner.os == 'Windows'
shell: pwsh
run: |
$iscc = "C:\Program Files (x86)\Inno Setup 6\ISCC.exe"
if (-not (Test-Path $iscc)) {
choco install innosetup -y
}
- name: Build installer (Inno Setup)
if: runner.os == 'Windows'
shell: pwsh
run: |
$iscc = "C:\Program Files (x86)\Inno Setup 6\ISCC.exe"
$version = "${{ github.sha }}".Substring(0, 7)
& $iscc "/DMyAppVersion=$version-dev" "/DTargetTriple=${{ matrix.target }}" "/DInstallerArch=${{ matrix.installer_arch }}" "/DOutputBaseFilename=blockwork-${{ matrix.name }}-setup" installer\blockwork.iss
- name: Upload installer artifact
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: blockwork-${{ matrix.name }}-setup.exe
path: dist/blockwork-${{ matrix.name }}-setup.exe
if-no-files-found: error
retention-days: 14
- name: Build MSIX
if: runner.os == 'Windows'
shell: pwsh
run: |
$version = (Select-String -Path Cargo.toml -Pattern '^version = "(.*)"').Matches[0].Groups[1].Value
$arch = if ("${{ matrix.target }}" -like "aarch64-*") { "arm64" } else { "x64" }
./scripts/build-msix.ps1 -Version $version -Target ${{ matrix.target }} -Arch $arch
# An unsigned MSIX won't install locally, so sign a test copy with a throwaway cert.
# The Store re-signs the release build.
- name: Sign MSIX with test certificate
if: runner.os == 'Windows'
shell: pwsh
run: ./scripts/sign-msix-test.ps1 -Msix dist/blockwork-${{ matrix.name }}.msix
- name: Upload MSIX artifact
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: blockwork-${{ matrix.name }}-msix-test
path: |
dist/blockwork-${{ matrix.name }}.msix
dist/blockwork-msix-test.cer
if-no-files-found: error
retention-days: 14
- name: Build macOS app bundle
if: runner.os == 'macOS'
env:
MACOSX_DEPLOYMENT_TARGET: '13.0'
# Newer Xcode clang lists __yield as a builtin but needs arm_acle.h to declare it (Qt's qyieldcpu.h).
CXXFLAGS_aarch64_apple_darwin: -include arm_acle.h
run: ./scripts/build-macos-bundle.sh ${{ matrix.target }}
- name: Verify packaged executable starts
if: runner.os == 'macOS'
run: dist/Blockwork.app/Contents/MacOS/Blockwork --help
- name: Run application QML tests
if: runner.os == 'macOS'
run: |
export PATH="$(dirname "$QMAKE"):$PATH"
python3 blockwork-qt/tests/run.py ../blockstitch
- name: Zip macOS app bundle
if: runner.os == 'macOS'
run: ditto -c -k --sequesterRsrc --keepParent dist/Blockwork.app ${{ matrix.artifact_name }}.app.zip
- name: Preserve native QML crash reports
if: failure() && runner.os == 'macOS'
uses: actions/upload-artifact@v4
with:
name: qml-crashes-${{ matrix.name }}
path: target/macos-qml-crashes/
if-no-files-found: ignore
retention-days: 14
- name: Upload macOS app bundle
if: runner.os == 'macOS'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}.app.zip
path: ${{ matrix.artifact_name }}.app.zip
if-no-files-found: error
retention-days: 14
linux-appimage:
name: AppImage (${{ matrix.name }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- name: linux-x86_64
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: blockwork-linux-x86_64
linux_arch: x86_64
qt_host: linux
qt_arch: linux_gcc_64
- name: linux-arm64
runner: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
artifact_name: blockwork-linux-arm64
linux_arch: aarch64
qt_host: linux_arm64
qt_arch: linux_gcc_arm64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout Blockstitch QML module
shell: bash
run: |
scripts/fetch-blockstitch.sh ../blockstitch
# Official Qt builds where CXX-Qt's Qt download is missing or broken.
- name: Set up Python
if: matrix.qt_arch
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install Qt
if: matrix.qt_arch
shell: bash
run: |
python -m pip install py7zr==1.1.3 "aqtinstall @ git+https://github.com/miurahr/aqtinstall.git@076e1659807d0b362a3ed684d54c2e9c775eb9c7"
# A Qt mirror sometimes serves a broken archive, so try a few times.
for attempt in 1 2 3; do
rm -rf "$RUNNER_TEMP/Qt"
python -m aqt install-qt ${{ matrix.qt_host }} desktop ${{ env.QT_VERSION }} ${{ matrix.qt_arch }} --outputdir "$RUNNER_TEMP/Qt" && break
if [ "$attempt" = 3 ]; then exit 1; fi
echo "::warning::Qt install failed (attempt $attempt), retrying"
sleep 15
done
qmake=$(find "$RUNNER_TEMP/Qt/${{ env.QT_VERSION }}" -maxdepth 3 -path '*/bin/*' \( -name qmake -o -name qmake.exe \) | head -n 1)
test -n "$qmake"
if [[ "$RUNNER_OS" == Windows ]]; then qmake=$(cygpath -w "$qmake"); fi
echo "QMAKE=$qmake" >> "$GITHUB_ENV"
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install Linux system dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
pkg-config \
build-essential \
curl \
wget \
file \
libssl-dev \
libxdo-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
libdbus-1-dev \
libxkbcommon-dev \
libxkbcommon-x11-0 \
libx11-dev \
libx11-xcb-dev \
libxtst-dev \
libwayland-dev \
wayland-protocols \
libclang-dev \
lld \
libxcb-cursor0 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-render-util0 \
libxcb-shape0 \
libxcb-util1
- name: Build (release)
run: cargo build --release --target ${{ matrix.target }} --workspace --exclude blockwork-linux-bridge
- name: Build AppImage
run: |
export APPIMAGE_EXTRACT_AND_RUN=1
# linuxdeploy-plugin-qt only bundles xcb unless told otherwise.
export EXTRA_PLATFORM_PLUGINS=libqwayland.so
wget -q -O linuxdeploy.AppImage "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-${{ matrix.linux_arch }}.AppImage"
wget -q -O linuxdeploy-plugin-appimage.AppImage "https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-${{ matrix.linux_arch }}.AppImage"
wget -q -O linuxdeploy-plugin-qt.AppImage "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-${{ matrix.linux_arch }}.AppImage"
chmod +x linuxdeploy.AppImage linuxdeploy-plugin-appimage.AppImage linuxdeploy-plugin-qt.AppImage
export LD_LIBRARY_PATH="$($QMAKE -query QT_INSTALL_LIBS):${LD_LIBRARY_PATH:-}"
export QML_SOURCES_PATHS="$PWD/blockwork-qt/qml:$PWD/../blockstitch/qml"
RELEASE_DIR="target/${{ matrix.target }}/release"
./linuxdeploy.AppImage \
--appdir AppDir \
--executable "$RELEASE_DIR/blockwork" \
--executable "$RELEASE_DIR/blockwork-daemon" \
--desktop-file res/blockwork.desktop \
--icon-file res/icons/blockwork.png \
--plugin qt \
--output appimage
mv Blockwork*.AppImage ${{ matrix.artifact_name }}.AppImage
- name: Upload AppImage artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}.AppImage
path: ${{ matrix.artifact_name }}.AppImage
if-no-files-found: error
retention-days: 14
linux-flatpak:
name: Flatpak (${{ matrix.name }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- name: linux-x86_64
runner: ubuntu-latest
artifact_name: blockwork-linux-x86_64
- name: linux-arm64
runner: ubuntu-24.04-arm
artifact_name: blockwork-linux-arm64
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Checkout Blockstitch QML module
shell: bash
run: |
scripts/fetch-blockstitch.sh ../blockstitch
- name: Install Flatpak tooling
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends flatpak flatpak-builder elfutils
flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install --user --noninteractive flathub \
org.kde.Platform//6.10 org.kde.Sdk//6.10 \
org.freedesktop.Sdk.Extension.rust-stable//25.08 \
org.flatpak.Builder
- name: Generate offline Cargo sources
run: |
flatpak run --filesystem="$PWD" --command=flatpak-cargo-generator \
org.flatpak.Builder -o packaging/flatpak/cargo-sources.json Cargo.lock
- name: Build Flatpak
# Offline sandbox build, no host cargo build needed.
run: |
manifest=packaging/flatpak/com.blockworked.Blockwork
awk '
/# BEGIN app-source/ {
print
print " - type: dir"
print " path: ../.."
print " skip: [target, .git, .flatpak-builder, flatpak-build, flatpak-repo, packaging/flatpak]"
skip = "app"
next
}
/# END app-source/ { skip = ""; print; next }
/# BEGIN blockstitch-source/ {
print
print " - type: dir"
print " path: ../../../blockstitch"
print " dest: .flatpak-blockstitch"
print " skip: [target, .git, node_modules, dist]"
skip = "blockstitch"
next
}
/# END blockstitch-source/ { skip = ""; print; next }
!skip
' "$manifest.yml" > "$manifest.local.yml"
flatpak-builder --force-clean --user --default-branch=stable --repo=flatpak-repo flatpak-build "$manifest.local.yml"
flatpak build-bundle flatpak-repo ${{ matrix.artifact_name }}.flatpak com.blockworked.Blockwork stable
- name: Upload Flatpak artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}.flatpak
path: ${{ matrix.artifact_name }}.flatpak
if-no-files-found: error
retention-days: 14