mirror of
https://github.com/encounter/ghidra-cli.git
synced 2026-07-10 03:18:56 -07:00
206 lines
5.6 KiB
YAML
206 lines
5.6 KiB
YAML
name: Test
|
|
|
|
on:
|
|
push:
|
|
branches: [main, master]
|
|
pull_request:
|
|
branches: [main, master]
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
# Job 1: Unit tests and CLI tests (no Ghidra needed) - ~2 min
|
|
unit-and-cli:
|
|
runs-on: ${{ matrix.os }}
|
|
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 command_tests --test output_format_integration --verbose
|
|
|
|
# Job 2: Read-only integration tests (one bridge) - ~10-15 min
|
|
readonly-integration:
|
|
runs-on: ${{ matrix.os }}
|
|
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
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.local/share/ghidra-cli
|
|
~/Library/Application Support/ghidra-cli
|
|
~/AppData/Local/ghidra-cli
|
|
key: ghidra-${{ matrix.os }}-v2
|
|
|
|
- name: Cache Ghidra projects
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cache/ghidra-cli/projects
|
|
~/Library/Caches/ghidra-cli/projects
|
|
~/AppData/Local/ghidra-cli/cache/projects
|
|
key: ghidra-projects-${{ matrix.os }}-${{ 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
|
|
run: cargo run -- setup --force
|
|
|
|
- name: Run read-only integration tests
|
|
run: cargo test --test readonly_tests --verbose
|
|
env:
|
|
RUST_LOG: info
|
|
|
|
# Job 3: Mutation tests (parallel with job 2) - ~10-15 min
|
|
mutation-integration:
|
|
runs-on: ${{ matrix.os }}
|
|
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
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.local/share/ghidra-cli
|
|
~/Library/Application Support/ghidra-cli
|
|
~/AppData/Local/ghidra-cli
|
|
key: ghidra-${{ matrix.os }}-v2
|
|
|
|
- name: Cache Ghidra projects
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cache/ghidra-cli/projects
|
|
~/Library/Caches/ghidra-cli/projects
|
|
~/AppData/Local/ghidra-cli/cache/projects
|
|
key: ghidra-projects-${{ matrix.os }}-${{ 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
|
|
run: cargo run -- setup --force
|
|
|
|
- name: Run mutation integration tests
|
|
run: cargo test --test comment_tests --test symbol_tests --test patch_tests --test type_tests --test script_tests --verbose
|
|
env:
|
|
RUST_LOG: info
|
|
|
|
# Job 4: Infrastructure tests (parallel with jobs 2+3) - ~8-10 min
|
|
infrastructure:
|
|
runs-on: ${{ matrix.os }}
|
|
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
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.local/share/ghidra-cli
|
|
~/Library/Application Support/ghidra-cli
|
|
~/AppData/Local/ghidra-cli
|
|
key: ghidra-${{ matrix.os }}-v2
|
|
|
|
- name: Cache Ghidra projects
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cache/ghidra-cli/projects
|
|
~/Library/Caches/ghidra-cli/projects
|
|
~/AppData/Local/ghidra-cli/cache/projects
|
|
key: ghidra-projects-${{ matrix.os }}-${{ 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
|
|
run: cargo run -- setup --force
|
|
|
|
- name: Run infrastructure tests
|
|
run: cargo test --test daemon_tests --test reliability_tests --test project_tests --verbose
|
|
env:
|
|
RUST_LOG: info
|