From c2764f90b3eab7ea6bdec755838f9ead6a61c4db Mon Sep 17 00:00:00 2001 From: pierre Date: Wed, 31 May 2023 13:14:44 +0200 Subject: [PATCH] ci(nc-native-android): update github workflow to build unsigned apks --- .github/workflows/connect-android-build.yml | 138 -------------------- .github/workflows/nyms5-android-build.yml | 111 ++++++++++++++++ 2 files changed, 111 insertions(+), 138 deletions(-) delete mode 100644 .github/workflows/connect-android-build.yml create mode 100644 .github/workflows/nyms5-android-build.yml diff --git a/.github/workflows/connect-android-build.yml b/.github/workflows/connect-android-build.yml deleted file mode 100644 index fb8f837268..0000000000 --- a/.github/workflows/connect-android-build.yml +++ /dev/null @@ -1,138 +0,0 @@ -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: ??? diff --git a/.github/workflows/nyms5-android-build.yml b/.github/workflows/nyms5-android-build.yml new file mode 100644 index 0000000000..f4044ea8dc --- /dev/null +++ b/.github/workflows/nyms5-android-build.yml @@ -0,0 +1,111 @@ +name: Nyms5 APK build +# unsigned debug APKs only, supported archs: +# - x86_64 +# - arm64-v8a + +on: + workflow_dispatch: + push: + branches: + - "release/nyms5-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.2.9519653 + NDK_HOME: ${{ github.workspace }}/android-sdk/ndk/25.2.9519653 + SDK_PLATFORM_VERSION: android-33 + SDK_BUILDTOOLS_VERSION: 33.0.2 + + steps: + - 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 + + - name: Install rust android targets + run: | + rustup target add aarch64-linux-android \ + x86_64-linux-android + # armv7-linux-androideabi \ + # i686-linux-android \ + + - name: Clean android project + working-directory: nym-connect/native/android + env: + RELEASE: true + run: | + rm nym-connect/native/android/app/src/main/jniLibs/arm64-v8a/libnym_socks5_listener.so || true + rm nym-connect/native/android/app/src/main/jniLibs/x86_64/libnym_socks5_listener.so || true + + - name: Build lib nym-socks5-listener + working-directory: sdk/lib/socks5-listener/ + env: + RELEASE: true + run: ./build-android.sh + + - name: Build APK (debug) + working-directory: nym-connect/native/android + env: + ANDROID_SDK_ROOT: ${{ env.ANDROID_HOME }} + run: ./gradlew :app:assembleDebug + + - name: Prepare APKs + run: | + mkdir apk/ + mv nym-connect/native/android/app/build/outputs/apk/debug/app-arm64-v8a-debug.apk \ + apk/nyms5-arm64-debug.apk + mv nym-connect/native/android/app/build/outputs/apk/debug/app-x86_64-debug.apk \ + apk/nyms5-x86_64-debug.apk + + - name: Upload APKs + uses: actions/upload-artifact@v3 + with: + name: nyms5-apk-debug + path: | + apk/nyms5-arm64-debug.apk + apk/nyms5-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: ???