diff options
| author | Jonatan Rhodin <jonatan.rhodin@mullvad.net> | 2025-01-08 09:33:44 +0100 |
|---|---|---|
| committer | Jonatan Rhodin <jonatan.rhodin@mullvad.net> | 2025-01-08 10:48:48 +0100 |
| commit | 1c1ca559b69810904538c2e46c2326d2ebcaa014 (patch) | |
| tree | e42cb4535910bdeeb25018786035a21130e5ff31 /.github | |
| parent | ac9ac4b824b62d60f64be46f69a4678152d64fb5 (diff) | |
| download | mullvadvpn-1c1ca559b69810904538c2e46c2326d2ebcaa014.tar.xz mullvadvpn-1c1ca559b69810904538c2e46c2326d2ebcaa014.zip | |
Add gradle rust plugin
Diffstat (limited to '.github')
| -rw-r--r-- | .github/workflows/android-app.yml | 85 | ||||
| -rw-r--r-- | .github/workflows/daemon.yml | 1 | ||||
| -rw-r--r-- | .github/workflows/testframework.yml | 1 |
3 files changed, 45 insertions, 42 deletions
diff --git a/.github/workflows/android-app.yml b/.github/workflows/android-app.yml index 5e784b5d69..a035439ead 100644 --- a/.github/workflows/android-app.yml +++ b/.github/workflows/android-app.yml @@ -98,7 +98,7 @@ jobs: retention-days: 7 generate-relay-list: - name: Generate relay list + name: Generate relay list # Used by wait for jobs. needs: prepare runs-on: ubuntu-latest container: @@ -129,11 +129,8 @@ jobs: - name: Generate if: steps.cache-relay-list.outputs.cache-hit != 'true' - env: - RUSTFLAGS: --deny warnings - run: | - mkdir -p android/app/build/extraAssets - cargo run --bin relay_list > android/app/build/extraAssets/relays.json + shell: bash + run: ./android/gradlew -p android generateRelayList - name: Upload uses: actions/upload-artifact@v4 @@ -144,7 +141,7 @@ jobs: retention-days: 7 build-native: - name: Build native + name: Build native # Used by wait for jobs. needs: prepare runs-on: ubuntu-latest container: @@ -152,18 +149,14 @@ jobs: strategy: matrix: include: - - arch: "x86_64" - abi: "x86_64" - target: "x86_64-linux-android" - - arch: "i686" - abi: "x86" - target: "i686-linux-android" - - arch: "aarch64" - abi: "arm64-v8a" - target: "aarch64-linux-android" - - arch: "armv7" - abi: "armeabi-v7a" - target: "armv7-linux-androideabi" + - abi: "x86_64" + task-variant: "X86_64" + - abi: "x86" + task-variant: "X86" + - abi: "arm64-v8a" + task-variant: "Arm64" + - abi: "armeabi-v7a" + task-variant: "Arm" steps: # Fix for HOME path overridden by GH runners when building in containers, see: # https://github.com/actions/runner/issues/863 @@ -197,27 +190,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: cargoBuild${{ matrix.task-variant }} + 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 + name: native-libs-${{ matrix.abi }} + path: android/app/build/rustJniLibs/android if-no-files-found: error retention-days: 7 @@ -290,7 +284,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 @@ -299,24 +295,26 @@ jobs: read-only: ${{ github.ref != 'refs/heads/main' }} - name: Wait for other jobs (native, relay list) - uses: kachick/wait-other-jobs@v2.0.3 + uses: kachick/wait-other-jobs@v3.6.0 with: + wait-seconds-before-first-polling: '0' wait-list: | [ { "workflowFile": "android-app.yml", - "jobName": "build-native" + "jobMatchMode": "prefix", + "jobName": "Build native" }, { "workflowFile": "android-app.yml", - "jobName": "generate-relay-list" + "jobName": "Generate relay list" } ] - 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 @@ -328,7 +326,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 @@ -341,7 +341,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 @@ -396,7 +398,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 diff --git a/.github/workflows/daemon.yml b/.github/workflows/daemon.yml index 2b6241d76f..2727d6697b 100644 --- a/.github/workflows/daemon.yml +++ b/.github/workflows/daemon.yml @@ -10,7 +10,6 @@ on: - '!.github/CODEOWNERS' - '!android/**' - '!audits/**' - - '!build-apk.sh' - '!build.sh' - '!ci/**' - 'ci/check-rust.sh' diff --git a/.github/workflows/testframework.yml b/.github/workflows/testframework.yml index f8d729d271..288aee4273 100644 --- a/.github/workflows/testframework.yml +++ b/.github/workflows/testframework.yml @@ -10,7 +10,6 @@ on: - '.github/workflows/daemon.yml' - '!android/**' - '!audits/**' - - '!build-apk.sh' - '!build.sh' - '!ci/**' - '!clippy.toml' |
