name: Rust CI
on:
workflow_call:
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "23 4 * * 1"
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: "0"
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
jobs:
rust:
name: Rust (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Validate release workflows
if: matrix.os == 'ubuntu-latest'
run: ruby .github/scripts/validate_release_workflows.rb
- name: Setup Rust
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c with:
toolchain: stable
components: rustfmt, clippy
- name: Rust cache
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 with:
key: ${{ matrix.os }}-ci
- name: Check
run: cargo check --all-features --locked
- name: Format
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --all-targets --all-features --locked -- -D warnings
- name: Build
run: cargo build --all-features --locked
- name: Test
run: cargo test --all-features --locked
- name: Loom concurrency model
if: matrix.os == 'ubuntu-latest'
run: cargo test --features loom --lib loom_
- name: Verify crates.io package
if: matrix.os == 'ubuntu-latest'
run: cargo package --locked
- name: Compile benchmarks
if: matrix.os == 'ubuntu-latest'
run: cargo bench --bench performance --locked --no-run
msrv:
name: MSRV 1.88.0
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Setup declared MSRV
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c with:
toolchain: 1.88.0
- name: Rust cache
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 with:
key: msrv-1.88.0
- name: Check with declared MSRV
run: cargo check --all-features --locked
pty:
name: Real PTY and TUI regressions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Setup Rust
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c with:
toolchain: stable
- name: Rust cache
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 with:
key: linux-pty
- name: PTY shell tests
run: cargo test --all-features --locked --test bash_command_pty_test -- --ignored --test-threads=1
- name: PTY integration tests
run: cargo test --all-features --locked --test bash_pty_integration_test -- --ignored --test-threads=1
- name: Live terminal tests
run: cargo test --all-features --locked --test live_tui_test -- --ignored --test-threads=1
- name: File whitelist timing regression
run: cargo test --all-features --locked --test file_write_edit_test test_whitelist_after_read -- --ignored --test-threads=1
security:
name: Dependency security and policy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Setup Rust
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c with:
toolchain: stable
- name: Rust cache
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 with:
key: security-tools
cache-bin: true
- name: Cargo deny
uses: EmbarkStudios/cargo-deny-action@3c6349835b2b7b196a839186cb8b78e02f7b5f25 with:
command: check
arguments: --all-features
- name: Install cargo-audit
run: cargo install cargo-audit --locked --version 0.22.2
- name: RustSec audit
run: cargo audit --deny warnings
fuzz:
name: Fuzz targets compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Setup nightly Rust
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c with:
toolchain: nightly
- name: Rust cache
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 with:
key: fuzz-nightly
workspaces: fuzz -> fuzz/target
cache-bin: true
- name: Install cargo-fuzz
run: cargo install cargo-fuzz --locked --version 0.13.2
- name: Build all fuzz targets
run: cargo +nightly fuzz build
windows:
name: Windows standalone binary
runs-on: windows-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Setup Rust
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c with:
toolchain: stable
- name: Rust cache
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 with:
key: windows-ci
- name: Check supported binary
run: cargo check --all-features --locked --bin winx-code-agent
- name: Build supported release binary
run: cargo build --release --locked --bin winx-code-agent