-
Notifications
You must be signed in to change notification settings - Fork 0
258 lines (216 loc) · 8.29 KB
/
Copy pathbuild.yml
File metadata and controls
258 lines (216 loc) · 8.29 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
name: Build Clients
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
permissions:
contents: read
jobs:
# ── Linux CLI ────────────────────────────────────────────────────────────────
linux-cli:
name: Linux CLI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: linux-cli-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: linux-cli-cargo-
- name: Install build dependencies
run: sudo apt-get update -q && sudo apt-get install -y cmake pkg-config rpm
- name: Build
run: cargo build --release -p linux-vpn
- name: Install FPM
run: sudo gem install fpm
- name: Package DEB and RPM
run: |
VERSION="0.1.0"
mkdir -p dist
fpm -s dir -t deb -n mavi-vpn-cli -v $VERSION \
--after-install gui/src-tauri/linux/postinst \
--before-remove gui/src-tauri/linux/prerm \
--conflicts mavi-vpn \
--replaces mavi-vpn \
--description "Mavi VPN Background Service" \
-p dist/mavi-vpn-cli_${VERSION}_amd64.deb \
target/release/mavi-vpn=/usr/local/bin/mavi-vpn \
linux/mavi-vpn.service=/lib/systemd/system/mavi-vpn.service
fpm -s dir -t rpm -n mavi-vpn-cli -v $VERSION \
--after-install gui/src-tauri/linux/postinst \
--before-remove gui/src-tauri/linux/prerm \
--conflicts mavi-vpn \
--description "Mavi VPN Background Service" \
-p dist/mavi-vpn-cli-${VERSION}-1.x86_64.rpm \
target/release/mavi-vpn=/usr/local/bin/mavi-vpn \
linux/mavi-vpn.service=/lib/systemd/system/mavi-vpn.service
- uses: actions/upload-artifact@v4
with:
name: linux-cli
path: |
target/release/mavi-vpn
dist/*.deb
dist/*.rpm
# ── Android APK ──────────────────────────────────────────────────────────────
android-apk:
name: Android APK
runs-on: ubuntu-latest
env:
NDK_VERSION: 28.1.13356709
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Install Android NDK
run: |
echo "y" | ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "ndk;${NDK_VERSION}"
echo "ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk/${NDK_VERSION}" >> $GITHUB_ENV
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/bin/cargo-ndk
target/
key: android-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: android-cargo-
- name: Install cargo-ndk
run: which cargo-ndk || cargo install cargo-ndk --locked
- name: Build APK (debug)
working-directory: android
run: |
chmod +x gradlew
./gradlew assembleDebug
- uses: actions/upload-artifact@v4
with:
name: android-apk
path: android/app/build/outputs/apk/debug/*.apk
# ── Linux GUI (Tauri) ─────────────────────────────────────────────────────────
linux-gui:
name: Linux GUI (Tauri)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: actions/setup-node@v6
with:
node-version: 20
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: linux-gui-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: linux-gui-cargo-
- name: Install Tauri system dependencies
run: |
sudo apt-get update -q
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
build-essential \
cmake \
pkg-config \
libssl-dev \
libglib2.0-dev \
libxdo-dev \
libayatana-appindicator3-dev \
librsvg2-dev
- name: Build Linux CLI & Service
run: cargo build --release -p linux-vpn
- name: Install npm dependencies
working-directory: gui
run: npm ci
- name: Build Tauri app
working-directory: gui
run: npm run tauri -- build
- uses: actions/upload-artifact@v4
with:
name: linux-gui
path: |
target/release/bundle/deb/*.deb
target/release/bundle/rpm/*.rpm
# ── Windows GUI (Tauri) ───────────────────────────────────────────────────────
windows-gui:
name: Windows GUI (Tauri)
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: actions/setup-node@v6
with:
node-version: 20
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: windows-gui-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: windows-gui-cargo-
- name: Build Windows CLI & Service
run: cargo build --release -p windows-vpn
- name: Stage binaries for WiX
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path "gui\src-tauri\wix_binaries" | Out-Null
Copy-Item "target\release\mavi-vpn-client.exe" "gui\src-tauri\wix_binaries\mavi-vpn-client.exe"
Copy-Item "target\release\mavi-vpn-service.exe" "gui\src-tauri\wix_binaries\mavi-vpn-service.exe"
Write-Host "Binaries staged."
- name: Patch service.wxs with absolute paths
shell: pwsh
run: |
$clientPath = (Resolve-Path "gui\src-tauri\wix_binaries\mavi-vpn-client.exe").Path
$servicePath = (Resolve-Path "gui\src-tauri\wix_binaries\mavi-vpn-service.exe").Path
$wxs = Get-Content "gui\src-tauri\wix\service.wxs" -Raw
$wxs = $wxs -replace '__CLIENT_EXE_PATH__', $clientPath
$wxs = $wxs -replace '__SERVICE_EXE_PATH__', $servicePath
Set-Content "gui\src-tauri\wix\service.wxs" $wxs
Write-Host "service.wxs patched."
- name: Install npm dependencies
working-directory: gui
run: npm ci
- name: Build Tauri app (NSIS + MSI)
working-directory: gui
run: npm run tauri -- build --bundles nsis,msi
- name: Restore service.wxs template
if: always()
shell: pwsh
run: |
$wxs = Get-Content "gui\src-tauri\wix\service.wxs" -Raw
$wxs = $wxs -replace 'Source="[^"]*mavi-vpn-client\.exe"', 'Source="__CLIENT_EXE_PATH__"'
$wxs = $wxs -replace 'Source="[^"]*mavi-vpn-service\.exe"', 'Source="__SERVICE_EXE_PATH__"'
Set-Content "gui\src-tauri\wix\service.wxs" $wxs
Write-Host "service.wxs restored."
- uses: actions/upload-artifact@v4
with:
name: windows-builds
path: |
target/release/bundle/nsis/*.exe
target/release/bundle/msi/*.msi
target/release/mavi-vpn-client.exe
target/release/mavi-vpn-service.exe
windows/wintun.dll