Skip to content

Commit 0de097e

Browse files
committedAug 18, 2024
feat: Add an Android testing job
1 parent 5f077a4 commit 0de097e

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
 

‎.github/workflows/ci.yml

+56
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,61 @@ jobs:
114114
- run: cargo test ${{ matrix.args }}
115115
shell: alpine.sh {0}
116116

117+
test-android:
118+
name: Test on Android
119+
strategy:
120+
matrix:
121+
include:
122+
- rust-target: aarch64-linux-android
123+
os-arch: amd64
124+
125+
runs-on: ubuntu-20.04
126+
127+
env:
128+
CARGO_BUILD_TARGET: ${{ matrix.rust-target }}
129+
CARGO_TERM_VERBOSE: 'true'
130+
131+
steps:
132+
- name: Checkout repository
133+
uses: actions/checkout@v3
134+
with:
135+
submodules: recursive
136+
137+
- name: Install system dependencies
138+
run: |
139+
sudo apt-get update
140+
sudo apt-get -y install \
141+
gawk \
142+
flex \
143+
bison \
144+
clang \
145+
automake \
146+
autopoint \
147+
gcc-multilib \
148+
build-essential
149+
150+
- name: Install Rust stable for ${{ matrix.rust-target }}
151+
uses: dtolnay/rust-toolchain@stable
152+
with:
153+
targets: ${{ matrix.rust-target }}
154+
155+
- name: Install Android NDK
156+
uses: nttld/setup-ndk@v1
157+
id: setup-ndk
158+
with:
159+
ndk-version: r26d
160+
# local-cache: true
161+
# add-to-path: false
162+
163+
- name: Cargo test no run
164+
run: cargo test --no-run
165+
if: matrix.rust-target == 'aarch64-linux-android'
166+
env:
167+
RUSTFLAGS: -C linker=${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang
168+
AR_aarch64_linux_android: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
169+
CC_aarch64_linux_android: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang
170+
CXX_aarch64_linux_android: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang++
171+
117172
test-libbpf-rs:
118173
# check that libbpf-rs, one of the main consumers of the library, works with
119174
# this version of libbpf-sys
@@ -157,6 +212,7 @@ jobs:
157212
needs:
158213
- test-gnu
159214
- test-musl
215+
- test-android
160216
- test-libbpf-rs
161217
runs-on: ubuntu-22.04
162218
steps:

0 commit comments

Comments
 (0)