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

Android Platform Support #144

Closed
wants to merge 2 commits into from
Closed
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
50 changes: 50 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,56 @@ jobs:

- run: cargo check --locked --lib --all-features

android:
name: Android+Build+Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust:
- stable
- beta
- nightly
os: [ ubuntu-latest ]
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install ${{ matrix.rust }} toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}

- name: Setup Android SDK
uses: amyu/setup-android@v4
with:
sdk-version: 35
build-tools-version: '35.0.0'
cmake-version: '3.30.5'
ndk-version: '28.0.12433566'
cache-key: 'sdk-35_tools_35.0.0_ndk-28.0.12433566_cmake-3.30.5'
generate-job-summary: true

- name: CargoNdk
working-directory: ./integration-tests/android
run: |
rustup target add \
aarch64-linux-android \
armv7-linux-androideabi \
x86_64-linux-android \
i686-linux-android
cargo install cargo-ndk

- name: cargo build (android; debug; default features)
working-directory: ./integration-tests/android
run: cargo ndk -t armeabi-v7a -t arm64-v8a -t x86 -t x86_64 -o target/ build --locked

- name: cargo build (android; debug; no default features)
working-directory: ./integration-tests/android
run: cargo ndk -t armeabi-v7a -t arm64-v8a -t x86 -t x86_64 -o target/ build --locked --no-default-features

minimal-versions:
name: Check minimum versions of direct dependencies
runs-on: ubuntu-latest
Expand Down
89 changes: 89 additions & 0 deletions .github/workflows/smoke-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,92 @@ jobs:
run: cargo test --locked -- --ignored
env:
RUST_BACKTRACE: 1

smoke-tests-android:
name: Smoke Tests Android
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust:
- stable
- beta
- nightly
os: [ ubuntu-latest ]
# Run only on the latest Android API version.
# All the objects and methods used to access the Android KeyStore
# are supported from API 1. No need to check older versions.
api: [ 35 ]
# QEMU2 only support arm64 on x86_64 hosts
# arch: [x86_64, arm64-v8a]
arch: [ x86_64 ]
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install ${{ matrix.rust }} toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}

- name: SetUp JDK 17
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '17'

- name: Setup Android SDK
uses: amyu/setup-android@v4
with:
sdk-version: 35
build-tools-version: '35.0.0'
cmake-version: '3.30.5'
ndk-version: '28.0.12433566'
cache-key: 'sdk-35_tools_35.0.0_ndk-28.0.12433566_cmake-3.30.5'
generate-job-summary: true

- name: KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

- name: Cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api }}-${{ matrix.arch }}

- name: ADV+Snapshot
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
working-directory: ./integration-tests/android
api-level: ${{ matrix.api }}
arch: '${{ matrix.arch }}'
target: 'google_apis'
ndk: '28.0.12433566'
cmake: '3.30.5'
emulator-options: -no-window -gpu swiftshader_indirect -no-boot-anim
disable-animations: true
force-avd-creation: false
script: echo "Generated AVD snapshot for caching."

- name: Build+Tests [${{ matrix.api }}, ${{ matrix.arch }})]
uses: reactivecircus/android-emulator-runner@v2
with:
working-directory: ./integration-tests/android
api-level: ${{ matrix.api }}
arch: '${{ matrix.arch }}'
target: 'google_apis'
ndk: '28.0.12433566'
cmake: '3.30.5'
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -no-boot-anim
disable-animations: true
force-avd-creation: false
script: ./gradlew -x lint build test connectedAndroidTest --stacktrace
Loading