iOS: Use objc2
#185
Workflow file for this run
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: Android | |
on: | |
push: | |
branches-ignore: [ '**win**', '**linux**', '**macos**', '**bsd**', '**haiku**', '**wasm**', '**ios**' ] | |
pull_request: | |
branches: [ main ] | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: 1 | |
RUST_LOG: webbrowser=TRACE,tests=TRACE | |
CARGO_APK_VERSION: '0.9.7' | |
ANDROID_ARCH: x86_64 | |
ANDROID_TARGET: x86_64-linux-android | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
if: ${{ !contains(github.event.head_commit.message, '#build-') || contains(github.event.head_commit.message, '#build-android') }} | |
strategy: | |
matrix: | |
rust: [ stable ] | |
api-level: [ 33 ] | |
ndk-version: [ '25.1.8937393' ] | |
cmake-version: [ '3.22.1' ] | |
continue-on-error: ${{ matrix.rust != 'stable' && matrix.rust != 'beta' }} | |
steps: | |
- uses: actions/checkout@v3 | |
name: Checkout | |
- name: Install rust version | |
run: | | |
rustup install ${{ matrix.rust }} --profile minimal | |
rustup component add --toolchain ${{ matrix.rust }} rustfmt clippy | |
rustup target add ${{ env.ANDROID_TARGET }} | |
# Install cargo-apk | |
- uses: actions/cache@v3 | |
name: Fetch cargo-apk from cache | |
id: cargo-apk-cache | |
with: | |
path: ~/.cargo/bin/cargo-apk | |
key: cargo-apk-${{ env.CARGO_APK_VERSION }} | |
- name: Install cargo-apk | |
if: steps.cargo-apk-cache.outputs.cache-hit != 'true' | |
run: cargo install cargo-apk --version ${{ env.CARGO_APK_VERSION }} | |
# Pre-build | |
- name: Compile | |
run: rustup run ${{ matrix.rust }} cargo apk build --target ${{ env.ANDROID_TARGET }} | |
working-directory: tests/test-android-app | |
- name: Compile tests | |
run: rustup run ${{ matrix.rust }} cargo build --test test_android | |
# Check if AVD is in cache, else create AVD | |
- name: AVD cache | |
uses: actions/cache@v3 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-${{ matrix.api-level }} | |
- name: Create AVD | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
arch: ${{ env.ANDROID_ARCH }} | |
api-level: ${{ matrix.api-level }} | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: false | |
script: echo "Generated AVD snapshot for caching." | |
# Run tests on emulator | |
- name: Run tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
arch: ${{ env.ANDROID_ARCH }} | |
api-level: ${{ matrix.api-level }} | |
ndk: ${{ matrix.ndk-version }} | |
cmake: ${{ matrix.cmake-version }} | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
script: bash -c 'ANDROID_TARGET=${{ env.ANDROID_TARGET }} ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/${{ matrix.ndk-version }} rustup run ${{ matrix.rust }} cargo test --test test_android -- --ignored' | |
# Code format, linting etc. | |
- name: Check Code Formatting | |
if: ${{ matrix.rust == 'stable' || matrix.rust == 'beta' }} | |
run: cargo +${{ matrix.rust }} fmt --all -- --check | |
- name: Lints | |
if: ${{ matrix.rust == 'stable' || matrix.rust == 'beta' }} | |
run: cargo +${{ matrix.rust }} clippy --target ${{ env.ANDROID_TARGET }} -- -D warnings |