|
| 1 | +name: distro-matrix |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: [main] |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: distro-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + container-build-test: |
| 18 | + name: ${{ matrix.image }} |
| 19 | + runs-on: ubuntu-22.04 |
| 20 | + timeout-minutes: 30 |
| 21 | + strategy: |
| 22 | + fail-fast: false |
| 23 | + matrix: |
| 24 | + image: ["ubuntu:22.04", "ubuntu:24.04", "debian:12", "fedora:43"] |
| 25 | + container: |
| 26 | + image: ${{ matrix.image }} |
| 27 | + # ptrace in containers can be restricted by the seccomp profile/capabilities. |
| 28 | + options: --cap-add SYS_PTRACE --security-opt seccomp=unconfined |
| 29 | + defaults: |
| 30 | + run: |
| 31 | + shell: bash |
| 32 | + env: |
| 33 | + CARGO_TERM_COLOR: always |
| 34 | + RUSTUP_VERSION: "1.29.1" |
| 35 | + # sha256 of rustup-init for x86_64-unknown-linux-gnu at RUSTUP_VERSION |
| 36 | + RUSTUP_INIT_SHA256: "dda7234360b7f578ca8b0ddcb80145646fa61a67c1720a5abc7051b35c9fcb71" |
| 37 | + MSRV_TOOLCHAIN: "1.74.0" |
| 38 | + steps: |
| 39 | + - name: Install build prerequisites |
| 40 | + shell: sh |
| 41 | + run: | |
| 42 | + set -eu |
| 43 | + if command -v apt-get >/dev/null; then |
| 44 | + apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates curl gcc libc6-dev git python3 |
| 45 | + else |
| 46 | + dnf install -y gcc curl git python3 ca-certificates |
| 47 | + fi |
| 48 | + - uses: actions/checkout@v4 |
| 49 | + - name: Install pinned rustup, stable and MSRV toolchains |
| 50 | + run: | |
| 51 | + set -euo pipefail |
| 52 | + url="https://static.rust-lang.org/rustup/archive/${RUSTUP_VERSION}/x86_64-unknown-linux-gnu/rustup-init" |
| 53 | + curl --proto '=https' --tlsv1.2 -sSfL -o rustup-init "$url" |
| 54 | + echo "${RUSTUP_INIT_SHA256} rustup-init" | sha256sum -c - |
| 55 | + chmod +x rustup-init |
| 56 | + ./rustup-init -y --profile minimal --default-toolchain stable |
| 57 | + rm rustup-init |
| 58 | + echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" |
| 59 | + "$HOME/.cargo/bin/rustup" toolchain install "$MSRV_TOOLCHAIN" --profile minimal |
| 60 | + - name: Show environment |
| 61 | + run: | |
| 62 | + cat /etc/os-release | head -3 |
| 63 | + rustc --version |
| 64 | + uname -r |
| 65 | + - name: Build (release, locked) |
| 66 | + run: | |
| 67 | + set -euo pipefail |
| 68 | + cargo build --release --locked |
| 69 | + - name: MSRV check (${{ env.MSRV_TOOLCHAIN }}) |
| 70 | + run: | |
| 71 | + set -euo pipefail |
| 72 | + cargo +"$MSRV_TOOLCHAIN" check --locked |
| 73 | + - name: Ptrace preflight (informational) |
| 74 | + # If the container forbids ptrace, ptrace-dependent integration tests |
| 75 | + # print "skipping: could not start tracer" and pass without exercising |
| 76 | + # tracing. This step makes that visible rather than hidden. |
| 77 | + run: ./target/release/wraith doctor || echo "::warning::wraith doctor reported failures on ${{ matrix.image }}; ptrace tests may be skipped" |
| 78 | + - name: Test |
| 79 | + run: | |
| 80 | + set -euo pipefail |
| 81 | + cargo test --locked -- --nocapture 2>&1 | tee test.log |
| 82 | + - name: Report skipped ptrace tests |
| 83 | + if: always() |
| 84 | + shell: bash |
| 85 | + run: | |
| 86 | + n=$(grep -c 'skipping: could not start tracer' test.log || true) |
| 87 | + echo "ptrace-skipped test count: $n" |
| 88 | + if [ "$n" != 0 ]; then echo "::warning::$n ptrace tests were skipped on ${{ matrix.image }}"; fi |
0 commit comments