Skip to content

feat: enhance semantic metadata handling in r2sleigh #65

feat: enhance semantic metadata handling in r2sleigh

feat: enhance semantic metadata handling in r2sleigh #65

Workflow file for this run

name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
# Cancel in-progress runs for the same branch/PR
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
# ── Preflight: ensure toolchain is ready ────────────────────────────
preflight:
name: Preflight
runs-on: self-hosted
steps:
- name: Setup Rust PATH
run: |
for p in "$HOME/.cargo/bin" "/root/.cargo/bin" "/usr/local/cargo/bin"; do
if [ -d "$p" ]; then
echo "$p" >> "$GITHUB_PATH"
export PATH="$p:$PATH"
fi
done
if ! command -v cargo &>/dev/null; then
echo "::error::cargo not found. See scripts/setup-runner.sh"
exit 1
fi
- name: Installing radare2 from git
run: |
if [ -d /tmp/radare2 ]; then
cd /tmp/radare2 && git fetch --depth=1 origin && git reset --hard origin/master
else
git clone --depth=1 https://github.com/radareorg/radare2 /tmp/radare2
fi
cd /tmp/radare2 && sys/install.sh
- name: Print versions
run: |
echo "rustc: $(rustc --version)"
echo "cargo: $(cargo --version)"
echo "gcc: $(gcc --version | head -1)"
echo "r2: $(r2 -v 2>&1 | head -1)"
echo "r_anal: $(pkg-config --modversion r_anal 2>/dev/null || echo 'not found')"
# ── Formatting ──────────────────────────────────────────────────────
fmt:
name: Rustfmt
runs-on: self-hosted
needs: preflight
steps:
- uses: actions/checkout@v6
- name: Setup PATH
run: echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- run: cargo fmt --all -- --check
# ── Linting ─────────────────────────────────────────────────────────
clippy:
name: Clippy (${{ matrix.features }})
runs-on: self-hosted
needs: fmt
strategy:
matrix:
features: [x86, arm, all-archs]
steps:
- uses: actions/checkout@v6
- name: Setup PATH
run: echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Cache cargo registry & build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-clippy-${{ matrix.features }}-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}
restore-keys: |
cargo-clippy-${{ matrix.features }}-
cargo-build-${{ matrix.features }}-
- run: cargo clippy --features ${{ matrix.features }} -- -D warnings
# ── Build ───────────────────────────────────────────────────────────
build:
name: Build (${{ matrix.features }})
runs-on: self-hosted
needs: fmt
strategy:
fail-fast: false
matrix:
features: [x86, arm, all-archs]
steps:
- uses: actions/checkout@v6
- name: Setup PATH
run: echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Cache cargo registry & build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-build-${{ matrix.features }}-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}
restore-keys: |
cargo-build-${{ matrix.features }}-
- name: Build workspace
run: cargo build --features ${{ matrix.features }}
- name: Build plugin
run: cargo build --features ${{ matrix.features }} -p r2sleigh-plugin
# ── Unit tests ──────────────────────────────────────────────────────
test:
name: Unit Tests
runs-on: self-hosted
needs: build
steps:
- uses: actions/checkout@v6
- name: Setup PATH
run: echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Cache cargo registry & build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-test-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}
restore-keys: |
cargo-test-
cargo-build-all-archs-
- run: cargo test --all-features
# ── E2E tests ───────────────────────────────────────────────────────
e2e:
name: Integration Tests
runs-on: self-hosted
needs: build
steps:
- uses: actions/checkout@v6
- name: Setup PATH
run: echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Cache cargo registry & build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-e2e-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}
restore-keys: |
cargo-e2e-
cargo-build-x86-
- name: Build plugin (release)
run: cargo build --release --features x86 -p r2sleigh-plugin
- name: Build and install r2 plugin
run: make -C r2plugin RUST_FEATURES=x86 install
- name: Compile test binaries
working-directory: tests/e2e
run: |
gcc -O0 -g -fno-stack-protector -no-pie -o vuln_test vuln_test.c
gcc -O0 -g -fno-stack-protector -no-pie -o stress_test stress_test.c -lm
gcc -O2 -g -fno-stack-protector -no-pie -o stress_test_opt stress_test.c -lm
if [ -f test_func.c ]; then
gcc -O0 -g -o test_func test_func.c
fi
if [ -f sym_test.c ]; then
gcc -O0 -g -o sym_test sym_test.c
fi
- name: Run E2E tests
working-directory: tests/e2e
run: cargo test -- --test-threads=1
env:
RUST_LOG: info
# ── Release build check ────────────────────────────────────────────
release:
name: Release Build
runs-on: self-hosted
needs: test
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v6
- name: Setup PATH
run: echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Cache cargo registry & build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-release-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}
restore-keys: |
cargo-release-
cargo-build-all-archs-
- name: Build release (all architectures)
run: cargo build --release --features all-archs
- name: Build plugin release
run: make -C r2plugin RUST_FEATURES=all-archs