-
-
Notifications
You must be signed in to change notification settings - Fork 0
339 lines (286 loc) · 12.8 KB
/
Copy pathrelease.yml
File metadata and controls
339 lines (286 loc) · 12.8 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
name: Release
on:
push:
tags:
# Matches bare semver tags: 1.2.3, 1.2.3-rc.1, etc.
- "[0-9]*.[0-9]*.[0-9]*"
# Manual trigger to exercise the whole pipeline (including the Windows
# portable build) WITHOUT publishing a release: the build artifacts land on
# the Actions run for download, and the `release` job below is gated to tag
# pushes only, so nothing public is created.
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
# No global RUSTFLAGS here: a set RUSTFLAGS env overrides the target-scoped
# rustflags in .cargo/config.toml, which would drop the Windows crt-static
# linking. Warnings are gated in ci.yml on every push/PR.
jobs:
# ---------------------------------------------------------------------------
# Build matrix — one job per target
# ---------------------------------------------------------------------------
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
# aarch64 musl is built natively on the ARM runner, so target (musl) differs
# from host (gnu) and cc-rs treats it as a cross build: ring then looks for
# aarch64-linux-musl-gcc, which musl-tools does not ship (only musl-gcc).
# Point ring's C compiler and the linker at musl-gcc. These vars are
# target-scoped, so they are inert for the x86_64 (cross) and macOS jobs.
env:
CC_aarch64_unknown_linux_musl: musl-gcc
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: musl-gcc
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
use_cross: true
- target: aarch64-unknown-linux-musl
os: ubuntu-24.04-arm
use_cross: false
- target: x86_64-apple-darwin
os: macos-latest
use_cross: false
- target: aarch64-apple-darwin
os: macos-latest
use_cross: false
steps:
- uses: actions/checkout@v7
- name: Load build versions
shell: bash
run: grep -E '^[A-Za-z_]+=' versions.env >> "$GITHUB_ENV"
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }},wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install cross
if: matrix.use_cross
uses: taiki-e/install-action@v2
with:
tool: cross
# Native aarch64 musl build needs a musl C toolchain for ring (see the
# CC_* env above).
- name: Install musl toolchain
if: matrix.target == 'aarch64-unknown-linux-musl'
run: sudo apt-get update && sudo apt-get install -y musl-tools musl-dev
- name: Install trunk
uses: taiki-e/install-action@v2
with:
tool: trunk@${{ env.TRUNK_VERSION }}
# The release binary is the complete client (web panel embedded via the
# web-ui feature / rust-embed), matching the `latest` container image, so
# the frontend is built first. trunk runs on the host; for the cross
# target it then compiles the binary, reading the dist/ trunk produced.
- name: Build frontend
run: cd rucio-web && trunk build --release --public-url ./
- name: Build (cross)
if: matrix.use_cross
run: cross build --release --target ${{ matrix.target }} --bin rucio --features emule-compat,web-ui
- name: Build (cargo)
if: ${{ !matrix.use_cross }}
run: cargo build --release --target ${{ matrix.target }} --bin rucio --features emule-compat,web-ui
- name: Package
shell: bash
run: |
BINDIR=target/${{ matrix.target }}/release
ARCHIVE=rucio-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
# `ruciod` is the daemon entrypoint: the same binary invoked under that
# name. Ship it as a relative symlink next to the binary so extracting
# the archive yields both commands (tar stores the link, not a copy).
ln -sf rucio "$BINDIR/ruciod"
tar -czf "$ARCHIVE" -C "$BINDIR" rucio ruciod
echo "ARCHIVE=$ARCHIVE" >> "$GITHUB_ENV"
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: rucio-${{ matrix.target }}
path: ${{ env.ARCHIVE }}
if-no-files-found: error
# ---------------------------------------------------------------------------
# Static web panel — the trunk-built assets, for users who want to serve the
# panel from their own web server (e.g. nginx + TLS) against a headless
# daemon. The complete binary already embeds these; this is the unbundled
# form. See docs/user/01-installation.md for the nginx reverse-proxy snippet.
# ---------------------------------------------------------------------------
web:
name: Build static web panel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Load build versions
shell: bash
run: grep -E '^[A-Za-z_]+=' versions.env >> "$GITHUB_ENV"
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
with:
key: wasm-web
- name: Install trunk
uses: taiki-e/install-action@v2
with:
tool: trunk@${{ env.TRUNK_VERSION }}
- name: Build frontend
run: cd rucio-web && trunk build --release --public-url ./
- name: Package
shell: bash
run: |
ARCHIVE=rucio-web-${{ github.ref_name }}.tar.gz
tar -czf "$ARCHIVE" -C rucio-web/dist .
echo "ARCHIVE=$ARCHIVE" >> "$GITHUB_ENV"
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: rucio-web
path: ${{ env.ARCHIVE }}
if-no-files-found: error
# ---------------------------------------------------------------------------
# Windows portable desktop app — the Tauri shell hosting the embedded daemon
# + web UI. Shipped as a ZIP (no installer): unzip to a writable folder, run,
# and all state lives next to the .exe (portable mode). Relies on the
# evergreen WebView2 runtime (preinstalled on Windows 10/11).
# ---------------------------------------------------------------------------
windows-desktop:
name: Build Windows desktop (portable)
runs-on: windows-latest
steps:
- uses: actions/checkout@v7
- name: Load build versions
shell: bash
run: grep -E '^[A-Za-z_]+=' versions.env >> "$GITHUB_ENV"
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown,x86_64-pc-windows-msvc
- uses: Swatinem/rust-cache@v2
with:
key: windows-desktop
- name: Install trunk
uses: taiki-e/install-action@v2
with:
tool: trunk@${{ env.TRUNK_VERSION }}
# The embedded daemon serves the web UI (web-ui feature / rust-embed), so
# the frontend has to be built before the crate is compiled.
- name: Build frontend
run: cd rucio-web && trunk build --release --public-url ./
# Explicit --target so the crt-static rustflags in .cargo/config.toml apply
# only to the final binary, not to host proc-macros / build scripts.
- name: Build desktop app
run: cargo build --release -p rucio-tauri --target x86_64-pc-windows-msvc
- name: Package (portable ZIP)
shell: pwsh
run: |
$archive = "rucio-${{ github.ref_name }}-windows-x86_64-portable.zip"
New-Item -ItemType Directory -Force stage | Out-Null
Copy-Item target/x86_64-pc-windows-msvc/release/rucio-tauri.exe stage/Rucio.exe
@"
Rucio - portable build.
Extract this folder somewhere you can write to (Desktop, Documents -
NOT Program Files) and run Rucio.exe. All data (settings, database,
downloads, identity) lives in this same folder, so deleting the folder
removes everything.
On first run Windows Firewall will ask whether to allow Rucio to
communicate on your networks - click Allow for full connectivity
(incoming connections / High-ID). If you decline, downloads still
work but the node runs as Low-ID (no incoming connections).
Requires the Microsoft Edge WebView2 runtime, preinstalled on
Windows 10/11.
"@ | Set-Content -Encoding UTF8 stage/README.txt
Compress-Archive -Path stage/* -DestinationPath $archive -Force
"ARCHIVE=$archive" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: rucio-windows-desktop
path: ${{ env.ARCHIVE }}
if-no-files-found: error
# ---------------------------------------------------------------------------
# Linux desktop app — the Tauri shell as a Flatpak (own bundle). Builds the
# release binary on the runner (like rucio-tauri/flatpak/build.sh), then packs
# it with flatpak-builder into a single-file .flatpak bundle. Pinned to
# ubuntu-24.04 so the host glibc stays compatible with the GNOME runtime the
# binary runs against; the runtime version is read from the manifest so the
# two never drift.
# ---------------------------------------------------------------------------
linux-flatpak:
name: Build Linux desktop (Flatpak)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- name: Load build versions
shell: bash
run: grep -E '^[A-Za-z_]+=' versions.env >> "$GITHUB_ENV"
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
with:
key: linux-flatpak
- name: Install trunk
uses: taiki-e/install-action@v2
with:
tool: trunk@${{ env.TRUNK_VERSION }}
# WebKitGTK dev libraries to link the Tauri shell (pulls in GTK3, libsoup
# and JavaScriptCore). The tray backend (libappindicator) is dlopened at
# runtime, not linked, so it is not needed at build time.
- name: Install build dependencies
run: sudo apt-get update && sudo apt-get install -y libwebkit2gtk-4.1-dev librsvg2-dev
# The embedded daemon serves the web UI (web-ui feature / rust-embed), so
# the frontend is built before the crate is compiled.
- name: Build frontend
run: cd rucio-web && trunk build --release --public-url ./
- name: Build desktop app
run: cargo build --release -p rucio-tauri
# Ubuntu 24.04 restricts unprivileged user namespaces via AppArmor, which
# breaks bubblewrap (used by flatpak-builder). Re-enable it on the runner.
- name: Allow unprivileged user namespaces
run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
- name: Install Flatpak tooling and the GNOME runtime
run: |
sudo apt-get install -y flatpak flatpak-builder
GNOME_VERSION=$(grep '^runtime-version:' rucio-tauri/flatpak/me.ogarcia.rucio.yml | grep -oE '[0-9]+')
flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install -y --user flathub "org.gnome.Platform//$GNOME_VERSION" "org.gnome.Sdk//$GNOME_VERSION"
- name: Build Flatpak bundle
shell: bash
run: |
flatpak-builder --user --force-clean --repo=repo build-dir \
rucio-tauri/flatpak/me.ogarcia.rucio.yml
BUNDLE=rucio-${{ github.ref_name }}-linux-x86_64.flatpak
flatpak build-bundle repo "$BUNDLE" me.ogarcia.rucio
echo "ARCHIVE=$BUNDLE" >> "$GITHUB_ENV"
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: rucio-linux-flatpak
path: ${{ env.ARCHIVE }}
if-no-files-found: error
# ---------------------------------------------------------------------------
# Create GitHub Release and attach all binaries
# ---------------------------------------------------------------------------
release:
name: GitHub Release
needs: [build, web, windows-desktop, linux-flatpak]
# Only publish on a real tag push. On manual workflow_dispatch this job is
# skipped, so the build/web/windows artifacts are produced for download but
# no release is created.
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v8
with:
path: artifacts
merge-multiple: true
- name: Create release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
draft: false
prerelease: ${{ contains(github.ref_name, '-') }}
generate_release_notes: true
files: artifacts/*