mirror of
https://github.com/cfal/shoes.git
synced 2026-11-06 16:14:11 +00:00
cbindgen resolves Cargo metadata without --locked and can update Cargo.lock. Run it after the native builds so it cannot hide a stale lockfile from their checks.
89 lines
2.4 KiB
YAML
89 lines
2.4 KiB
YAML
name: Check Mobile Builds
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
tags: [ 'v*' ]
|
|
pull_request:
|
|
branches: [ master ]
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
ios:
|
|
name: Build iOS native libraries
|
|
runs-on: macos-latest
|
|
env:
|
|
IPHONEOS_DEPLOYMENT_TARGET: '16.0'
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: aarch64-apple-ios,aarch64-apple-ios-sim
|
|
|
|
- name: Cache Rust build
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
key: ios
|
|
|
|
- name: Build native libraries
|
|
run: |
|
|
cargo build --release --lib --locked --target aarch64-apple-ios
|
|
cargo build --release --lib --locked --target aarch64-apple-ios-sim
|
|
test -s target/aarch64-apple-ios/release/libshoes.a
|
|
test -s target/aarch64-apple-ios-sim/release/libshoes.a
|
|
|
|
android:
|
|
name: Build Android native libraries
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: aarch64-linux-android,armv7-linux-androideabi
|
|
|
|
- name: Install cbindgen
|
|
uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: cbindgen@0.29.4
|
|
|
|
- name: Cache Rust build
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
key: android
|
|
|
|
- name: Cache cargo-ndk binary
|
|
uses: actions/cache@v6
|
|
with:
|
|
path: ~/.cargo/bin/cargo-ndk
|
|
key: cargo-ndk-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: cargo-ndk-${{ runner.os }}-
|
|
|
|
- name: Install cargo-ndk
|
|
run: command -v cargo-ndk || cargo install cargo-ndk
|
|
|
|
- name: Set NDK path
|
|
run: echo "ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME" >> "$GITHUB_ENV"
|
|
|
|
- name: Build JNI native libraries
|
|
run: |
|
|
cargo ndk \
|
|
-t arm64-v8a \
|
|
-t armeabi-v7a \
|
|
-P 21 \
|
|
-- build --release --lib --locked
|
|
test -s target/aarch64-linux-android/release/libshoes.so
|
|
test -s target/armv7-linux-androideabi/release/libshoes.so
|
|
|
|
# cbindgen can update Cargo.lock, so the locked builds must run first.
|
|
- name: Verify C header
|
|
run: cbindgen --verify --config cbindgen.toml --output include/shoes.h
|