Skip to content

Commit

Permalink
build: Add Android CI and fix jni/jni_utils version
Browse files Browse the repository at this point in the history
Android is currently broken in dev due to a change in the jni crate
that's not supported by jni_utils. This was undetected due to lack of CI.
  • Loading branch information
blackspherefollower authored and qdot committed Oct 3, 2024
1 parent 0eb6188 commit 9d2c2c0
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 5 deletions.
47 changes: 43 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,65 @@ jobs:
build:
strategy:
matrix:
os:
- macOS-latest
- ubuntu-latest
- windows-latest
target:
- macos
- linux
- windows
- android
include:
- target: macos
os: macOS-latest
cbt: aarch64-apple-darwin
- target: linux
os: ubuntu-latest
cbt: x86_64-unknown-linux-gnu
- target: windows
os: windows-latest
cbt: x86_64-pc-windows-msvc
- target: android
os: ubuntu-latest
cbt: aarch64-linux-android

runs-on: ${{ matrix.os }}

env:
CARGO_BUILD_TARGET: ${{ matrix.cbt }}

steps:
- uses: actions/checkout@v2
- name: Install dependencies
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get update
sudo apt-get install libdbus-1-dev
- uses: actions/setup-java@v2
if: ${{ matrix.target == 'android' }}
with:
distribution: 'zulu'
java-version: '17'
- name: Setup NDK
if: ${{ matrix.target == 'android' }}
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r25b
local-cache: true
- name: rust toolchain
if: ${{ matrix.target == 'android' }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
target: aarch64-linux-android
toolchain: stable
override: true
- name: Check
run: cargo check --all --bins --examples
- name: Check without default features
run: cargo check --all --bins --examples --no-default-features
- name: Check with all features
run: cargo check --all --bins --examples --all-features
- name: Run tests
if: ${{ matrix.target != 'android' }}
run: cargo test --all
- name: Run clippy
uses: actions-rs/clippy-check@v1
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dbus = "0.9.7"
bluez-async = "0.7.2"

[target.'cfg(target_os = "android")'.dependencies]
jni = "0.21.1"
jni = "0.19.0"
once_cell = "1.19.0"
jni-utils = "0.1.1"

Expand Down

0 comments on commit 9d2c2c0

Please sign in to comment.