summaryrefslogtreecommitdiffhomepage
path: root/.github/workflows
diff options
context:
space:
mode:
authorAlbin <albin@mullvad.net>2022-10-26 15:56:48 +0200
committerAlbin <albin@mullvad.net>2022-10-31 08:25:46 +0100
commit9a4af158c4e32ca9edf72ba1f9634d3b9f1d429d (patch)
treebe48aded2c0d5407ebf4caa0d02f00eb98e5df58 /.github/workflows
parent20d563284f5edc5634e10ec648de1c79b5bd9ddd (diff)
downloadmullvadvpn-9a4af158c4e32ca9edf72ba1f9634d3b9f1d429d.tar.xz
mullvadvpn-9a4af158c4e32ca9edf72ba1f9634d3b9f1d429d.zip
Build android app using container in gh actions
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/android-app.yml56
1 files changed, 8 insertions, 48 deletions
diff --git a/.github/workflows/android-app.yml b/.github/workflows/android-app.yml
index 8f4740de71..566121c3fa 100644
--- a/.github/workflows/android-app.yml
+++ b/.github/workflows/android-app.yml
@@ -25,15 +25,17 @@ on:
jobs:
build:
runs-on: ubuntu-latest
+ container:
+ image: ghcr.io/mullvad/mullvadvpn-app-build-android@sha256:2efed8ce625375c3e60574bb4d35b0d80d7100ae8b5773d144812c7680ac247b
steps:
+ # Fix for HOME path overridden by GH runners when building in containers, see:
+ # https://github.com/actions/runner/issues/863
+ - name: Fix HOME path
+ run: echo "HOME=/root" >> $GITHUB_ENV
+
- name: Checkout repository
uses: actions/checkout@v2
- - name: Install Protoc
- uses: arduino/setup-protoc@v1
- with:
- repo-token: ${{ secrets.GITHUB_TOKEN }}
-
- name: Calculate native lib cache hash
id: native-lib-cache-hash
shell: bash
@@ -51,65 +53,23 @@ jobs:
./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: actions-rs/toolchain@v1.0.6
- with:
- toolchain: stable
- target: x86_64-linux-android
- default: true
-
- - name: Configure Go
- if: steps.cache-native-libs.outputs.cache-hit != 'true'
- uses: actions/setup-go@v3
- with:
- go-version: 1.18.5
-
- - 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]
- ar = "${{ steps.install-android-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android-ar"
- linker = "${{ steps.install-android-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android21-clang"
- 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
- AR_x86_64_linux_android: ${{ steps.install-android-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android-ar
- CC_x86_64_linux_android: ${{ steps.install-android-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android21-clang
ABI: x86_64
TARGET: x86_64-linux-android
BUILD_TYPE: debug
run: |
ARCHITECTURES="$ABI"
- UNSTRIPPED_LIB_PATH="./target/$TARGET/$BUILD_TYPE/libmullvad_jni.so"
+ UNSTRIPPED_LIB_PATH="$CARGO_TARGET_DIR/$TARGET/$BUILD_TYPE/libmullvad_jni.so"
STRIPPED_LIB_PATH="./android/app/build/extraJni/$ABI/libmullvad_jni.so"
NDK_TOOLCHAIN_STRIP_TOOL="$NDK_TOOLCHAIN_DIR/x86_64-linux-android-strip"
./wireguard/build-wireguard-go.sh --android --no-docker
- source env.sh $TARGET
cargo build --target $TARGET --verbose --package mullvad-jni
cargo run --bin relay_list > dist-assets/relays.json
$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: