name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "30 3 * * 1"
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
permissions:
contents: read
jobs:
msrv:
name: MSRV (Rust 1.85)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.85.0
- uses: Swatinem/rust-cache@v2
- run: cargo test --locked --all-targets
fmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check
clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --locked --all-targets -- -D warnings
build:
name: build (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo build --locked --verbose
- run: cargo build --locked --release --verbose
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Build and verify fixture (Unix)
if: runner.os != 'Windows'
run: |
bash scripts/build-fixtures.sh
fixture=tests/fixtures/dist/sample
test -s "$fixture"
rm -f fixture-report.json
./target/release/rustrip "$fixture" -f json -o fixture-report.json
python -c "import json; value = json.load(open('fixture-report.json', encoding='utf-8')); assert isinstance(value, list), value"
- name: Build and verify fixture (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
./scripts/build-fixtures.ps1
$fixture = "tests/fixtures/dist/sample.exe"
if (-not (Test-Path -LiteralPath $fixture -PathType Leaf) -or (Get-Item -LiteralPath $fixture).Length -le 0) { throw "fixture artifact is empty" }
Remove-Item -LiteralPath fixture-report.json -ErrorAction SilentlyContinue
& ./target/release/rustrip.exe $fixture -f json -o fixture-report.json
if ($LASTEXITCODE -ne 0) { throw "rustrip failed to analyze copied fixture" }
python -c "import json; value = json.load(open('fixture-report.json', encoding='utf-8')); assert isinstance(value, list), value"
- name: Adversarial inputs and known-valid self-analysis (Unix)
if: runner.os != 'Windows'
run: |
python scripts/adversarial_test.py --self-test
python scripts/adversarial_test.py ./target/release/rustrip
python scripts/robustness_test.py ./target/release/rustrip
- name: Adversarial inputs and known-valid self-analysis (Windows)
if: runner.os == 'Windows'
run: |
python scripts/adversarial_test.py --self-test
python scripts/adversarial_test.py ./target/release/rustrip.exe
python scripts/robustness_test.py ./target/release/rustrip.exe
test:
name: test (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo test --locked --all-targets --verbose
audit:
name: cargo-audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo install --locked cargo-audit
- run: cargo audit --deny warnings