@ -14,7 +14,6 @@ on:
env:
env:
CARGO_TERM_COLOR : always
CARGO_TERM_COLOR : always
LLVM_VERSION : 18
jobs:
jobs:
lint:
lint:
@ -183,14 +182,16 @@ jobs:
strategy:
strategy:
fail-fast : false
fail-fast : false
matrix:
matrix:
runner :
include :
# macos-14 is arm64 per
# macos-14 is arm64 per
# https://github.com/actions/runner-images#available-images which
# https://github.com/actions/runner-images#available-images which
# doesn't support nested virtualization per
# doesn't support nested virtualization per
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#limitations-for-arm64-macos-runners
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#limitations-for-arm64-macos-runners
- macos-13
- target : x86_64-apple-darwin
- ubuntu-22.04
os : macos-13
runs-on : ${{ matrix.runner }}
- target : x86_64-unknown-linux-gnu
os : ubuntu-22.04
runs-on : ${{ matrix.os }}
steps:
steps:
- uses : actions/checkout@v4
- uses : actions/checkout@v4
with:
with:
@ -198,27 +199,29 @@ jobs:
- name : Install prerequisites
- name : Install prerequisites
if : runner.os == 'Linux'
if : runner.os == 'Linux'
# ubuntu-22.04 comes with clang 14[0] which doesn't include support for signed and 64bit
# enum values which was added in clang 15[1].
#
# gcc-multilib provides at least <asm/types.h> which is referenced by libbpf.
# gcc-multilib provides at least <asm/types.h> which is referenced by libbpf.
#
#
# llvm provides llvm-objcopy which is used to build the BTF relocation tests.
# ubuntu-22.04 comes with clang 14[0] which doesn't include support for signed and 64bit
# enum values which was added in clang 15[1]. llvm-objcopy is used to build the BTF
# relocation tests. Use the latest LLVM release tarball to provide both dependencies.
#
#
# [0] https://github.com/actions/runner-images/blob/ubuntu22/20230724.1/images/linux/Ubuntu2204-Readme.md
# [0] https://github.com/actions/runner-images/blob/ubuntu22/20230724.1/images/linux/Ubuntu2204-Readme.md
#
#
# [1] https://github.com/llvm/llvm-project/commit/dc1c43d
# [1] https://github.com/llvm/llvm-project/commit/dc1c43d
run : |
run : |
set -euxo pipefail
set -euxo pipefail
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
echo deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${{ env.LLVM_VERSION }} main | sudo tee /etc/apt/sources.list.d/llvm.list
sudo apt update
sudo apt update
sudo apt -y install clang-${{ env.LLVM_VERSION }} gcc-multilib llvm-${{ env.LLVM_VERSION }} locate qemu-system-{arm,x86}
sudo apt -y install gcc-multilib locate qemu-system-{arm,x86}
echo /usr/lib/llvm-${{ env.LLVM_VERSION }}/bin >> $GITHUB_PATH
llvm_tarball_url=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
- name : bpf-linker
https://api.github.com/repos/llvm/llvm-project/releases | jq -r \
if : runner.os == 'Linux'
'map(select(.prerelease)) | first | .assets |
run : cargo install bpf-linker --git https://github.com/aya-rs/bpf-linker.git
map(select(.name | endswith("Linux-X64.tar.xz"))) | first |
.browser_download_url')
mkdir -p /tmp/llvm-upstream
wget -q -O - $llvm_tarball_url | tar -xJ --strip-components 1 \
-C /tmp/llvm-upstream
echo /tmp/llvm-upstream/bin >> $GITHUB_PATH
- name : Install prerequisites
- name : Install prerequisites
if : runner.os == 'macOS'
if : runner.os == 'macOS'
@ -227,8 +230,6 @@ jobs:
# The tar shipped on macOS doesn't support --wildcards, so we need GNU tar.
# The tar shipped on macOS doesn't support --wildcards, so we need GNU tar.
#
#
# The clang shipped on macOS doesn't support BPF, so we need LLVM from brew.
# The clang shipped on macOS doesn't support BPF, so we need LLVM from brew.
#
# We also need LLVM for bpf-linker, see comment below.
run : |
run : |
set -euxo pipefail
set -euxo pipefail
brew update
brew update
@ -249,10 +250,31 @@ jobs:
- uses : Swatinem/rust-cache@v2
- uses : Swatinem/rust-cache@v2
- name : Install libLLVM
# Use LLVM tarball from Rust CI to make sure that the libLLVM version
# matches exactly the one used by the current Rust nightly.
run : |
set -euxo pipefail
# Get the partial SHA from Rust nightly.
rustc_sha=$(rustc +nightly --version | grep -oE '[a-f0-9]{7,40}')
# Get the full SHA from GitHub.
rustc_sha=$(curl -s https://api.github.com/repos/rust-lang/rust/commits/$rustc_sha \
--header 'authorization : Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type : application/json' \
| jq -r '.sha')
mkdir -p /tmp/rustc-llvm
wget -q -O - https://ci-artifacts.rust-lang.org/rustc-builds/$rustc_sha/rust-dev-nightly-${{ matrix.target }}.tar.xz | \
tar -xJ --strip-components 2 -C /tmp/rustc-llvm
echo /tmp/rustc-llvm/bin >> $GITHUB_PATH
- name : bpf-linker
if : runner.os == 'Linux'
run : cargo install bpf-linker --git https://github.com/aya-rs/bpf-linker.git
- name : bpf-linker
- name : bpf-linker
if : runner.os == 'macOS'
if : runner.os == 'macOS'
# NB: rustc doesn't ship libLLVM.so on macOS, so disable proxying (default feature). We also
# NB: rustc doesn't ship libLLVM.so on macOS, so disable proxying (default feature). We also
# --force so that bpf-linker gets always relinked against the latest LLVM installed by brew.
# --force so that bpf-linker gets always relinked against the latest LLVM downloaded above .
run : cargo install --force bpf-linker --git https://github.com/aya-rs/bpf-linker.git --no-default-features
run : cargo install --force bpf-linker --git https://github.com/aya-rs/bpf-linker.git --no-default-features
- name : Download debian kernels
- name : Download debian kernels