Skip to content

Commit 6786224

Browse files
committed
Update ci with gradle rust plugin
1 parent 0e885e0 commit 6786224

File tree

3 files changed

+31
-19
lines changed

3 files changed

+31
-19
lines changed

.github/workflows/android-app.yml

+31-17
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,19 @@ jobs:
155155
- arch: "x86_64"
156156
abi: "x86_64"
157157
target: "x86_64-linux-android"
158+
task: "cargoBuildX86_64"
158159
- arch: "i686"
159160
abi: "x86"
160161
target: "i686-linux-android"
162+
task: "cargoBuildX86"
161163
- arch: "aarch64"
162164
abi: "arm64-v8a"
163165
target: "aarch64-linux-android"
166+
task: "cargoBuildArm64"
164167
- arch: "armv7"
165168
abi: "armeabi-v7a"
166169
target: "armv7-linux-androideabi"
170+
task: "cargoBuildArm"
167171
steps:
168172
# Fix for HOME path overridden by GH runners when building in containers, see:
169173
# https://github.com/actions/runner/issues/863
@@ -197,27 +201,28 @@ jobs:
197201
env:
198202
cache_hash: ${{ steps.native-lib-cache-hash.outputs.native_lib_hash }}
199203
with:
200-
path: ./android/app/build/extraJni
204+
path: ./android/app/build/rustJniLibs/android
201205
key: android-native-libs-${{ runner.os }}-${{ matrix.abi }}-${{ env.cache_hash }}
202206

203207
- name: Build native libraries
204208
if: steps.cache-native-libs.outputs.cache-hit != 'true'
205-
env:
206-
RUSTFLAGS: --deny warnings
207-
BUILD_TYPE: debug
208-
run: |
209-
ARCHITECTURES="${{ matrix.abi }}"
210-
UNSTRIPPED_LIB_PATH="$CARGO_TARGET_DIR/${{ matrix.target }}/$BUILD_TYPE/libmullvad_jni.so"
211-
STRIPPED_LIB_PATH="./android/app/build/extraJni/${{ matrix.abi }}/libmullvad_jni.so"
212-
NDK_TOOLCHAIN_STRIP_TOOL="$NDK_TOOLCHAIN_DIR/llvm-strip"
213-
cargo build --target ${{ matrix.target }} --verbose --package mullvad-jni --features api-override
214-
$NDK_TOOLCHAIN_STRIP_TOOL --strip-debug --strip-unneeded -o "$STRIPPED_LIB_PATH" "$UNSTRIPPED_LIB_PATH"
209+
uses: burrunan/gradle-cache-action@v1
210+
with:
211+
job-id: jdk17
212+
arguments: ${{ matrix.task }}
213+
gradle-version: wrapper
214+
build-root-directory: android
215+
execution-only-caches: false
216+
# Disable if logs are hard to follow.
217+
concurrent: true
218+
read-only: ${{ github.ref != 'refs/heads/main' }}
219+
215220

216221
- name: Upload native libs
217222
uses: actions/upload-artifact@v4
218223
with:
219224
name: native-libs-${{ matrix.arch }}
220-
path: android/app/build/extraJni
225+
path: android/app/build/rustJniLibs/android
221226
if-no-files-found: error
222227
retention-days: 7
223228

@@ -290,7 +295,9 @@ jobs:
290295
uses: burrunan/gradle-cache-action@v1
291296
with:
292297
job-id: jdk17
293-
arguments: compileOssProdDebugKotlin
298+
arguments: |
299+
compileOssProdDebugKotlin
300+
-x cargoBuild
294301
gradle-version: wrapper
295302
build-root-directory: android
296303
execution-only-caches: false
@@ -316,7 +323,7 @@ jobs:
316323
- uses: actions/download-artifact@v4
317324
with:
318325
pattern: native-libs-*
319-
path: android/app/build/extraJni
326+
path: android/app/build/rustJniLibs/android
320327
merge-multiple: true
321328

322329
- uses: actions/download-artifact@v4
@@ -328,7 +335,9 @@ jobs:
328335
uses: burrunan/gradle-cache-action@v1
329336
with:
330337
job-id: jdk17
331-
arguments: assembleOssProdDebug
338+
arguments: |
339+
assembleOssProdDebug
340+
-x cargoBuild
332341
gradle-version: wrapper
333342
build-root-directory: android
334343
execution-only-caches: true
@@ -341,7 +350,9 @@ jobs:
341350
if: github.event.inputs.run_firebase_tests == 'true'
342351
with:
343352
job-id: jdk17
344-
arguments: assemblePlayStagemoleDebug
353+
arguments: |
354+
assemblePlayStagemoleDebug
355+
-x cargoBuild
345356
gradle-version: wrapper
346357
build-root-directory: android
347358
execution-only-caches: true
@@ -396,7 +407,10 @@ jobs:
396407
uses: burrunan/gradle-cache-action@v1
397408
with:
398409
job-id: jdk17
399-
arguments: ${{ matrix.assemble-command }}
410+
arguments: |
411+
${{ matrix.assemble-command }}
412+
-x cargoBuild
413+
-x generateRelayList
400414
gradle-version: wrapper
401415
build-root-directory: android
402416
execution-only-caches: false

.github/workflows/daemon.yml

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ on:
1010
- '!.github/CODEOWNERS'
1111
- '!android/**'
1212
- '!audits/**'
13-
- '!build-apk.sh'
1413
- '!build.sh'
1514
- '!ci/**'
1615
- 'ci/check-rust.sh'

.github/workflows/testframework.yml

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ on:
1010
- '.github/workflows/daemon.yml'
1111
- '!android/**'
1212
- '!audits/**'
13-
- '!build-apk.sh'
1413
- '!build.sh'
1514
- '!ci/**'
1615
- '!clippy.toml'

0 commit comments

Comments
 (0)