name: Test
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
unit-and-cli:
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --verbose
- name: Build test fixture
run: rustc --edition 2021 -o tests/fixtures/sample_binary tests/fixtures/sample_binary.rs
- name: Run unit tests
run: cargo test --lib --verbose
- name: Run CLI tests
run: cargo test --test e2e --test output_format_integration --verbose
ghidra-setup:
runs-on: ${{ matrix.os }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Install Java 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust
uses: Swatinem/rust-cache@v2
- name: Cache Ghidra installation and config
id: ghidra-cache
uses: actions/cache@v4
with:
path: |
~/.local/share/ghidra-cli
~/.config/ghidra-cli
~/Library/Application Support/ghidra-cli
~/Library/Preferences/ghidra-cli
~/AppData/Local/ghidra-cli
~/AppData/Roaming/ghidra-cli
key: ghidra-${{ matrix.os }}-v5
- name: Cache Ghidra projects
id: project-cache
uses: actions/cache@v4
with:
path: |
~/.cache/ghidra-cli/projects
~/Library/Caches/ghidra-cli/projects
~/AppData/Local/ghidra-cli/projects
key: ghidra-projects-${{ matrix.os }}-v4-${{ hashFiles('tests/fixtures/sample_binary.rs') }}
- name: Build
run: cargo build --verbose
- name: Build test fixture
run: rustc --edition 2021 -o tests/fixtures/sample_binary tests/fixtures/sample_binary.rs
- name: Setup Ghidra (skip if cached)
run: |
DOCTOR_OUTPUT=$(cargo run -- doctor 2>&1 || true)
echo "$DOCTOR_OUTPUT"
if echo "$DOCTOR_OUTPUT" | grep -q "analyzeHeadless: OK"; then
echo "Ghidra already installed (cache hit), skipping setup"
else
echo "Ghidra not found, running setup..."
cargo run -- setup
fi
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create test project (skip if cached)
run: |
cargo run -- import tests/fixtures/sample_binary --project ci-test --program sample_binary || true
cargo run -- analyze --project ci-test --program sample_binary || true
shell: bash
timeout-minutes: 20
readonly-integration:
needs: ghidra-setup
if: ${{ !cancelled() }}
runs-on: ${{ matrix.os }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Install Java 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust
uses: Swatinem/rust-cache@v2
- name: Restore Ghidra installation and config
uses: actions/cache@v4
with:
path: |
~/.local/share/ghidra-cli
~/.config/ghidra-cli
~/Library/Application Support/ghidra-cli
~/Library/Preferences/ghidra-cli
~/AppData/Local/ghidra-cli
~/AppData/Roaming/ghidra-cli
key: ghidra-${{ matrix.os }}-v5
- name: Restore Ghidra projects
uses: actions/cache@v4
with:
path: |
~/.cache/ghidra-cli/projects
~/Library/Caches/ghidra-cli/projects
~/AppData/Local/ghidra-cli/projects
key: ghidra-projects-${{ matrix.os }}-v4-${{ hashFiles('tests/fixtures/sample_binary.rs') }}
- name: Build
run: cargo build --verbose
- name: Build test fixture
run: rustc --edition 2021 -o tests/fixtures/sample_binary tests/fixtures/sample_binary.rs
- name: Setup Ghidra (fallback if cache missed)
run: |
DOCTOR_OUTPUT=$(cargo run -- doctor 2>&1 || true)
echo "$DOCTOR_OUTPUT"
if echo "$DOCTOR_OUTPUT" | grep -q "analyzeHeadless: OK"; then
echo "Ghidra already installed (cache hit)"
else
echo "Cache miss, running setup..."
cargo run -- setup
fi
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run read-only integration tests
run: cargo test --test readonly_tests --test command_tests --verbose -- --nocapture
timeout-minutes: 80
env:
RUST_LOG: info
mutation-integration:
needs: ghidra-setup
if: ${{ !cancelled() }}
runs-on: ${{ matrix.os }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Install Java 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust
uses: Swatinem/rust-cache@v2
- name: Restore Ghidra installation and config
uses: actions/cache@v4
with:
path: |
~/.local/share/ghidra-cli
~/.config/ghidra-cli
~/Library/Application Support/ghidra-cli
~/Library/Preferences/ghidra-cli
~/AppData/Local/ghidra-cli
~/AppData/Roaming/ghidra-cli
key: ghidra-${{ matrix.os }}-v5
- name: Restore Ghidra projects
uses: actions/cache@v4
with:
path: |
~/.cache/ghidra-cli/projects
~/Library/Caches/ghidra-cli/projects
~/AppData/Local/ghidra-cli/projects
key: ghidra-projects-${{ matrix.os }}-v4-${{ hashFiles('tests/fixtures/sample_binary.rs') }}
- name: Build
run: cargo build --verbose
- name: Build test fixture
run: rustc --edition 2021 -o tests/fixtures/sample_binary tests/fixtures/sample_binary.rs
- name: Setup Ghidra (fallback if cache missed)
run: |
DOCTOR_OUTPUT=$(cargo run -- doctor 2>&1 || true)
echo "$DOCTOR_OUTPUT"
if echo "$DOCTOR_OUTPUT" | grep -q "analyzeHeadless: OK"; then
echo "Ghidra already installed (cache hit)"
else
echo "Cache miss, running setup..."
cargo run -- setup
fi
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run mutation integration tests
run: cargo test --test comment_tests --test symbol_tests --test patch_tests --test type_tests --test script_tests --verbose -- --nocapture
timeout-minutes: 80
env:
RUST_LOG: info
infrastructure:
needs: ghidra-setup
if: ${{ !cancelled() }}
runs-on: ${{ matrix.os }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Install Java 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust
uses: Swatinem/rust-cache@v2
- name: Restore Ghidra installation and config
uses: actions/cache@v4
with:
path: |
~/.local/share/ghidra-cli
~/.config/ghidra-cli
~/Library/Application Support/ghidra-cli
~/Library/Preferences/ghidra-cli
~/AppData/Local/ghidra-cli
~/AppData/Roaming/ghidra-cli
key: ghidra-${{ matrix.os }}-v5
- name: Restore Ghidra projects
uses: actions/cache@v4
with:
path: |
~/.cache/ghidra-cli/projects
~/Library/Caches/ghidra-cli/projects
~/AppData/Local/ghidra-cli/projects
key: ghidra-projects-${{ matrix.os }}-v4-${{ hashFiles('tests/fixtures/sample_binary.rs') }}
- name: Build
run: cargo build --verbose
- name: Build test fixture
run: rustc --edition 2021 -o tests/fixtures/sample_binary tests/fixtures/sample_binary.rs
- name: Setup Ghidra (fallback if cache missed)
run: |
DOCTOR_OUTPUT=$(cargo run -- doctor 2>&1 || true)
echo "$DOCTOR_OUTPUT"
if echo "$DOCTOR_OUTPUT" | grep -q "analyzeHeadless: OK"; then
echo "Ghidra already installed (cache hit)"
else
echo "Cache miss, running setup..."
cargo run -- setup
fi
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run infrastructure tests
run: cargo test --test daemon_tests --test reliability_tests --test project_tests --verbose -- --nocapture
timeout-minutes: 80
env:
RUST_LOG: info