Repository navigation
350 lines (301 loc) · 12.6 KB
/
Copy pathbuild-artifacts.yml
File metadata and controls
350 lines (301 loc) · 12.6 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
name: Build Artifacts
on:
push:
workflow_dispatch:
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
artifact_name: blockwork-windows-x86_64.exe
cef_windows_dir: cef_windows_x86_64
installer_arch: x64compatible
experimental: false
- name: windows-arm64
runner: windows-11-arm
target: aarch64-pc-windows-msvc
artifact_name: blockwork-windows-arm64.exe
cef_windows_dir: cef_windows_aarch64
installer_arch: arm64
experimental: true
- name: macos-arm64
runner: macos-latest
target: aarch64-apple-darwin
artifact_name: blockwork-macos-arm64
experimental: true
steps:
- name: Checkout
uses: actions/checkout@v4
- 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 pnpm
uses: pnpm/action-setup@v4
with:
package_json_file: ui/package.json
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
cache-dependency-path: ui/pnpm-lock.yaml
- name: Build (release, Windows)
if: runner.os == 'Windows'
run: cargo build --release --target ${{ matrix.target }} --workspace --exclude blockwork-linux-bridge
- name: Stage CEF runtime files (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$releaseDir = "target/${{ matrix.target }}/release"
$cefBuildDir = Get-ChildItem "$releaseDir/build" -Directory -Filter "cef-dll-sys-*" |
Sort-Object LastWriteTime -Descending | Select-Object -First 1
$cefRuntimeDir = Get-ChildItem (Join-Path $cefBuildDir.FullName "out") -Recurse -Directory -Filter "${{ matrix.cef_windows_dir }}" |
Select-Object -First 1
Get-ChildItem $cefRuntimeDir.FullName -File | Copy-Item -Destination $releaseDir -Force
Copy-Item (Join-Path $cefRuntimeDir.FullName "locales") $releaseDir -Recurse -Force
- name: Rename binary (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: Copy-Item target/${{ matrix.target }}/release/blockwork.exe ${{ 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: matrix.name == 'windows-x86_64'
shell: pwsh
run: |
$version = (Select-String -Path Cargo.toml -Pattern '^version = "(.*)"').Matches[0].Groups[1].Value
./scripts/build-msix.ps1 -Version $version -Target ${{ matrix.target }} -Arch x64
# 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: matrix.name == 'windows-x86_64'
shell: pwsh
run: ./scripts/sign-msix-test.ps1 -Msix dist/blockwork-windows-x86_64.msix
- name: Upload MSIX artifact
if: matrix.name == 'windows-x86_64'
uses: actions/upload-artifact@v4
with:
name: blockwork-windows-x86_64-msix-test
path: |
dist/blockwork-windows-x86_64.msix
dist/blockwork-msix-test.cer
if-no-files-found: error
retention-days: 14
- name: Build macOS app bundle
if: runner.os == 'macOS'
run: ./scripts/build-macos-bundle.sh ${{ matrix.target }}
- name: Zip macOS app bundle
if: runner.os == 'macOS'
run: ditto -c -k --sequesterRsrc --keepParent dist/Blockwork.app ${{ matrix.artifact_name }}.app.zip
- 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
- name: linux-arm64
runner: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
artifact_name: blockwork-linux-arm64
linux_arch: aarch64
steps:
- name: Checkout
uses: actions/checkout@v4
- 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 \
libwebkit2gtk-4.1-dev \
libdbus-1-dev \
libxkbcommon-dev \
libxkbcommon-x11-0 \
libx11-dev \
libx11-xcb-dev \
libxtst-dev \
libwayland-dev \
wayland-protocols \
libclang-dev
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
package_json_file: ui/package.json
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
cache-dependency-path: ui/pnpm-lock.yaml
- name: Build (release)
run: cargo build --release --target ${{ matrix.target }}
- name: Stage CEF runtime files
run: |
releaseDir="target/${{ matrix.target }}/release"
cefBuildDir=$(ls -dt "$releaseDir"/build/cef-dll-sys-*/ | head -1)
cefRuntimeDir=$(find "${cefBuildDir}out" -maxdepth 2 -type d -name "cef_linux_${{ matrix.linux_arch }}" | head -1)
find "$cefRuntimeDir" -maxdepth 1 -type f -exec cp -f {} "$releaseDir/" \;
cp -r "$cefRuntimeDir/locales" "$releaseDir/"
- name: Rename binary
run: cp target/${{ matrix.target }}/release/blockwork ${{ matrix.artifact_name }}
- name: Build AppImage
run: |
export APPIMAGE_EXTRACT_AND_RUN=1
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"
chmod +x linuxdeploy.AppImage linuxdeploy-plugin-appimage.AppImage
# Stage under appimage-staging/: the repo root already contains a
# blockwork-daemon/ crate dir, so copying the daemon binary to "."
# collides with it ("cannot overwrite directory with non-directory").
mkdir -p appimage-staging
# Exec entry wants a binary named blockwork.
cp ${{ matrix.artifact_name }} appimage-staging/blockwork
# CEF runtime sits next to the binary in target/<triple>/release.
# linuxdeploy only finds libcef.so via ldd, so copy the rest by hand.
CEF_DIR="target/${{ matrix.target }}/release"
cp "$CEF_DIR/libcef.so" appimage-staging/
# Daemon ships next to blockwork in usr/bin.
cp "$CEF_DIR/blockwork-daemon" appimage-staging/
export LINUXDEPLOY_EXCLUDED_LIBRARIES="libnspr4.so;libplc4.so;libplds4.so;libnss3.so;libnssutil3.so;libsmime3.so"
./linuxdeploy.AppImage \
--appdir AppDir \
--executable ./appimage-staging/blockwork \
--executable ./appimage-staging/blockwork-daemon \
--desktop-file res/blockwork.desktop \
--icon-file res/icons/blockwork.png
cp "$CEF_DIR"/libEGL.so "$CEF_DIR"/libGLESv2.so "$CEF_DIR"/libvk_swiftshader.so \
"$CEF_DIR"/libvulkan.so.1 "$CEF_DIR"/vk_swiftshader_icd.json "$CEF_DIR"/chrome-sandbox \
"$CEF_DIR"/icudtl.dat "$CEF_DIR"/v8_context_snapshot.bin "$CEF_DIR"/chrome_100_percent.pak \
"$CEF_DIR"/chrome_200_percent.pak "$CEF_DIR"/resources.pak \
AppDir/usr/lib/
cp -r "$CEF_DIR/locales" AppDir/usr/lib/
./linuxdeploy.AppImage --appdir AppDir --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: 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.gnome.Platform//50 org.gnome.Sdk//50 \
org.freedesktop.Sdk.Extension.rust-stable//25.08 org.freedesktop.Sdk.Extension.node24//25.08
- 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, node_modules, ui/node_modules, ui/dist, packaging/flatpak]"
skip = 1
next
}
/# END app-source/ { skip = 0 }
!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