-
Notifications
You must be signed in to change notification settings - Fork 0
486 lines (407 loc) · 15.8 KB
/
build-packages.yml
File metadata and controls
486 lines (407 loc) · 15.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
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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
name: Build Packages
on:
push:
branches:
- main
- master
tags:
- "v*"
pull_request:
workflow_dispatch:
inputs:
publish_release:
description: "Publish downloaded build artifacts to GitHub Releases"
required: false
default: false
type: boolean
release_tag:
description: "Release tag to publish when manually triggering"
required: false
default: ""
type: string
prerelease:
description: "Mark the GitHub Release as a prerelease"
required: false
default: false
type: boolean
permissions:
contents: read
defaults:
run:
shell: bash
env:
BUILD_MODE: release
FLUTTER_VERSION: 3.29.0
jobs:
linux:
name: Linux ${{ matrix.target.package_arch }}
runs-on: ${{ matrix.target.runner }}
strategy:
fail-fast: false
matrix:
target:
- runner: ubuntu-24.04
package_arch: x86_64
flutter_setup: action
- runner: ubuntu-24.04-arm
package_arch: aarch64
flutter_setup: manual
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Flutter
if: matrix.target.flutter_setup == 'action'
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Set up Flutter (manual ARM)
if: matrix.target.flutter_setup == 'manual'
run: |
git clone --depth 1 --branch stable https://github.com/flutter/flutter.git "$RUNNER_TEMP/flutter"
echo "$RUNNER_TEMP/flutter/bin" >> "$GITHUB_PATH"
"$RUNNER_TEMP/flutter/bin/flutter" config --no-analytics
"$RUNNER_TEMP/flutter/bin/flutter" precache --linux
"$RUNNER_TEMP/flutter/bin/flutter" --version
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
libgtk-3-dev \
libsodium-dev \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
libsecret-1-dev \
libayatana-appindicator3-dev \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
ninja-build \
patchelf \
pkg-config \
rpm
- name: Enable Linux desktop
run: flutter config --enable-linux-desktop
- name: Bootstrap dependencies
run: dart run tool/bootstrap_deps.dart
- name: Install Flutter packages
run: flutter pub get
- name: Fix desktop_drop_for_t Linux plugin naming
run: |
# desktop_drop_for_t is a fork of desktop_drop but its Linux plugin
# files still use the old names. Fix the CMake target name and create
# a symlink so the generated #include <desktop_drop_for_t/...> resolves.
PLUGIN_DIR="linux/flutter/ephemeral/.plugin_symlinks/desktop_drop_for_t/linux"
if [ -f "$PLUGIN_DIR/CMakeLists.txt" ]; then
sed -i 's/set(PLUGIN_NAME "desktop_drop_plugin")/set(PLUGIN_NAME "desktop_drop_for_t_plugin")/' "$PLUGIN_DIR/CMakeLists.txt"
sed -i 's/set(desktop_drop_bundled_libraries/set(desktop_drop_for_t_bundled_libraries/' "$PLUGIN_DIR/CMakeLists.txt"
# Header lives under include/desktop_drop/ but registrant expects desktop_drop_for_t/
if [ -d "$PLUGIN_DIR/include/desktop_drop" ] && [ ! -d "$PLUGIN_DIR/include/desktop_drop_for_t" ]; then
ln -s desktop_drop "$PLUGIN_DIR/include/desktop_drop_for_t"
fi
fi
- name: Build Tim2Tox native library
run: bash tool/ci/build_tim2tox.sh --target linux --mode "$BUILD_MODE"
- name: Build Linux bundle
run: flutter build linux --release --dart-define=FLUTTER_BUILD_MODE="$BUILD_MODE"
- name: Package Linux artifacts
env:
TOXEE_PACKAGE_ARCH: ${{ matrix.target.package_arch }}
run: bash tool/ci/package_artifacts.sh --target linux --mode "$BUILD_MODE"
- name: Upload Linux artifacts
uses: actions/upload-artifact@v4
with:
name: toxee-linux-${{ matrix.target.package_arch }}-release
path: dist/linux
if-no-files-found: error
windows:
name: Windows ${{ matrix.target.package_arch }}
runs-on: ${{ matrix.target.runner }}
strategy:
fail-fast: false
matrix:
target:
- runner: windows-2025
package_arch: AMD64
vcpkg_triplet: x64-windows
cmake_arch: x64
tim2tox_windows_arch: x64
flutter_setup: action
- runner: windows-11-arm
package_arch: ARM64
vcpkg_triplet: arm64-windows
cmake_arch: ARM64
tim2tox_windows_arch: arm64
flutter_setup: manual
steps:
- name: Configure Git line endings
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Flutter
if: matrix.target.flutter_setup == 'action'
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Set up Flutter (manual ARM)
if: matrix.target.flutter_setup == 'manual'
shell: pwsh
run: |
git clone --depth 1 --branch stable https://github.com/flutter/flutter.git "$env:RUNNER_TEMP\flutter"
"$env:RUNNER_TEMP\flutter\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
& "$env:RUNNER_TEMP\flutter\bin\flutter.bat" config --no-analytics
& "$env:RUNNER_TEMP\flutter\bin\flutter.bat" precache --windows
& "$env:RUNNER_TEMP\flutter\bin\flutter.bat" --version
- name: Install vcpkg and native dependencies
shell: pwsh
run: |
$vcpkgRoot = Join-Path $env:RUNNER_TEMP "vcpkg"
git clone --depth 1 https://github.com/microsoft/vcpkg $vcpkgRoot
& "$vcpkgRoot\bootstrap-vcpkg.bat" -disableMetrics
& "$vcpkgRoot\vcpkg.exe" install libsodium:${{ matrix.target.vcpkg_triplet }} pthreads:${{ matrix.target.vcpkg_triplet }}
"VCPKG_ROOT=$vcpkgRoot" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Add WiX to PATH
shell: pwsh
run: |
$wixCandidates = @(
"C:\Program Files (x86)\WiX Toolset v3.14\bin",
"C:\Program Files\WiX Toolset v3.14\bin"
)
$wixDir = $wixCandidates | Where-Object { Test-Path (Join-Path $_ "candle.exe") } | Select-Object -First 1
if (-not $wixDir) {
choco install wixtoolset --yes --no-progress
$wixDir = $wixCandidates | Where-Object { Test-Path (Join-Path $_ "candle.exe") } | Select-Object -First 1
}
if (-not $wixDir) {
Write-Error "WiX Toolset v3 was not found after installation."
exit 1
}
echo "$wixDir" >> $env:GITHUB_PATH
- name: Enable Windows desktop
run: flutter config --enable-windows-desktop
- name: Bootstrap dependencies
run: dart run tool/bootstrap_deps.dart
- name: Install Flutter packages
run: flutter pub get
- name: Build Tim2Tox native library
env:
TIM2TOX_WINDOWS_ARCH: ${{ matrix.target.tim2tox_windows_arch }}
run: bash tool/ci/build_tim2tox.sh --target windows --mode "$BUILD_MODE"
- name: Build Windows runner
run: flutter build windows --release --dart-define=FLUTTER_BUILD_MODE="$BUILD_MODE"
- name: Package Windows artifacts
env:
TOXEE_PACKAGE_ARCH: ${{ matrix.target.package_arch }}
run: bash tool/ci/package_artifacts.sh --target windows --mode "$BUILD_MODE"
- name: Upload Windows artifacts
uses: actions/upload-artifact@v4
with:
name: toxee-windows-${{ matrix.target.package_arch }}-release
path: dist/windows
if-no-files-found: error
macos:
name: macOS ${{ matrix.target.package_arch }}
runs-on: ${{ matrix.target.runner }}
strategy:
fail-fast: false
matrix:
target:
- runner: macos-15-intel
package_arch: x86_64
- runner: macos-15
package_arch: arm64
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Install macOS dependencies
run: brew install libsodium
- name: Enable macOS desktop
run: flutter config --enable-macos-desktop
- name: Bootstrap dependencies
run: dart run tool/bootstrap_deps.dart
- name: Install Flutter packages
run: flutter pub get
- name: Build Tim2Tox native library
run: bash tool/ci/build_tim2tox.sh --target macos --mode "$BUILD_MODE"
- name: Build macOS app
run: flutter build macos --release --dart-define=FLUTTER_BUILD_MODE="$BUILD_MODE"
- name: Package macOS artifacts
env:
TOXEE_PACKAGE_ARCH: ${{ matrix.target.package_arch }}
run: bash tool/ci/package_artifacts.sh --target macos --mode "$BUILD_MODE"
- name: Upload macOS artifacts
uses: actions/upload-artifact@v4
with:
name: toxee-macos-${{ matrix.target.package_arch }}-release
path: dist/macos
if-no-files-found: error
android:
name: Android
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: "17"
cache: gradle
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Enable Android support
run: flutter config --enable-android
- name: Install Android native build dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake pkg-config
- name: Bootstrap dependencies
run: dart run tool/bootstrap_deps.dart
- name: Install Flutter packages
run: flutter pub get
- name: Prepare Android signing
env:
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
run: |
if [[ -n "$ANDROID_KEYSTORE_BASE64" && -n "$ANDROID_KEYSTORE_PASSWORD" && -n "$ANDROID_KEY_ALIAS" && -n "$ANDROID_KEY_PASSWORD" ]]; then
echo "$ANDROID_KEYSTORE_BASE64" | base64 --decode > "$RUNNER_TEMP/toxee-release.keystore"
printf 'storeFile=%s\nstorePassword=%s\nkeyAlias=%s\nkeyPassword=%s\n' \
"$RUNNER_TEMP/toxee-release.keystore" \
"$ANDROID_KEYSTORE_PASSWORD" \
"$ANDROID_KEY_ALIAS" \
"$ANDROID_KEY_PASSWORD" \
> android/key.properties
fi
- name: Stage optional Android Tim2Tox JNI libs
env:
TIM2TOX_ANDROID_ABIS: arm64-v8a
run: bash tool/ci/build_tim2tox.sh --target android --mode "$BUILD_MODE"
- name: Build Android APK
run: flutter build apk --release --target-platform android-arm64 --dart-define=FLUTTER_BUILD_MODE="$BUILD_MODE"
- name: Build Android App Bundle
run: flutter build appbundle --release --target-platform android-arm64 --dart-define=FLUTTER_BUILD_MODE="$BUILD_MODE"
- name: Package Android artifacts
run: bash tool/ci/package_artifacts.sh --target android --mode "$BUILD_MODE"
- name: Upload Android artifacts
uses: actions/upload-artifact@v4
with:
name: toxee-android-release
path: dist/android
if-no-files-found: error
ios:
name: iOS
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Install macOS dependencies
run: brew install libsodium coreutils yasm
- name: Enable iOS support
run: flutter config --enable-ios
- name: Bootstrap dependencies
run: dart run tool/bootstrap_deps.dart
- name: Install Flutter packages
run: flutter pub get
- name: Install CocoaPods
run: |
cd ios
pod install
- name: Prepare iOS signing
env:
IOS_CERTIFICATE_P12_BASE64: ${{ secrets.IOS_CERTIFICATE_P12_BASE64 }}
IOS_CERTIFICATE_PASSWORD: ${{ secrets.IOS_CERTIFICATE_PASSWORD }}
IOS_PROVISIONING_PROFILE_BASE64: ${{ secrets.IOS_PROVISIONING_PROFILE_BASE64 }}
IOS_KEYCHAIN_PASSWORD: ${{ secrets.IOS_KEYCHAIN_PASSWORD }}
IOS_SIGNING_IDENTITY: ${{ secrets.IOS_SIGNING_IDENTITY }}
run: |
if [[ -n "$IOS_CERTIFICATE_P12_BASE64" && -n "$IOS_CERTIFICATE_PASSWORD" && -n "$IOS_PROVISIONING_PROFILE_BASE64" ]]; then
bash tool/ci/prepare_ios_signing.sh
fi
- name: Stage optional iOS Tim2Tox artifacts
run: bash tool/ci/build_tim2tox.sh --target ios --mode "$BUILD_MODE"
- name: Build iOS app
run: |
if [[ "${IOS_SIGNING_READY:-false}" == "true" ]]; then
flutter build ios --release --dart-define=FLUTTER_BUILD_MODE="$BUILD_MODE"
else
flutter build ios --release --no-codesign --dart-define=FLUTTER_BUILD_MODE="$BUILD_MODE"
fi
- name: Package iOS artifacts
run: bash tool/ci/package_artifacts.sh --target ios --mode "$BUILD_MODE"
- name: Upload iOS artifacts
uses: actions/upload-artifact@v4
with:
name: toxee-ios-release
path: dist/ios
if-no-files-found: error
publish:
name: Publish GitHub Release
runs-on: ubuntu-24.04
needs:
- linux
- windows
- macos
- android
- ios
if: ${{ startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_release == 'true') }}
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Resolve release metadata
id: release_meta
run: |
release_tag="${GITHUB_REF_NAME:-}"
if [[ "${GITHUB_REF_TYPE:-}" != "tag" ]]; then
release_tag="${{ github.event.inputs.release_tag }}"
fi
if [[ -z "$release_tag" ]]; then
echo "release_tag input is required for manual publish." >&2
exit 1
fi
echo "release_tag=$release_tag" >> "$GITHUB_OUTPUT"
echo "prerelease=${{ github.event.inputs.prerelease || 'false' }}" >> "$GITHUB_OUTPUT"
- name: Download packaged artifacts
uses: actions/download-artifact@v5
with:
pattern: toxee-*-release
path: release-artifacts
merge-multiple: false
- name: Publish GitHub Release
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ steps.release_meta.outputs.release_tag }}
PRERELEASE: ${{ steps.release_meta.outputs.prerelease }}
RELEASE_ARTIFACTS_DIR: ${{ github.workspace }}/release-artifacts
run: bash tool/ci/publish_release.sh