diff --git a/.github/scripts/setup.sh b/.github/scripts/setup.sh new file mode 100755 index 0000000..0c78186 --- /dev/null +++ b/.github/scripts/setup.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -euo pipefail + +BPFTRACE_VERSION=${BPFTRACE_VERSION:-0.22.1} + +# Assume sudo in this script + +# Install dependencies +apt update && apt install -y make file gawk libfuse2t64 + +# Download bpftrace release +BIN_DIR=/usr/local/bin +mkdir -p $BIN_DIR +curl -L -o bpftrace https://github.com/bpftrace/bpftrace/releases/download/v${BPFTRACE_VERSION}/bpftrace +chmod +x bpftrace +mv bpftrace $BIN_DIR +bpftrace --version + +# mount tracefs to avoid warnings from bpftrace +grep -q tracefs /proc/mounts || mount -t tracefs tracefs /sys/kernel/tracing diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..5d658f0 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,31 @@ +name: USDT CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install prerequisites + run: sudo .github/scripts/setup.sh + + - name: Build (static) + run: make SHARED=0 -C tests -j$(nproc) build + + - name: Build (shared) + run: make SHARED=1 -C tests -j$(nproc) build + + - name: Test (static) + run: make SHARED=0 -C tests test + + - name: Test (shared) + run: make SHARED=1 -C tests test +