-
Notifications
You must be signed in to change notification settings - Fork 9
186 lines (160 loc) · 6.33 KB
/
build.yml
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
name: "Build"
on:
workflow_call: {} # Allow this workflow to be called by other workflows
pull_request:
push:
jobs:
build-tauri:
strategy:
fail-fast: false
matrix:
include:
- platform: "ubuntu-22.04"
args: ""
# Commenting out other builds temporarily for testing
# - platform: "macos-latest"
# args: "--target aarch64-apple-darwin"
# - platform: "macos-latest"
# args: "--target x86_64-apple-darwin"
# Android builds with correct target names
- platform: "ubuntu-22.04"
android: true
android_target: "aarch64"
abi: "arm64-v8a"
- platform: "ubuntu-22.04"
android: true
android_target: "armv7"
abi: "armeabi-v7a"
- platform: "ubuntu-22.04"
android: true
android_target: "x86_64"
abi: "x86_64"
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
# Add Rust cache
- uses: Swatinem/rust-cache@v2
with:
shared-key: "${{ runner.os }}-rust-${{ matrix.android && 'android' || 'desktop' }}"
# Add Bun cache
- name: Cache bun dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-
# Add Android NDK cache (only for Android builds)
- name: Cache Android NDK
if: matrix.android
uses: actions/cache@v4
with:
path: /usr/local/lib/android/sdk/ndk/25.2.9519653
key: ${{ runner.os }}-ndk-25.2.9519653
- name: Set up JDK 17
if: matrix.android
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04' && !matrix.android
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf \
libfuse2 fuse libglib2.0-dev libcairo2-dev libpango1.0-dev \
libasound2-dev libgtk-3-dev desktop-file-utils
- name: Setup Android SDK
if: matrix.android
uses: android-actions/setup-android@v3
- name: Install Android NDK
if: matrix.android
run: |
sdkmanager --install "ndk;25.2.9519653"
echo "ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk/25.2.9519653" >> $GITHUB_ENV
echo "NDK_HOME=$ANDROID_SDK_ROOT/ndk/25.2.9519653" >> $GITHUB_ENV
- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.39
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Add Rust Android targets
if: matrix.android
run: |
rustup target add aarch64-linux-android
rustup target add armv7-linux-androideabi
rustup target add x86_64-linux-android
- name: Install frontend dependencies
run: bun install
- name: Import GPG key
if: matrix.platform == 'ubuntu-22.04' && !matrix.android
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Setup Android signing
if: matrix.android
run: |
cd src-tauri/gen/android
echo "keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}" > keystore.properties
echo "password=${{ secrets.ANDROID_KEY_PASSWORD }}" >> keystore.properties
base64 -d <<< "${{ secrets.ANDROID_KEY_BASE64 }}" > $RUNNER_TEMP/keystore.jks
echo "storeFile=$RUNNER_TEMP/keystore.jks" >> keystore.properties
# Split the build step into two different actions based on the target
- name: Build Desktop App
if: ${{ !matrix.android }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LDAI_SIGN: false # Disable signing temporarily to test build
# LDAI_SIGN: ${{ matrix.platform == 'ubuntu-22.04' }}
# LDAI_SIGN_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
# LDAI_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
# Remove old env vars
# SIGN: false
# SIGN_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
# APPIMAGETOOL_SIGN_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
APPIMAGETOOL_FORCE_SIGN: 0
RUST_BACKTRACE: 1
TAURI_BUILD_DEBUG: true
run: |
# Print system information
echo "System dependencies:"
ldconfig -p | grep -E 'libfuse|libglib|libgtk|libwebkit'
echo "Directory structure before build:"
ls -la
# Run build with verbose output
bun tauri build --verbose
echo "Build script output directory:"
ls -la src-tauri/target/release/bundle/appimage/
echo "Build script contents:"
cat src-tauri/target/release/bundle/appimage/build_appimage.sh || echo "Build script not found"
echo "AppImage tool version:"
if [ -f /usr/local/bin/appimagetool ]; then
/usr/local/bin/appimagetool --version
fi
- name: Build Android universal binary
if: matrix.android
run: |
bun tauri android build
- name: Build Android arch specific binaries
if: matrix.android
run: |
bun tauri android build --target ${{ matrix.android_target }}
- name: List Android build outputs
if: matrix.android
run: |
find src-tauri/gen/android/app/build/outputs/apk/*/release/*.apk -type f
find src-tauri/gen/android/app/build/outputs/bundle/universalRelease/*.aab -type f
- name: Upload Android artifacts
if: matrix.android
uses: actions/upload-artifact@v3
with:
name: android-artifacts-${{ matrix.abi }}
path: |
src-tauri/gen/android/app/build/outputs/apk/${{ matrix.abi }}/release/*.apk
src-tauri/gen/android/app/build/outputs/bundle/universalRelease/*.aab