diff options
| author | Albin <albin@mullvad.net> | 2022-02-01 09:21:12 +0100 |
|---|---|---|
| committer | Albin <albin@mullvad.net> | 2022-02-01 14:38:28 +0100 |
| commit | 62eff4f3cdf02b0279360279bdf0778fda9bd08d (patch) | |
| tree | 5f2f6d21adc552e00d556a179d63e27c9b69ae99 | |
| parent | 821805ab019b9db6b1516239e7a7b7681093c41e (diff) | |
| download | mullvadvpn-62eff4f3cdf02b0279360279bdf0778fda9bd08d.tar.xz mullvadvpn-62eff4f3cdf02b0279360279bdf0778fda9bd08d.zip | |
Cache native libs in Android build
| -rw-r--r-- | .github/workflows/android-app.yml | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/.github/workflows/android-app.yml b/.github/workflows/android-app.yml index a2d58f1246..d340431ddc 100644 --- a/.github/workflows/android-app.yml +++ b/.github/workflows/android-app.yml @@ -30,32 +30,45 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 + - name: Calculate native lib cache hash + id: native-lib-cache-hash + shell: bash + run: | + non_android_hash="$(git grep --cached -l '' -- ':!android/' | xargs -d '\n' sha1sum | sha1sum | awk '{print $1}')" + echo "::set-output name=native_lib_hash::$non_android_hash" + + - name: Cache native libraries + uses: actions/cache@v2 + id: cache-native-libs + with: + path: | + ./android/app/build/extraJni + ./dist-assets/relays.json + ./dist-assets/api-ip-address.txt + key: android-native-libs-${{ runner.os }}-x86_64-${{ steps.native-lib-cache-hash.outputs.native_lib_hash }} + - name: Configure Rust + if: steps.cache-native-libs.outputs.cache-hit != 'true' uses: ATiltedTree/setup-rust@v1.0.4 with: rust-version: stable targets: x86_64-linux-android - name: Configure Go + if: steps.cache-native-libs.outputs.cache-hit != 'true' uses: actions/setup-go@v2.1.3 with: go-version: 1.16 - - name: Configure Android SDK - uses: maxim-lobanov/setup-android-tools@v1 - with: - packages: | - platforms;android-30 - build-tools;30.0.3 - cache: true - - name: Configure Android NDK + if: steps.cache-native-libs.outputs.cache-hit != 'true' id: install-android-ndk uses: nttld/setup-ndk@v1 with: ndk-version: r20b - name: Bind Cargo with NDK + if: steps.cache-native-libs.outputs.cache-hit != 'true' run: | cat >> $HOME/.cargo/config << EOF [target.x86_64-linux-android] @@ -64,6 +77,7 @@ jobs: EOF - name: Build native libraries + if: steps.cache-native-libs.outputs.cache-hit != 'true' env: RUSTFLAGS: --deny warnings NDK_TOOLCHAIN_DIR: ${{ steps.install-android-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin @@ -84,6 +98,14 @@ jobs: cargo run --bin address_cache > dist-assets/api-ip-address.txt $NDK_TOOLCHAIN_STRIP_TOOL --strip-debug --strip-unneeded -o "$STRIPPED_LIB_PATH" "$UNSTRIPPED_LIB_PATH" + - name: Configure Android SDK + uses: maxim-lobanov/setup-android-tools@v1 + with: + packages: | + platforms;android-30 + build-tools;30.0.3 + cache: true + - name: Build Android app uses: burrunan/gradle-cache-action@v1 with: |
