-
Notifications
You must be signed in to change notification settings - Fork 202
369 lines (333 loc) · 13.3 KB
/
Copy pathnightly-artifacts.yml
File metadata and controls
369 lines (333 loc) · 13.3 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
name: Nightly Artifact Build
on:
workflow_call:
inputs:
checkout_ref:
description: "Commit SHA or ref to build."
required: true
type: string
version:
description: "Prerelease version projected into every artifact producer."
required: true
type: string
artifact_prefix:
description: "Prefix isolating artifacts in the caller run."
required: true
type: string
artifact_retention_days:
description: "Retention for build artifacts."
required: false
default: 1
type: number
build_desktop_packages:
description: "Whether to run Desktop/Installer package producers."
required: false
default: true
type: boolean
desktop_platforms:
description: "JSON array of Desktop/Installer platform names to package."
required: false
default: '["linux-x64","linux-arm64","macos-arm64","macos-x64","windows-x64"]'
type: string
build_linux_binaries:
description: "Whether to build Linux CLI and Relay archives."
required: false
default: true
type: boolean
build_relay_image:
description: "Whether to validate the Relay runtime image without publishing it."
required: false
default: true
type: boolean
upload_artifacts:
description: "Whether to upload package outputs for a publishing caller."
required: false
default: true
type: boolean
cache_write:
description: "Allow a trusted non-PR caller to refresh build caches."
required: false
default: false
type: boolean
secrets:
TAURI_SIGNING_PRIVATE_KEY:
required: false
TAURI_SIGNING_PRIVATE_KEY_PASSWORD:
required: false
TAURI_UPDATER_PUBKEY:
required: false
permissions:
contents: read
jobs:
# ── Patch version for nightly ──────────────────────────────────────
package:
name: Package (${{ matrix.platform }})
if: ${{ inputs.build_desktop_packages }}
runs-on: ${{ fromJSON('{"linux-x64":"ubuntu-latest","linux-arm64":"ubuntu-24.04-arm","macos-arm64":"macos-15","macos-x64":"macos-15-intel","windows-x64":"windows-latest"}')[matrix.platform] }}
env:
NODE_OPTIONS: --max-old-space-size=6144
BITFUN_RELEASE_CHANNEL: nightly
# Nightly does not publish a Tauri latest.json feed yet. Preserve its
# existing stable updater endpoints until that publishing path exists.
TAURI_UPDATER_ENDPOINT: https://github.com/GCWing/BitFun/releases/latest/download/latest.json
TAURI_UPDATER_FALLBACK_ENDPOINT: https://openbitfun.com/release/latest.json
# Nightly relay archives are signed too (linux-binaries.yml receives the
# key), so nightly Desktop needs the same trust root to verify them.
BITFUN_RELEASE_PUBKEY: ${{ secrets.TAURI_UPDATER_PUBKEY }}
PACKAGE_TARGET: ${{ fromJSON('{"linux-x64":"x86_64-unknown-linux-gnu","linux-arm64":"aarch64-unknown-linux-gnu","macos-arm64":"aarch64-apple-darwin","macos-x64":"x86_64-apple-darwin","windows-x64":"x86_64-pc-windows-msvc"}')[matrix.platform] }}
strategy:
fail-fast: false
matrix:
platform: ${{ fromJSON(inputs.desktop_platforms) }}
steps:
- uses: actions/checkout@v5
with:
ref: ${{ inputs.checkout_ref }}
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.14"
no-cache: true
- name: Install Linux system dependencies (Tauri bundler)
if: runner.os == 'Linux'
shell: bash
run: |
sudo apt-get update
if apt-cache show libwebkit2gtk-4.1-dev >/dev/null 2>&1; then
WEBKIT_PKG=libwebkit2gtk-4.1-dev
else
WEBKIT_PKG=libwebkit2gtk-4.0-dev
fi
if apt-cache show libappindicator3-dev >/dev/null 2>&1; then
APPINDICATOR_PKG=libappindicator3-dev
else
APPINDICATOR_PKG=libayatana-appindicator3-dev
fi
# Tauri pins AppImage GTK input methods to its bundled cache, so the
# fcitx5 GTK3 bridge must be present before linuxdeploy builds it.
sudo apt-get install -y --no-install-recommends \
pkg-config \
xdg-utils \
libglib2.0-dev \
libgtk-3-dev \
fcitx5-frontend-gtk3 \
libxdo-dev \
"$WEBKIT_PKG" \
"$APPINDICATOR_PKG" \
librsvg2-dev \
patchelf \
fakeroot \
rpm \
libleptonica-dev \
libtesseract-dev \
tesseract-ocr \
tesseract-ocr-eng
- name: Setup pnpm
uses: pnpm/action-setup@v5
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 22
package-manager-cache: false
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ env.PACKAGE_TARGET }}
- name: Cache Rust build
uses: swatinem/rust-cache@v2
with:
shared-key: "nightly-v3-${{ github.base_ref || github.ref_name }}-${{ matrix.platform }}"
cache-bin: false
# A PR merge ref can never become a reusable base cache. Even a
# trusted caller cannot override this guard.
save-if: ${{ inputs.cache_write && github.event_name != 'pull_request' }}
cache-on-failure: ${{ inputs.cache_write && github.event_name != 'pull_request' }}
- name: Verify committed Cargo metadata
run: cargo metadata --locked --no-deps
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Verify Installer i18n projection
if: runner.os == 'Windows'
run: pnpm --dir BitFun-Installer run sync:i18n
- name: Verify Installer Tauri package alignment
if: runner.os == 'Windows'
shell: bash
run: |
set -euo pipefail
info="$(pnpm --dir BitFun-Installer exec tauri info 2>&1)"
printf '%s\n' "$info"
if grep -Fq 'Error: Found version mismatched Tauri packages.' <<<"$info"; then
exit 1
fi
- name: Build plugin Host resources
run: |
bun install --cwd src/apps/extension-host --frozen-lockfile
bun run --cwd src/apps/extension-host build
- name: Generate web API bindings
run: pnpm --dir src/web-ui run gen:types
- name: Type-check web UI
run: pnpm run type-check:web
- name: Patch nightly version
shell: bash
env:
NIGHTLY_VERSION: ${{ inputs.version }}
run: |
set -euo pipefail
echo "Patching version to $NIGHTLY_VERSION"
ASSET_VERSION="${NIGHTLY_VERSION%%+*}"
node scripts/set-build-version.mjs --version "$ASSET_VERSION"
echo "package.json version: $(jq -r '.version' package.json)"
echo "Cargo.toml version: $(grep 'x-release-please-version' Cargo.toml)"
- name: Verify projected Cargo metadata
run: cargo metadata --locked --no-deps
- name: Run Windows CLI terminal contracts
if: runner.os == 'Windows'
env:
CARGO_INCREMENTAL: "0"
CARGO_PROFILE_DEV_DEBUG: "0"
CARGO_PROFILE_TEST_DEBUG: "0"
run: cargo test --locked -p bitfun-cli --test terminal_process_contracts -- --test-threads=1
- name: Build desktop app
shell: bash
run: |
case "${{ matrix.platform }}" in
linux-x64)
pnpm run desktop:build:linux -- --target x86_64-unknown-linux-gnu --bundles deb,rpm,appimage
;;
linux-arm64)
CARGO_PROFILE_RELEASE_LTO=thin pnpm run desktop:build:linux -- --target aarch64-unknown-linux-gnu --bundles deb,rpm,appimage
;;
macos-arm64)
pnpm run desktop:build:arm64
;;
macos-x64)
pnpm run desktop:build:x86_64
;;
windows-x64)
pnpm run installer:build
;;
*)
echo "Unsupported package platform: ${{ matrix.platform }}" >&2
exit 1
;;
esac
- name: Package macOS CLI for SSH dispatch
if: runner.os == 'macOS'
id: macos-cli
shell: bash
env:
NIGHTLY_VERSION: ${{ inputs.version }}
TARGET: ${{ env.PACKAGE_TARGET }}
run: |
set -euo pipefail
ASSET_VERSION="${NIGHTLY_VERSION%%+*}"
cargo build --release --target "$TARGET" -p bitfun-cli
bash scripts/cli/package-unix.sh "$ASSET_VERSION" "$TARGET"
- name: Sign macOS CLI archive and checksum
if: runner.os == 'macOS'
shell: bash
env:
BITFUN_SIGNING_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
BITFUN_SIGNING_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
BITFUN_SIGNING_PUBKEY: ${{ secrets.TAURI_UPDATER_PUBKEY }}
run: |
set -euo pipefail
bash scripts/sign-release-assets.sh \
"${{ steps.macos-cli.outputs.archive }}" \
"${{ steps.macos-cli.outputs.checksum }}"
- name: Verify AppImage fcitx5 GTK module
if: runner.os == 'Linux'
shell: bash
run: bash scripts/ci/verify-appimage-fcitx.sh "${{ env.PACKAGE_TARGET }}"
# Keep output validation independent from artifact upload. PR callers do
# not upload packages, but still need evidence that every selected
# producer emitted the files its publishing caller will collect.
- name: Verify package outputs
shell: bash
run: |
set -euo pipefail
find_bundle_file() {
local pattern="$1"
local root
for root in \
"target/${PACKAGE_TARGET}/release/bundle" \
"target/release/bundle" \
"src/apps/desktop/target/${PACKAGE_TARGET}/release/bundle" \
"src/apps/desktop/target/release/bundle"; do
if [[ -d "$root" ]] && find "$root" -type f -name "$pattern" -size +0c -print -quit | grep -q .; then
return 0
fi
done
echo "Missing non-empty package output matching $pattern for ${{ matrix.platform }}" >&2
return 1
}
find_bundle_dir() {
local pattern="$1"
local root
for root in \
"target/${PACKAGE_TARGET}/release/bundle" \
"target/release/bundle" \
"src/apps/desktop/target/${PACKAGE_TARGET}/release/bundle" \
"src/apps/desktop/target/release/bundle"; do
if [[ -d "$root" ]] && find "$root" -type d -name "$pattern" -print -quit | grep -q .; then
return 0
fi
done
echo "Missing package directory matching $pattern for ${{ matrix.platform }}" >&2
return 1
}
case "${{ matrix.platform }}" in
linux-*)
find_bundle_file '*.deb'
find_bundle_file '*.rpm'
find_bundle_file '*.AppImage'
;;
macos-*)
find_bundle_dir '*.app'
find_bundle_file '*.dmg'
shopt -s nullglob
cli_archives=(bitfun-cli-*-"${PACKAGE_TARGET}".tar.gz)
[[ ${#cli_archives[@]} -eq 1 ]]
test -s "${cli_archives[0]}"
test -s "${cli_archives[0]}.sha256"
;;
windows-x64)
test -s BitFun-Installer/src-tauri/target/release/bitfun-installer.exe
;;
*)
echo "Unsupported package platform: ${{ matrix.platform }}" >&2
exit 1
;;
esac
- name: Upload bundles
if: ${{ inputs.upload_artifacts }}
uses: actions/upload-artifact@v6
with:
name: bitfun-${{ inputs.artifact_prefix }}-${{ matrix.platform }}-bundle
if-no-files-found: error
retention-days: ${{ inputs.artifact_retention_days }}
path: |
target/*/release/bundle
target/release/bundle
src/apps/desktop/target/release/bundle
BitFun-Installer/src-tauri/target/release/bitfun-installer.exe
bitfun-cli-*-apple-darwin.tar.gz
bitfun-cli-*-apple-darwin.tar.gz.sha256
bitfun-cli-*-apple-darwin.tar.gz.sig
bitfun-cli-*-apple-darwin.tar.gz.sha256.sig
linux-binaries:
name: Linux CLI and Relay Server
if: ${{ inputs.build_linux_binaries || inputs.build_relay_image }}
uses: ./.github/workflows/linux-binaries.yml
secrets:
release_signing_key: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
release_signing_password: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
release_pubkey: ${{ secrets.TAURI_UPDATER_PUBKEY }}
with:
checkout_ref: ${{ inputs.checkout_ref }}
version: ${{ inputs.version }}
artifact_prefix: ${{ inputs.artifact_prefix }}
artifact_retention_days: ${{ inputs.artifact_retention_days }}
upload_artifacts: ${{ inputs.upload_artifacts }}
cache_write: ${{ inputs.cache_write }}
validate_relay_image: ${{ inputs.build_relay_image }}