From 345d1ed03fb53193a82b6f8ce37b2131a51d964c Mon Sep 17 00:00:00 2001 From: Ludea Date: Mon, 2 Sep 2024 10:45:08 +0200 Subject: [PATCH] ci: enable android ci --- .github/workflows/android.yml | 84 +++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 .github/workflows/android.yml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 00000000..1606f6a3 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,84 @@ + +name: Android build + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + android_build: + runs-on: "ubuntu-latest" + steps: + - uses: actions/checkout@v4 + - name: Set short sha + shell: bash + run: echo "SHORT_SHA=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV + - name: setup node + uses: actions/setup-node@v4 + with: + node-version: 20 + - uses: dtolnay/rust-toolchain@stable + with: + targets: aarch64-linux-android + - name: install Linux dependencies + run: | + sudo apt-get update + sudo apt-get install -y libgtk-3-dev webkit2gtk-4.1 + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + - name: Setup NDK + uses: nttld/setup-ndk@v1 + id: setup-ndk + with: + ndk-version: r25b + local-cache: true + # TODO check after https://github.com/nttld/setup-ndk/issues/518 is fixed + - name: Restore Android Symlinks + run: | + directory="${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin" + find "$directory" -type l | while read link; do + current_target=$(readlink "$link") + new_target="$directory/$(basename "$current_target")" + ln -sf "$new_target" "$link" + echo "Changed $(basename "$link") from $current_target to $new_target" + done + - name: Install yarn deps + run: yarn + - name: Prettier + run: yarn prettier + - name: Lint + run: yarn lint + - name: Build interface + run: yarn build + - name: fmt + run: cargo fmt --manifest-path src-tauri/Cargo.toml --all -- --check + - name: Clippy + run: cargo clippy --manifest-path=src-tauri/Cargo.toml --all-targets --all-features -- -D warnings + - name: build Apk + run: yarn tauri android build --target aarch64 --split-per-abi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + STRONGHOLD_SALT: ${{ secrets.STRONGHOLD_SALT }} + NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} + - uses: filippoLeporati93/android-release-signer@v1 + name: Sign app APK + id: sign_app + with: + releaseDirectory: src-tauri/gen/android/app/build/outputs/apk/arm64/release/ + signingKeyBase64: ${{ secrets.SIGNING_KEY }} + alias: ${{ secrets.ALIAS }} + keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} + keyPassword: ${{ secrets.KEY_PASSWORD }} + env: + BUILD_TOOLS_VERSION: "34.0.0" + - uses: actions/upload-artifact@v4 + with: + name: Sparus-${{ env.SHORT_SHA }}.zip + path: ${{steps.sign_app.outputs.signedReleaseFile}} + if-no-files-found: error