Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a3eb814

Browse files
committedDec 16, 2024
feat: Add Android test job
1 parent cb640c8 commit a3eb814

File tree

1 file changed

+56
-1
lines changed

1 file changed

+56
-1
lines changed
 

‎.github/workflows/ci.yml

+56-1
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,61 @@ jobs:
132132
- run: cargo test ${{ matrix.args }}
133133
shell: alpine.sh {0}
134134

135+
test-android:
136+
name: Test on Android
137+
strategy:
138+
matrix:
139+
include:
140+
- rust-target: aarch64-linux-android
141+
os-arch: amd64
142+
143+
runs-on: ubuntu-20.04
144+
145+
env:
146+
CARGO_BUILD_TARGET: ${{ matrix.rust-target }}
147+
CARGO_TERM_VERBOSE: 'true'
148+
149+
steps:
150+
- name: Checkout repository
151+
uses: actions/checkout@v3
152+
with:
153+
submodules: recursive
154+
155+
- name: Install system dependencies
156+
run: |
157+
sudo apt-get update
158+
sudo apt-get -y install \
159+
gawk \
160+
flex \
161+
bison \
162+
clang \
163+
automake \
164+
autopoint \
165+
gcc-multilib \
166+
build-essential
167+
168+
- name: Install Rust stable for ${{ matrix.rust-target }}
169+
uses: dtolnay/rust-toolchain@stable
170+
with:
171+
targets: ${{ matrix.rust-target }}
172+
173+
- name: Install Android NDK
174+
uses: nttld/setup-ndk@v1
175+
id: setup-ndk
176+
with:
177+
ndk-version: r26d
178+
# local-cache: true
179+
# add-to-path: false
180+
181+
- name: Cargo test no run
182+
run: cargo test --no-run
183+
if: matrix.rust-target == 'aarch64-linux-android'
184+
env:
185+
RUSTFLAGS: -C linker=${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang
186+
AR_aarch64_linux_android: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
187+
CC_aarch64_linux_android: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang
188+
CXX_aarch64_linux_android: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang++
189+
135190
test-libbpf-rs:
136191
# check that libbpf-rs, one of the main consumers of the library, works with
137192
# this version of libbpf-sys
@@ -202,4 +257,4 @@ jobs:
202257
zlib1g-dev
203258
204259
- uses: dtolnay/rust-toolchain@stable
205-
- run: cargo clippy --workspace --no-deps -- -A unknown_lints -D clippy::todo
260+
- run: cargo clippy --workspace --no-deps -- -A unknown_lints -D clippy::todo

0 commit comments

Comments
 (0)
Please sign in to comment.