Skip to content

Commit 9d2c2c0

Browse files
blackspherefollowerqdot
authored andcommitted
build: Add Android CI and fix jni/jni_utils version
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.
1 parent 0eb6188 commit 9d2c2c0

File tree

2 files changed

+44
-5
lines changed

2 files changed

+44
-5
lines changed

.github/workflows/rust.yml

+43-4
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,65 @@ jobs:
1414
build:
1515
strategy:
1616
matrix:
17-
os:
18-
- macOS-latest
19-
- ubuntu-latest
20-
- windows-latest
17+
target:
18+
- macos
19+
- linux
20+
- windows
21+
- android
22+
include:
23+
- target: macos
24+
os: macOS-latest
25+
cbt: aarch64-apple-darwin
26+
- target: linux
27+
os: ubuntu-latest
28+
cbt: x86_64-unknown-linux-gnu
29+
- target: windows
30+
os: windows-latest
31+
cbt: x86_64-pc-windows-msvc
32+
- target: android
33+
os: ubuntu-latest
34+
cbt: aarch64-linux-android
35+
2136
runs-on: ${{ matrix.os }}
2237

38+
env:
39+
CARGO_BUILD_TARGET: ${{ matrix.cbt }}
40+
2341
steps:
2442
- uses: actions/checkout@v2
2543
- name: Install dependencies
2644
if: ${{ runner.os == 'Linux' }}
2745
run: |
2846
sudo apt-get update
2947
sudo apt-get install libdbus-1-dev
48+
- uses: actions/setup-java@v2
49+
if: ${{ matrix.target == 'android' }}
50+
with:
51+
distribution: 'zulu'
52+
java-version: '17'
53+
- name: Setup NDK
54+
if: ${{ matrix.target == 'android' }}
55+
uses: nttld/setup-ndk@v1
56+
id: setup-ndk
57+
with:
58+
ndk-version: r25b
59+
local-cache: true
60+
- name: rust toolchain
61+
if: ${{ matrix.target == 'android' }}
62+
uses: actions-rs/toolchain@v1
63+
with:
64+
profile: minimal
65+
target: aarch64-linux-android
66+
toolchain: stable
67+
override: true
3068
- name: Check
3169
run: cargo check --all --bins --examples
3270
- name: Check without default features
3371
run: cargo check --all --bins --examples --no-default-features
3472
- name: Check with all features
3573
run: cargo check --all --bins --examples --all-features
3674
- name: Run tests
75+
if: ${{ matrix.target != 'android' }}
3776
run: cargo test --all
3877
- name: Run clippy
3978
uses: actions-rs/clippy-check@v1

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ dbus = "0.9.7"
4141
bluez-async = "0.7.2"
4242

4343
[target.'cfg(target_os = "android")'.dependencies]
44-
jni = "0.21.1"
44+
jni = "0.19.0"
4545
once_cell = "1.19.0"
4646
jni-utils = "0.1.1"
4747

0 commit comments

Comments
 (0)