chore(ci): update rust workflow to run in various architectures #5
This file contains 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: Rust | ||
on: | ||
push: | ||
branches: [ "main" ] | ||
paths-ignore: | ||
- "*.md" | ||
- "LICENSE" | ||
pull_request: | ||
branches: [ "main" ] | ||
paths-ignore: | ||
- "*.md" | ||
- "LICENSE" | ||
env: | ||
CARGO_TERM_COLOR: always | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
ANDROID_NDK_VERSION: "25.1.8937393" | ||
ANDROID_API_LEVEL: 21 # Minimum API level for supported architectures | ||
strategy: | ||
matrix: | ||
target: | ||
- aarch64-linux-android # 64-bit ARM | ||
- armv7-linux-androideabi # 32-bit ARM | ||
- i686-linux-android # 32-bit x86 | ||
- x86_64-linux-android # 64-bit x86 | ||
- arm-linux-androideabi # 32-bit ARM (older ABI) | ||
- thumbv7neon-linux-androideabi # 32-bit ARM with NEON | ||
name: ${{ matrix.target }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Add target ${{ matrix.target }} | ||
run: rustup target add ${{ matrix.target }} | ||
- name: Install Android NDK | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y --no-install-recommends unzip | ||
wget https://dl.google.com/android/repository/android-ndk-${{ env.ANDROID_NDK_VERSION }}-linux.zip | ||
unzip android-ndk-${{ env.ANDROID_NDK_VERSION }}-linux.zip -d $HOME | ||
export ANDROID_NDK_HOME=$HOME/android-ndk-${{ env.ANDROID_NDK_VERSION }} | ||
echo "ANDROID_NDK_HOME=${{ env.ANDROID_NDK_HOME }}" >> $GITHUB_ENV | ||
- name: Set up Android environment variables | ||
run: | | ||
export ANDROID_HOME=$HOME/android-sdk | ||
export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH | ||
echo "ANDROID_HOME=${{ env.ANDROID_HOME }}" >> $GITHUB_ENV | ||
echo "PATH=${{ env.PATH }}" >> $GITHUB_ENV | ||
- name: Build ${{ matrix.target }} | ||
run: cargo build --target ${{ matrix.target }} --verbose | ||
- name: Test ${{ matrix.target }} | ||
run: cargo test --target ${{ matrix target }} --verbose |