diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05778c2c2..5ac74bd18 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -202,19 +202,68 @@ jobs: - target: x86_64-unknown-linux-gnu # We don't use ubuntu-latest because we care about the apt packages available. os: ubuntu-22.04 + - target: x86_64-unknown-linux-musl + os: ubuntu-22.04 + container: + image: docker.io/alpine:3.20 + options: --privileged -v /sys/fs/bpf:/sys/fs/bpf -v /sys/kernel:/sys/kernel runs-on: ${{ matrix.os }} + container: ${{ matrix.container }} steps: - - uses: actions/checkout@v4 - with: - submodules: recursive + - name: Install prerequisites + if: runner.os == 'Linux' && contains(matrix.container.image, 'alpine') + # bash is used in the `rust-toolchain` action. + # + # clang and make are needed for building the C eBPF programs, which are + # part of the integration tests. + # + # curl and jq are used in the steps below. + # + # dpkg is used to unpack the kernel images from .deb packages, which we + # use for virtualized tests. lynx is used to download them. + # + # gcc is needed as a linker, it also provides the runtime library, both + # needed by Rust. + # + # git is needed for the `checkout` action. + # + # libstdc++ is a dependency of llvm-sys, which is a dependency of + # bpf-linker. + # + # musl-dev provides CRT objects, which are linked by Rust. + # + # QEMU is used to run virtualized integration tests. + # + # sudo is needed by integration tests. + run: | + set -euxo pipefail + apk add \ + bash \ + clang \ + curl \ + dpkg \ + gcc \ + git \ + jq \ + libstdc++-dev \ + lynx \ + make \ + musl-dev \ + qemu-system-arm \ + qemu-system-x86_64 \ + sudo - name: Install prerequisites - if: runner.os == 'Linux' + if: runner.os == 'Linux' && matrix.container == '' # ubuntu-22.04 comes with clang 13-15[0]; support for signed and 64bit # enum values was added in clang 15[1] which isn't in `$PATH`. # # gcc-multilib provides at least which is referenced by libbpf. # + # lynx is used to download kernel images. + # + # QEMU is used to run virtualized integration tests. + # # [0] https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md # # [1] https://github.com/llvm/llvm-project/commit/dc1c43d @@ -224,6 +273,26 @@ jobs: sudo apt -y install gcc-multilib lynx qemu-system-{arm,x86} echo /usr/lib/llvm-15/bin >> $GITHUB_PATH + - uses: actions/checkout@v4 + with: + submodules: recursive + + # When running in a container as root, git throws the following error: + # + # fatal: detected dubious ownership in repository at '/__w/aya/aya' + # + # Which makes a lot of sense, not running regular git commands as root is + # a good thing. However, using a container image with a regular user + # results in permission errors thrown by the runner binary.[0] It's most + # likely because of a host volume mount which is owned by root. It would + # be great to make it work, but it's not going to be trivial and might + # require changes in the runner code itself. + # + # [0] https://github.com/aya-rs/aya/actions/runs/12034434029/job/33550963904 + - name: Mark the directory as safe for git + if: matrix.container != '' + run: git config --global --add safe.directory /__w/aya/aya + - name: Install prerequisites if: runner.os == 'macOS' # The xargs shipped on macOS always exits 0 with -P0, so we need GNU findutils.