name: Nym Connect - Android APK Build on: workflow_dispatch: push: branches: - "release/nc-android-v[0-9].[0-9].[0-9]*" jobs: build: name: Build APK runs-on: custom-runner-linux env: ANDROID_HOME: ${{ github.workspace }}/android-sdk NDK_VERSION: 25.1.8937393 NDK_HOME: ${{ github.workspace }}/android-sdk/ndk/25.1.8937393 SDK_PLATFORM_VERSION: android-33 SDK_BUILDTOOLS_VERSION: 33.0.1 steps: - name: Install Dependencies (Linux) # https://next--tauri.netlify.app/next/guides/getting-started/prerequisites/linux/#1-system-dependencies run: | sudo apt-get update sudo apt-get -y install \ build-essential \ unzip \ curl \ wget \ libssl-dev \ squashfs-tools \ librsvg2-dev - name: Checkout uses: actions/checkout@v3 - name: Install Java uses: actions/setup-java@v3 with: distribution: "temurin" java-version: "17" - name: Install Android SDK manager # https://developer.android.com/studio/command-line/sdkmanager run: | curl -sS https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip -o cmdline-tools.zip unzip cmdline-tools.zip mkdir -p $ANDROID_HOME/cmdline-tools/latest mv cmdline-tools/* $ANDROID_HOME/cmdline-tools/latest rm -rf cmdline-tools - name: Install Android S/NDK run: | echo y | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses echo y | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager \ "platforms;$SDK_PLATFORM_VERSION" \ "platform-tools" \ "ndk;$NDK_VERSION" \ "build-tools;$SDK_BUILDTOOLS_VERSION" - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable # TODO this step takes a considerable amount of time # We could avoid to compile from source tauri-cli and use instead # pre-compiled binary provided by the node package `@tauri-apps/cli` # But when using the later the build fails for some reason # so keep installing and using tauri-cli - name: Install tauri cli run: cargo install tauri-cli --version "^2.0.0-alpha.2" - name: Install rust android targets run: | rustup target add aarch64-linux-android \ armv7-linux-androideabi \ i686-linux-android \ x86_64-linux-android - name: Setup Nodejs uses: actions/setup-node@v3 with: node-version: 18 - name: Install yarn run: | npm i -g yarn yarn --version - name: Build frontend code run: | yarn install --frozen-lockfile yarn build yarn workspace @nym/nym-connect-mobile webpack:prod - name: Build APK working-directory: nym-connect/mobile env: # NODE_TAURI_CLI=${{ github.workspace }}/nym-connect/mobile/node_modules/.bin/tauri ANDROID_SDK_ROOT: ${{ env.ANDROID_HOME }} WRY_ANDROID_PACKAGE: net.nymtech.nym_connect WRY_ANDROID_LIBRARY: nym_connect # TODO build with release profile (--release), it will requires # to sign the APK. For now build with debug profile to avoid that # TODO build using `yarn tauri`, provide NODE_TAURI_CLI, see TODO notes above run: cargo tauri android build --debug --apk --split-per-abi -t aarch64 # TODO add the version number to APK name - name: Rename APK artifact run: | mkdir apk/ mv nym-connect/mobile/src-tauri/gen/android/nym_connect/app/build/outputs/apk/arm64/debug/app-arm64-debug.apk \ apk/nym-connect-arm64-debug.apk mv nym-connect/mobile/src-tauri/gen/android/nym_connect/app/build/outputs/apk/x86_64/debug/app-x86_64-debug.apk \ apk/nym-connect-x86_64-debug.apk - name: Upload APK artifact uses: actions/upload-artifact@v3 with: name: nc-apk-debug path: | apk/nym-connect-arm64-debug.apk apk/nym-connect-x86_64-debug.apk # publish: # name: Publish APK # needs: build # runs-on: ubuntu-latest # steps: # - name: Checkout # uses: actions/checkout@v3 # - name: Download binary artifact # uses: actions/download-artifact@v3 # with: # name: nc-apk-debug # path: apk # # TODO add a step to upload the APK somewhere # - name: Publish # uses: ???