Skip to content

Commit

Permalink
Update ci with gradle rust plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Pururun authored and Rawa committed Dec 18, 2024
1 parent 8b24661 commit 4a5e0c8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 19 deletions.
48 changes: 31 additions & 17 deletions .github/workflows/android-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,19 @@ jobs:
- arch: "x86_64"
abi: "x86_64"
target: "x86_64-linux-android"
task: "cargoBuildX86_64"
- arch: "i686"
abi: "x86"
target: "i686-linux-android"
task: "cargoBuildX86"
- arch: "aarch64"
abi: "arm64-v8a"
target: "aarch64-linux-android"
task: "cargoBuildArm64"
- arch: "armv7"
abi: "armeabi-v7a"
target: "armv7-linux-androideabi"
task: "cargoBuildArm"
steps:
# Fix for HOME path overridden by GH runners when building in containers, see:
# https://github.com/actions/runner/issues/863
Expand Down Expand Up @@ -197,27 +201,28 @@ jobs:
env:
cache_hash: ${{ steps.native-lib-cache-hash.outputs.native_lib_hash }}
with:
path: ./android/app/build/extraJni
path: ./android/app/build/rustJniLibs/android
key: android-native-libs-${{ runner.os }}-${{ matrix.abi }}-${{ env.cache_hash }}

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


- name: Upload native libs
uses: actions/upload-artifact@v4
with:
name: native-libs-${{ matrix.arch }}
path: android/app/build/extraJni
path: android/app/build/rustJniLibs/android
if-no-files-found: error
retention-days: 7

Expand Down Expand Up @@ -290,7 +295,9 @@ jobs:
uses: burrunan/gradle-cache-action@v1
with:
job-id: jdk17
arguments: compileOssProdDebugKotlin
arguments: |
compileOssProdDebugKotlin
-x cargoBuild
gradle-version: wrapper
build-root-directory: android
execution-only-caches: false
Expand All @@ -316,7 +323,7 @@ jobs:
- uses: actions/download-artifact@v4
with:
pattern: native-libs-*
path: android/app/build/extraJni
path: android/app/build/rustJniLibs/android
merge-multiple: true

- uses: actions/download-artifact@v4
Expand All @@ -328,7 +335,9 @@ jobs:
uses: burrunan/gradle-cache-action@v1
with:
job-id: jdk17
arguments: assembleOssProdDebug
arguments: |
assembleOssProdDebug
-x cargoBuild
gradle-version: wrapper
build-root-directory: android
execution-only-caches: true
Expand All @@ -341,7 +350,9 @@ jobs:
if: github.event.inputs.run_firebase_tests == 'true'
with:
job-id: jdk17
arguments: assemblePlayStagemoleDebug
arguments: |
assemblePlayStagemoleDebug
-x cargoBuild
gradle-version: wrapper
build-root-directory: android
execution-only-caches: true
Expand Down Expand Up @@ -396,7 +407,10 @@ jobs:
uses: burrunan/gradle-cache-action@v1
with:
job-id: jdk17
arguments: ${{ matrix.assemble-command }}
arguments: |
${{ matrix.assemble-command }}
-x cargoBuild
-x generateRelayList
gradle-version: wrapper
build-root-directory: android
execution-only-caches: false
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/daemon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
- '!.github/CODEOWNERS'
- '!android/**'
- '!audits/**'
- '!build-apk.sh'
- '!build.sh'
- '!ci/**'
- 'ci/check-rust.sh'
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/testframework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
- '.github/workflows/daemon.yml'
- '!android/**'
- '!audits/**'
- '!build-apk.sh'
- '!build.sh'
- '!ci/**'
- '!clippy.toml'
Expand Down

0 comments on commit 4a5e0c8

Please sign in to comment.