-
Notifications
You must be signed in to change notification settings - Fork 1
378 lines (337 loc) · 13 KB
/
build-tauri.yml
File metadata and controls
378 lines (337 loc) · 13 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
name: Build Tauri (All Platforms)
on:
push:
branches: [dev]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
CARGO_NET_RETRY: 3
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- platform: ubuntu-22.04
args: ''
suffix: linux-x64
artifact_name: XFast-Manager-linux-x64
- platform: macos-latest
args: '--target universal-apple-darwin'
suffix: macos-universal
artifact_name: XFast-Manager-macos-universal
- platform: windows-latest
args: ''
suffix: windows-x64
artifact_name: XFast-Manager-windows-portable
name: Build (${{ matrix.suffix }})
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Check if fast build
id: check_fast
shell: bash
run: |
if [[ "${{ github.event.head_commit.message }}" == *"dbuild"* ]]; then
echo "is_fast=true" >> $GITHUB_OUTPUT
echo "🚀 Fast build mode enabled (optimized for speed)"
else
echo "is_fast=false" >> $GITHUB_OUTPUT
echo "📦 Standard build mode (optimized for size)"
fi
- name: Install Linux dependencies
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Add macOS targets
if: matrix.platform == 'macos-latest'
run: |
rustup target add aarch64-apple-darwin
rustup target add x86_64-apple-darwin
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 22
cache: 'npm'
- name: Validate version consistency
run: node scripts/validate-version-consistency.mjs
- name: Install JS dependencies
run: npm ci
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies (Fast mode)
if: steps.check_fast.outputs.is_fast == 'true'
uses: Swatinem/rust-cache@v2
with:
prefix-key: "v2-rust-fast"
key: "fast-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}"
cache-on-failure: true
save-if: true
cache-all-crates: true
cache-directories: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
- name: Cache Rust dependencies (Standard mode)
if: steps.check_fast.outputs.is_fast == 'false'
uses: Swatinem/rust-cache@v2
with:
prefix-key: "v2-rust-standard"
key: "standard-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}"
cache-on-failure: false
cache-all-crates: true
cache-directories: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
- name: Set fast build environment
if: steps.check_fast.outputs.is_fast == 'true'
shell: bash
run: |
echo "CARGO_INCREMENTAL=1" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_CODEGEN_UNITS=256" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_LTO=off" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_OPT_LEVEL=1" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_DEBUG=0" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_STRIP=debuginfo" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_PANIC=abort" >> $GITHUB_ENV
echo "RUSTFLAGS=-C embed-bitcode=no" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_SPLIT_DEBUGINFO=unpacked" >> $GITHUB_ENV
echo "BUILD_MODE=fast" >> $GITHUB_ENV
echo "✅ Fast build environment configured"
- name: Set standard build environment
if: steps.check_fast.outputs.is_fast == 'false'
shell: bash
run: |
echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_LTO=fat" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_OPT_LEVEL=3" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_STRIP=debuginfo" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_PANIC=abort" >> $GITHUB_ENV
echo "BUILD_MODE=standard" >> $GITHUB_ENV
- name: Build Tauri
shell: bash
env:
XFAST_ZIBO_GOOGLE_DRIVE_API_KEY: ${{ secrets.XFAST_ZIBO_GOOGLE_DRIVE_API_KEY }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
run: |
echo "🔨 Building for ${{ matrix.suffix }}..."
if [ -n "${{ matrix.args }}" ]; then
npm run tauri:build -- ${{ matrix.args }}
else
npm run tauri:build
fi
- name: Prepare Windows artifact
if: matrix.platform == 'windows-latest'
shell: pwsh
run: |
Rename-Item -Path "target/release/xfastmanager.exe" -NewName "XFast-Manager.exe" -Force
- name: Upload Windows portable artifact
if: matrix.platform == 'windows-latest'
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.artifact_name }}
path: 'target/release/XFast-Manager.exe'
if-no-files-found: error
retention-days: 7
compression-level: 9
- name: Upload Windows MSI artifact
if: matrix.platform == 'windows-latest'
uses: actions/upload-artifact@v6
with:
name: XFast-Manager-windows-msi
path: 'target/release/bundle/msi/*.msi'
if-no-files-found: error
retention-days: 7
compression-level: 9
- name: Upload macOS artifact
if: matrix.platform == 'macos-latest'
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.artifact_name }}
path: 'target/universal-apple-darwin/release/bundle/dmg/*.dmg'
if-no-files-found: error
retention-days: 7
compression-level: 9
- name: Upload Linux artifact
if: matrix.platform == 'ubuntu-22.04'
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.artifact_name }}
path: 'target/release/bundle/appimage/*.AppImage'
if-no-files-found: error
retention-days: 7
compression-level: 9
build-arch-linux:
name: Build (linux-arch-x64)
runs-on: ubuntu-22.04
container:
image: archlinux:latest
env:
APPIMAGE_EXTRACT_AND_RUN: 1
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Check if fast build
id: check_fast_arch
shell: bash
run: |
if [[ "${{ github.event.head_commit.message }}" == *"dbuild"* ]]; then
echo "is_fast=true" >> $GITHUB_OUTPUT
echo "🚀 Fast build mode enabled (optimized for speed)"
else
echo "is_fast=false" >> $GITHUB_OUTPUT
echo "📦 Standard build mode (optimized for size)"
fi
- name: Install Arch Linux dependencies
shell: bash
run: |
pacman-key --init
pacman-key --populate archlinux
pacman -Syu --noconfirm --needed \
base-devel \
curl \
git \
openssl \
pkgconf \
gtk3 \
webkit2gtk-4.1 \
libappindicator-gtk3 \
librsvg \
patchelf
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 22
cache: 'npm'
- name: Validate version consistency
run: node scripts/validate-version-consistency.mjs
- name: Install JS dependencies
run: npm ci
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies (Fast mode)
if: steps.check_fast_arch.outputs.is_fast == 'true'
uses: Swatinem/rust-cache@v2
with:
prefix-key: "v2-rust-arch-fast"
key: "fast-archlinux-${{ hashFiles('**/Cargo.lock') }}"
cache-on-failure: true
save-if: true
cache-all-crates: true
cache-directories: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
- name: Cache Rust dependencies (Standard mode)
if: steps.check_fast_arch.outputs.is_fast == 'false'
uses: Swatinem/rust-cache@v2
with:
prefix-key: "v2-rust-arch-standard"
key: "standard-archlinux-${{ hashFiles('**/Cargo.lock') }}"
cache-on-failure: false
cache-all-crates: true
cache-directories: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
- name: Set fast build environment
if: steps.check_fast_arch.outputs.is_fast == 'true'
shell: bash
run: |
echo "CARGO_INCREMENTAL=1" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_CODEGEN_UNITS=256" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_LTO=off" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_OPT_LEVEL=1" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_DEBUG=0" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_STRIP=debuginfo" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_PANIC=abort" >> $GITHUB_ENV
echo "RUSTFLAGS=-C embed-bitcode=no" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_SPLIT_DEBUGINFO=unpacked" >> $GITHUB_ENV
echo "BUILD_MODE=fast" >> $GITHUB_ENV
echo "✅ Fast build environment configured"
- name: Set standard build environment
if: steps.check_fast_arch.outputs.is_fast == 'false'
shell: bash
run: |
echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_LTO=fat" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_OPT_LEVEL=3" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_STRIP=debuginfo" >> $GITHUB_ENV
echo "CARGO_PROFILE_RELEASE_PANIC=abort" >> $GITHUB_ENV
echo "BUILD_MODE=standard" >> $GITHUB_ENV
- name: Build frontend
shell: bash
run: npm run build
- name: Build Arch Linux binary
shell: bash
env:
XFAST_ZIBO_GOOGLE_DRIVE_API_KEY: ${{ secrets.XFAST_ZIBO_GOOGLE_DRIVE_API_KEY }}
run: |
echo "🔨 Building native Arch Linux binary..."
cargo build --manifest-path src-tauri/Cargo.toml --release
- name: Build Arch Linux AppImage
id: arch_appimage
continue-on-error: true
shell: bash
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
RUST_LOG: tauri_bundler=trace
run: |
if [[ "${{ github.event.head_commit.message }}" != *"archappimage"* ]]; then
echo "Skipping experimental Arch AppImage build. Add 'archappimage' to the commit message to enable it."
exit 0
fi
echo "🔨 Building Arch Linux AppImage (non-blocking experimental step)..."
npm run tauri:build -- --bundles appimage 2>&1 | tee arch-appimage-build.log
- name: Package Arch Linux artifact
shell: bash
run: |
mkdir -p artifacts
cp target/release/xfastmanager artifacts/XFast-Manager
tar -C artifacts -czf target/release/XFast-Manager-linux-arch-x64.tar.gz XFast-Manager
- name: Upload Arch Linux tar.gz artifact
uses: actions/upload-artifact@v6
with:
name: XFast-Manager-linux-arch-x64
path: 'target/release/XFast-Manager-linux-arch-x64.tar.gz'
if-no-files-found: error
retention-days: 7
compression-level: 9
- name: Upload Arch Linux AppImage artifact
if: steps.arch_appimage.outcome != 'skipped'
uses: actions/upload-artifact@v6
with:
name: XFast-Manager-linux-arch-x64-appimage
path: 'target/release/bundle/appimage/*.AppImage'
if-no-files-found: ignore
retention-days: 7
compression-level: 9
- name: Upload Arch Linux AppImage debug artifacts
if: steps.arch_appimage.outcome == 'failure'
uses: actions/upload-artifact@v6
with:
name: XFast-Manager-linux-arch-x64-appimage-debug
path: |
arch-appimage-build.log
target/release/bundle/appimage/build_appimage.sh
target/release/bundle/appimage/*.AppImage
target/release/bundle/appimage/*.AppDir/**
/github/home/.cache/tauri/linuxdeploy*
if-no-files-found: ignore
retention-days: 7
compression-level: 9