name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
test:
name: Build & Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
toolchain: [stable]
continue-on-error: false
steps:
- uses: actions/checkout@v4
- name: Update tool chain
run: |
rustup update ${{ matrix.toolchain }}
rustup default ${{ matrix.toolchain }}
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: cargo test
timeout-minutes: 10
run: cargo test -- --nocapture
- name: Print Windows VEH crash file (if present)
if: runner.os == 'Windows'
shell: pwsh
run: |
if (Test-Path "go-lib-crash-veh.txt") {
Write-Host "=== go-lib-crash-veh.txt ==="
Get-Content "go-lib-crash-veh.txt"
} else {
Write-Host "(no crash file — process either did not crash or VEH was not reached)"
}
- name: cargo doc (no deps, no-run)
run: cargo doc --no-deps
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update tool chain
run: |
rustup update
rustup default
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: cargo build
run: cargo build --all-targets
loom:
name: Loom model check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update tool chain
run: |
rustup update
rustup default
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-loom-${{ hashFiles('**/Cargo.lock') }}
- name: cargo test (loom)
env:
RUSTFLAGS: "--cfg loom"
LOOM_MAX_PERMUTATIONS: "10000"
run: cargo test -- --test-threads 1
coverage:
name: Coverage
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
toolchain: [ nightly ]
steps:
- uses: actions/checkout@v4
- name: Update tool chain
run: |
rustup update ${{ matrix.toolchain }}
rustup default ${{ matrix.toolchain }}
rustup component add llvm-tools-preview --toolchain ${{ matrix.toolchain }}
- name: Install coverage tool
run: cargo +stable install cargo-llvm-cov --locked
- name: Test project and generate coverage report
run: cargo llvm-cov --remap-path-prefix --show-missing-lines --branch --doctests --lcov --output-path lcov.info
- name: Publish coverage summary to job summary
uses: livewing/lcov-job-summary@v1.1.0
with:
lcov: lcov.info
- name: Fail build if coverage below 80%
uses: bigmeech/gha-simple-coverage@master
with:
lcov-file-path: lcov.info
fail-if-below: 80