@@ -114,6 +114,61 @@ jobs:
114
114
- run : cargo test ${{ matrix.args }}
115
115
shell : alpine.sh {0}
116
116
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
+
117
172
test-libbpf-rs :
118
173
# check that libbpf-rs, one of the main consumers of the library, works with
119
174
# this version of libbpf-sys
@@ -157,6 +212,7 @@ jobs:
157
212
needs :
158
213
- test-gnu
159
214
- test-musl
215
+ - test-android
160
216
- test-libbpf-rs
161
217
runs-on : ubuntu-22.04
162
218
steps :
0 commit comments