Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Android release binaries to CI #8601

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/actions/android-ndk/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This is a small action which uses the pre-installed Android NDK on GitHub
# Actions builders, configured with `$ANDROID_NDK`, to compile and link Android
# code. For Rust we mostly need to configure the linker to Cargo and the C
# compiler to the `cc` crate, so this sets various environment variables to the
# appropriate tool within `$ANDROID_NDK`.

name: 'Setup Rust to use the Android NDK'
description: 'Setup Rust to use the android NDK'

inputs:
target:
description: 'Rust target being used'
required: true
android-platform:
description: 'Platform version to use for the C compiler'
required: false
default: '26'

runs:
using: composite
steps:
- run: |
target=${{ inputs.target }}
upcase=$(echo $target | tr a-z- A-Z_)
ndk_bin=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin
linker=$ndk_bin/${target}${{ inputs.android-platform }}-clang
echo CARGO_TARGET_${upcase}_LINKER=$linker >> $GITHUB_ENV
echo CC_${target}=$linker >> $GITHUB_ENV
echo RANLIB_${target}=$ndk_bin/llvm-ranlib >> $GITHUB_ENV
echo AR_${target}=$ndk_bin/llvm-ar >> $GITHUB_ENV
shell: bash
6 changes: 6 additions & 0 deletions .github/actions/binary-compatible-builds/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ if (process.platform == 'win32') {
return;
}

// Android doesn't use a container as it's controlled by the installation of the
// SDK/NDK.
if (process.env.INPUT_NAME && process.env.INPUT_NAME.indexOf("android") >= 0) {
return;
}

// ... and on Linux we do fancy things with containers. We'll spawn an old
// CentOS container in the background with a super old glibc, and then we'll run
// commands in there with the `$CENTOS` env var.
Expand Down
24 changes: 5 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,6 @@ jobs:
needs: determine
name: Check
runs-on: ubuntu-latest
env:
CARGO_NDK_VERSION: 2.12.2
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -389,23 +387,6 @@ jobs:
- run: rustup target add x86_64-unknown-freebsd
- run: cargo check -p wasmtime --no-default-features --features cranelift,wat,async,cache --target x86_64-unknown-freebsd

# Check whether `wasmtime` cross-compiles to aarch64-linux-android
- run: rustup target add aarch64-linux-android
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- uses: actions/cache@v4
with:
path: ${{ runner.tool_cache }}/cargo-ndk
key: cargo-ndk-bin-${{ env.CARGO_NDK_VERSION }}
- run: echo "${{ runner.tool_cache }}/cargo-ndk/bin" >> $GITHUB_PATH
- run: cargo install --root ${{ runner.tool_cache }}/cargo-ndk --version ${{ env.CARGO_NDK_VERSION }} cargo-ndk --locked
- run: cargo ndk -t arm64-v8a check -p wasmtime

# Run clippy configuration
- run: rustup component add clippy
- run: cargo clippy --workspace
Expand Down Expand Up @@ -881,6 +862,11 @@ jobs:
with:
name: ${{ matrix.build }}

- uses: ./.github/actions/android-ndk
if: contains(matrix.target, 'android')
with:
target: ${{ matrix.target }}

- run: $CENTOS ./ci/build-release-artifacts.sh "${{ matrix.build }}" "${{ matrix.target }}"

# Assemble release artifacts appropriate for this platform, then upload them
Expand Down
10 changes: 10 additions & 0 deletions ci/build-build-matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ const array = [
"os": "windows-latest",
"target": "x86_64-pc-windows-gnu",
},
{
"build": "aarch64-android",
"os": "ubuntu-latest",
"target": "aarch64-linux-android",
},
{
"build": "x86_64-android",
"os": "ubuntu-latest",
"target": "x86_64-linux-android",
},
];

const builds = [];
Expand Down
2 changes: 2 additions & 0 deletions docs/stability-tiers.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ For explanations of what each tier means see below.
| Target | `aarch64-pc-windows-msvc` | CI testing, unwinding, full-time maintainer |
| Target | `riscv64gc-unknown-linux-gnu` | full-time maintainer |
| Target | `wasm32-wasi` [^3] | Supported but not tested |
| Target | `aarch64-linux-android` | CI testing, full-time maintainer |
| Target | `x86_64-linux-android` | CI testing, full-time maintainer |
| Compiler Backend | Winch on aarch64 | finished implementation |
| WebAssembly Proposal | [`gc`] | Complete implementation |
| WASI Proposal | [`wasi-nn`] | More expansive CI testing |
Expand Down