-
Notifications
You must be signed in to change notification settings - Fork 29
268 lines (233 loc) · 8.79 KB
/
Package.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
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
name: Package
on:
workflow_dispatch:
env:
LLVM_VERSION: '10.0'
RUST_TOOLCHAIN: nightly-2024-09-04
NDK_VERSION: 25.2.9519653
FLUTTER_VERSION: '3.24.2'
FLUTTER_CHANNEL: 'stable'
JAVA_VERSION: '17'
jobs:
ci-pass:
name: CI is green
runs-on: ubuntu-latest
needs:
- build_release_assets
steps:
- run: exit 0
build_release_assets:
name: Build release assets
strategy:
fail-fast: false
matrix:
config:
- target: linux
host: ubuntu-latest
- target: windows
host: windows-latest
- target: macos
host: macos-latest
- target: ios
host: macos-latest
- target: android-arm64
host: ubuntu-latest
runs-on: ${{ matrix.config.host }}
env:
TARGET: ${{ matrix.config.target }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: 'kobi'
- name: Cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
components: rustfmt
toolchain: ${{ env.RUST_TOOLCHAIN }}
override: true
- name: Cargo ci build cache
uses: actions/cache@v3
with:
path: |
kobi/ci/target/
key: ${{ runner.os }}-cargo-ci_target
- name: Cache Flutter dependencies (Linux/Android)
if: true && ( matrix.config.target == 'android-arm32' || matrix.config.target == 'android-arm64' || matrix.config.target == 'android-x86_64' || matrix.config.target == 'linux' )
uses: actions/cache@v3
with:
path: /opt/hostedtoolcache/flutter
key: ${{ runner.os }}-flutter
- name: Setup flutter
if: true
uses: subosito/flutter-action@v2
with:
channel: ${{ env.FLUTTER_CHANNEL }}
flutter-version: ${{ env.FLUTTER_VERSION }}
architecture: x64
- name: Install LLVM and Clang (Linux/Android)
if: true && ( matrix.config.target == 'android-arm32' || matrix.config.target == 'android-arm64' || matrix.config.target == 'android-x86_64' || matrix.config.target == 'linux' )
run: |
sudo apt update
sudo apt install -y libclang-dev
- name: Install libfuse2 (Linux)
if: true && matrix.config.target == 'linux'
run: |
sudo apt update
sudo apt install -y libfuse2
- name: Install cargo tools (non-android)
if: true && ( matrix.config.target == 'macos' || matrix.config.target == 'windows' || matrix.config.target == 'linux' )
run: |
cargo install cbindgen
- name: Install cargo tools (Android)
if: true && ( matrix.config.target == 'android-arm32' || matrix.config.target == 'android-arm64' || matrix.config.target == 'android-x86_64' )
run: |
cargo install cargo-ndk
- name: Setup java (Android)
if: true && ( matrix.config.target == 'android-arm32' || matrix.config.target == 'android-arm64' || matrix.config.target == 'android-x86_64' )
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'temurin'
- name: Setup android tools (Android)
if: true && ( matrix.config.target == 'android-arm32' || matrix.config.target == 'android-arm64' || matrix.config.target == 'android-x86_64' )
uses: android-actions/setup-android@v3
with:
cmdline-tools-version: 8512546
packages: 'platform-tools platforms;android-32 build-tools;30.0.2 ndk;23.1.7779620'
- name: Set-Version (All)
if: true
run: |
cd kobi/ci
cp version.code.txt ../lib/assets/version.txt
- name: Cargo native build cache
if: true
uses: actions/cache@v3
with:
path: |
kobi/native/target/
key: ${{ runner.os }}-cargo-native_target-${{ matrix.config.target }}
- name: Install rust target and build (ios)
if: true && ( matrix.config.target == 'ios')
run: |
rustup target install aarch64-apple-ios
cd kobi
flutter pub get
flutter build ios --no-simulator --no-codesign --release
cd build
rm -rf Payload
mkdir Payload
mv ios/iphoneos/Runner.app Payload/
sh ../scripts/thin-payload.sh Payload
zip -r -9 nosign.ipa Payload
cd ..
- name: Upload Asset (All)
if: true && ( matrix.config.target == 'ios')
uses: actions/upload-artifact@v4
with:
name: 'nosign.ipa'
path: 'kobi/build/nosign.ipa'
retention-days: 3
- name: Run (ios-sim)
if: true && ( matrix.config.target == 'ios-sim')
run: |
rustup target install aarch64-apple-ios-sim
rustup target install x86_64-apple-ios
cd kobi
flutter pub get
flutter run
- name: Install rust target and build (Android-arm64)
if: true && ( matrix.config.target == 'android-arm64')
run: |
export ANDROID_NDK_HOME=$ANDROID_HOME/ndk/${{ env.NDK_VERSION }}
rustup target install aarch64-linux-android
cd kobi
flutter build apk --target-platform android-arm64
- name: Sign APK (Android)
if: true && ( matrix.config.target == 'android-arm32' || matrix.config.target == 'android-arm64' || matrix.config.target == 'android-x86_64' )
env:
ANDROID_JKS_BASE64: ${{ secrets.ANDROID_JKS_BASE64 }}
ANDROID_JKS_PASSWORD: ${{ secrets.ANDROID_JKS_PASSWORD }}
run: |
cd kobi
echo $ANDROID_JKS_BASE64 > key.jks.base64
base64 -d key.jks.base64 > key.jks
echo $ANDROID_JKS_PASSWORD | $ANDROID_HOME/build-tools/30.0.2/apksigner sign --ks key.jks build/app/outputs/flutter-apk/app-release.apk
- name: Upload Asset (Android-arm64)
if: true && ( matrix.config.target == 'android-arm64')
uses: actions/upload-artifact@v4
with:
name: 'app-release.apk'
path: 'kobi/build/app/outputs/flutter-apk/app-release.apk'
retention-days: 3
- name: Install dependencies and build (Linux)
if: true && matrix.config.target == 'linux'
run: |
sudo apt-get update
sudo apt install -y ninja-build liblzma-dev libgtk-3-dev libgl1-mesa-dev xorg-dev
curl -JOL https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
chmod a+x appimagetool-x86_64.AppImage
mv appimagetool-x86_64.AppImage appimagetool
cd kobi
flutter pub get
flutter config --enable-linux-desktop
flutter build linux --release
mv build/linux/x64/release/bundle/{kobi,AppRun}
cp linux/appimage/* build/linux/x64/release/bundle/
../appimagetool build/linux/x64/release/bundle/
mv *.AppImage build/linux.AppImage
- name: Upload Asset (linux)
if: true && ( matrix.config.target == 'linux')
uses: actions/upload-artifact@v4
with:
name: 'build.AppImage'
path: 'kobi/build/build.AppImage'
retention-days: 3
- name: build (windows)
if: true && matrix.config.target == 'windows'
run: |
cd kobi
flutter pub get
flutter config --enable-windows-desktop
flutter build windows
cd build/windows/x64/runner/Release
Compress-Archive * ../../../../../build/windows.zip
cd ../../../../..
- name: Upload Asset (windows)
if: true && ( matrix.config.target == 'windows')
uses: actions/upload-artifact@v4
with:
name: 'windows.zip'
path: 'kobi/build/windows.zip'
retention-days: 3
- name: Build (macos)
if: true && matrix.config.target == 'macos'
run: |
cd kobi
flutter pub get
rustup target install x86_64-apple-darwin
rustup target install aarch64-apple-darwin
flutter config --enable-macos-desktop
flutter build macos
cd build
mkdir appimage
mv macos/Build/Products/Release/kobi.app appimage/
ln -sf /Applications appimage/
hdiutil create -volname kobi -srcfolder appimage -ov -format UDBZ macos.dmg
cd ..
- name: Upload Asset (macos)
if: true && ( matrix.config.target == 'macos')
uses: actions/upload-artifact@v4
with:
name: 'macos.dmg'
path: 'kobi/build/macos.dmg'
retention-days: 3