@@ -139,8 +139,14 @@ jobs:
139
139
--target ${{ matrix.target }} \
140
140
-Z build-std=core
141
141
142
- build-integration-test :
143
- runs-on : ubuntu-22.04
142
+ run-integration-test :
143
+ strategy :
144
+ fail-fast : false
145
+ matrix :
146
+ runner :
147
+ - macos-12
148
+ - ubuntu-22.04
149
+ runs-on : ${{ matrix.runner }}
144
150
steps :
145
151
- uses : actions/checkout@v3
146
152
with :
@@ -150,13 +156,12 @@ jobs:
150
156
with :
151
157
toolchain : nightly
152
158
components : rust-src
159
+ targets : aarch64-unknown-linux-musl,x86_64-unknown-linux-musl
153
160
154
161
- uses : Swatinem/rust-cache@v2
155
162
156
- - name : bpf-linker
157
- run : cargo install bpf-linker --git https://github.com/aya-rs/bpf-linker.git
158
-
159
- - name : Install dependencies
163
+ - name : Install prerequisites
164
+ if : runner.os == 'Linux'
160
165
# ubuntu-22.04 comes with clang 14[0] which doesn't include support for signed and 64bit
161
166
# enum values which was added in clang 15[1].
162
167
#
@@ -171,63 +176,78 @@ jobs:
171
176
set -euxo pipefail
172
177
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
173
178
echo deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy main | sudo tee /etc/apt/sources.list.d/llvm.list
174
- sudo apt-get update
175
- sudo apt-get -y install clang gcc-multilib llvm
179
+ sudo apt update
180
+ sudo apt -y install clang gcc-multilib llvm locate qemu-system-{arm,x86}
176
181
177
- - name : Build
182
+ - name : bpf-linker
183
+ if : runner.os == 'Linux'
184
+ run : cargo install bpf-linker --git https://github.com/aya-rs/bpf-linker.git
185
+
186
+ - name : Install prerequisites
187
+ if : runner.os == 'macOS'
188
+ # The clang shipped on macOS doesn't support BPF, so we need LLVM from brew.
189
+ #
190
+ # We also need LLVM for bpf-linker, see comment below.
178
191
run : |
179
192
set -euxo pipefail
180
- mkdir -p integration-test-binaries
181
- # See https://doc.rust-lang.org/cargo/reference/profiles.html for the
182
- # names of the builtin profiles. Note that dev builds "debug" targets.
183
- cargo xtask build-integration-test --cargo-arg=--profile=dev | xargs -I % cp % integration-test-binaries/dev
184
- cargo xtask build-integration-test --cargo-arg=--profile=release | xargs -I % cp % integration-test-binaries/release
185
-
186
- - uses : actions/upload-artifact@v3
187
- with :
188
- name : integration-test-binaries
189
- path : integration-test-binaries
193
+ brew install qemu dpkg pkg-config llvm
194
+ echo /usr/local/opt/llvm/bin >> $GITHUB_PATH
190
195
191
- run-integration-test :
192
- runs-on : macos-latest
193
- needs : ["build-integration-test"]
194
- steps :
195
- - uses : actions/checkout@v3
196
- with :
197
- sparse-checkout : |
198
- test/run.sh
199
- test/cloud-localds
196
+ - name : bpf-linker
197
+ if : runner.os == 'macOS'
198
+ # NB: rustc doesn't ship libLLVM.so on macOS, so disable proxying (default feature).
199
+ run : cargo install bpf-linker --git https://github.com/aya-rs/bpf-linker.git --no-default-features
200
200
201
- - name : Install Pre-requisites
201
+ - name : Download debian kernels
202
+ if : runner.arch == 'ARM64'
202
203
run : |
203
- brew install qemu gnu-getopt coreutils cdrtools
204
-
205
- - name : Cache tmp files
206
- uses : actions/cache@v3
207
- with :
208
- path : |
209
- .tmp/*.qcow2
210
- .tmp/test_rsa
211
- .tmp/test_rsa.pub
212
- key : tmp-files-${{ hashFiles('test/run.sh') }}
213
-
214
- - uses : actions/download-artifact@v3
215
- with :
216
- name : integration-test-binaries
217
- path : integration-test-binaries
218
-
219
- - name : Run integration tests
204
+ set -euxo pipefail
205
+ mkdir -p test/.tmp/debian-kernels/arm64
206
+ # NB: a 4.19 kernel image for arm64 was not available.
207
+ # TODO(https://github.com/aya-rs/aya/pull/725): enable tests on kernels before 6.0.
208
+ # linux-image-5.10.0-23-cloud-arm64-unsigned_5.10.179-3_arm64.deb \
209
+ printf '%s\0' \
210
+ linux-image-6.1.0-10-cloud-arm64-unsigned_6.1.38-2_arm64.deb \
211
+ linux-image-6.4.0-1-cloud-arm64-unsigned_6.4.4-2_arm64.deb \
212
+ | xargs -0 -t -P0 -I {} wget -nd -q -P test/.tmp/debian-kernels/arm64 ftp://ftp.us.debian.org/debian/pool/main/l/linux/{}
213
+
214
+ - name : Download debian kernels
215
+ if : runner.arch == 'X64'
220
216
run : |
221
217
set -euxo pipefail
222
- find integration-test-binaries -type f -exec chmod +x {} \;
223
- test/run.sh integration-test-binaries
218
+ mkdir -p test/.tmp/debian-kernels/amd64
219
+ # TODO(https://github.com/aya-rs/aya/pull/725): enable tests on kernels before 6.0.
220
+ # linux-image-4.19.0-21-cloud-amd64-unsigned_4.19.249-2_amd64.deb \
221
+ # linux-image-5.10.0-23-cloud-amd64-unsigned_5.10.179-3_amd64.deb \
222
+ printf '%s\0' \
223
+ linux-image-6.1.0-10-cloud-amd64-unsigned_6.1.38-2_amd64.deb \
224
+ linux-image-6.4.0-1-cloud-amd64-unsigned_6.4.4-2_amd64.deb \
225
+ | xargs -0 -t -P0 -I {} wget -nd -q -P test/.tmp/debian-kernels/amd64 ftp://ftp.us.debian.org/debian/pool/main/l/linux/{}
226
+
227
+ - name : Alias gtar as tar
228
+ if : runner.os == 'macOS'
229
+ # macOS tar doesn't support --wildcards which we use below.
230
+ run : mkdir tar-is-gtar && ln -s "$(which gtar)" tar-is-gtar/tar && echo "$PWD"/tar-is-gtar >> $GITHUB_PATH
231
+
232
+ - name : Extract debian kernels
233
+ run : |
234
+ set -euxo pipefail
235
+ find test/.tmp -name '*.deb' -print0 | xargs -t -0 -I {} \
236
+ sh -c "dpkg --fsys-tarfile {} | tar -C test/.tmp --wildcards --extract '*vmlinuz*' --file -"
237
+
238
+ - name : Run integration tests
239
+ run : find test/.tmp -name 'vmlinuz-*' | xargs -t cargo xtask integration-test vm
224
240
225
241
# Provides a single status check for the entire build workflow.
226
242
# This is used for merge automation, like Mergify, since GH actions
227
243
# has no concept of "when all status checks pass".
228
244
# https://docs.mergify.com/conditions/#validating-all-status-checks
229
245
build-workflow-complete :
230
- needs : ["lint", "build-test-aya", "build-test-aya-bpf", "run-integration-test"]
246
+ needs :
247
+ - lint
248
+ - build-test-aya
249
+ - build-test-aya-bpf
250
+ - run-integration-test
231
251
runs-on : ubuntu-latest
232
252
steps :
233
253
- name : Build Complete
0 commit comments