draft: test android build #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: android-build | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize | |
| concurrency: | |
| group: '${{ github.workflow }}-${{ github.head_ref || github.run_id }}' | |
| cancel-in-progress: true | |
| jobs: | |
| build-android: | |
| name: 'build android ${{ matrix.arch }}' | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 90 | |
| strategy: | |
| matrix: | |
| arch: [aarch64, x86_64] | |
| fail-fast: false | |
| steps: | |
| - name: Configure git | |
| run: | | |
| git config --global core.symlinks true | |
| git config --global fetch.parallel 32 | |
| - name: Clone repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 5 | |
| submodules: false | |
| - name: Clone submodule ./tests/util/std | |
| run: git submodule update --init --recursive --depth=1 -- ./tests/util/std | |
| - name: Cache Cargo home | |
| uses: cirruslabs/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/.crates.toml | |
| ~/.cargo/.crates2.json | |
| ~/.cargo/bin | |
| ~/.cargo/registry/index | |
| ~/.cargo/registry/cache | |
| ~/.cargo/git/db | |
| key: 'cargo-home-android-${{ matrix.arch }}-${{ hashFiles(''Cargo.lock'') }}' | |
| restore-keys: 'cargo-home-android-${{ matrix.arch }}-' | |
| - uses: dsherret/rust-toolchain-file@v1 | |
| - name: Install Android NDK | |
| uses: nttld/setup-ndk@v1 | |
| with: | |
| ndk-version: r27c | |
| - name: Add Android targets | |
| run: | | |
| rustup target add ${{ matrix.arch }}-linux-android | |
| - name: Set up Android build environment | |
| run: | | |
| echo "ANDROID_NDK_ROOT=$ANDROID_NDK_HOME" >> $GITHUB_ENV | |
| echo "NDK_HOME=$ANDROID_NDK_HOME" >> $GITHUB_ENV | |
| # Add NDK toolchain to PATH | |
| echo "$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin" >> $GITHUB_PATH | |
| # Set up CMake toolchain | |
| echo "CMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake" >> $GITHUB_ENV | |
| - name: Build for Android | |
| env: | |
| CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER: aarch64-linux-android24-clang | |
| CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER: x86_64-linux-android24-clang | |
| CC_aarch64_linux_android: aarch64-linux-android24-clang | |
| CXX_aarch64_linux_android: aarch64-linux-android24-clang++ | |
| AR_aarch64_linux_android: llvm-ar | |
| CC_x86_64_linux_android: x86_64-linux-android24-clang | |
| CXX_x86_64_linux_android: x86_64-linux-android24-clang++ | |
| AR_x86_64_linux_android: llvm-ar | |
| run: | | |
| cargo build --target ${{ matrix.arch }}-linux-android --locked | |
| - name: Verify binary exists | |
| run: | | |
| ls -lh target/${{ matrix.arch }}-linux-android/debug/deno |