Build Abi for Android #1
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: Build Abi for Android | |
on: | |
workflow_dispatch: | |
inputs: | |
target: | |
required: true | |
default: aarch64-linux-android | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
# Set up Android NDK and Cargo toolchain for cross-compiling to Android | |
- name: Set up environment | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain-version: stable | |
profile: minimal | |
target: ${{ github.event.inputs.target }} | |
components: cargo, rustfmt, clippy | |
# Download Android NDK for cross-compiling | |
- name: Download Android NDK | |
uses: nttld/[email protected] | |
with: | |
# Exact version to use | |
ndk-version: r26d | |
local-cache: true | |
# Install Cargo target for Android | |
- name: Install cargo target for Android | |
run: | | |
cd ./rust | |
mkdir output | |
cargo ndk -o ./output -t ${{ github.event.inputs.target }} --manifest-path ./Cargo.toml build --release | |
ls ./output | |
tar -czvf ${{ github.event.inputs.target }}.tar.gz ./output | |
# Upload the built artifacts as an artifact | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: android-release | |
path: rust/${{ github.event.inputs.target }}.tar.gz |