name: CI
on:
pull_request:
branches: [main]
push:
branches:
- main
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
CARGO_TERM_PROGRESS_WHEN: always
CARGO_TERM_PROGRESS_WIDTH: 80
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
format:
name: Format Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rustfmt
- name: Install taplo
uses: taiki-e/install-action@taplo-cli
- name: Check Rust formatting
run: cargo +nightly fmt -- --check
- name: Check TOML formatting
run: taplo fmt --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy, rust-src, rustc-dev, llvm-tools-preview
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Run clippy
run: cargo +stable clippy --all-targets
build:
name: Build Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rust-src, rustc-dev, llvm-tools-preview
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Build release
run: cargo build --release
install-check:
name: Linux Install Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rust-src, rustc-dev, llvm-tools-preview
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Install cargo-mend
run: cargo install --path . --root /tmp/cargo-mend-install
- name: Check installed binary
run: /tmp/cargo-mend-install/bin/cargo-mend --help
- name: Check cargo subcommand wiring
run: PATH="/tmp/cargo-mend-install/bin:$PATH" cargo mend --help
windows-install-check:
name: Windows Install Check
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rust-src, rustc-dev, llvm-tools-preview
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Install cargo-mend
shell: pwsh
run: cargo install --path . --debug --root "$env:RUNNER_TEMP\\cargo-mend-install"
- name: Check installed binary
shell: pwsh
run: |
$sysroot = rustc --print sysroot
$rustHostTriple = (rustc -vV | Select-String '^host: ').ToString().Split(' ')[1]
$toolchainBin = Join-Path $sysroot 'bin'
$rustlibBin = Join-Path $sysroot "lib\rustlib\$rustHostTriple\bin"
$rustlibLib = Join-Path $sysroot "lib\rustlib\$rustHostTriple\lib"
$env:PATH = "$toolchainBin;$rustlibBin;$rustlibLib;$env:PATH"
& "$env:RUNNER_TEMP\cargo-mend-install\bin\cargo-mend.exe" --help
- name: Check cargo subcommand wiring
shell: pwsh
run: |
$sysroot = rustc --print sysroot
$rustHostTriple = (rustc -vV | Select-String '^host: ').ToString().Split(' ')[1]
$toolchainBin = Join-Path $sysroot 'bin'
$rustlibBin = Join-Path $sysroot "lib\rustlib\$rustHostTriple\bin"
$rustlibLib = Join-Path $sysroot "lib\rustlib\$rustHostTriple\lib"
$env:PATH = "$toolchainBin;$rustlibBin;$rustlibLib;$env:PATH"
$env:PATH = "$env:RUNNER_TEMP\cargo-mend-install\bin;$env:PATH"
cargo mend --help
test:
name: Test Suite
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: never
steps:
- uses: actions/checkout@v6
- name: Install Rust stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rust-src, rustc-dev, llvm-tools-preview
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Run tests
run: cargo nextest run
self-check:
name: Self Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rust-src, rustc-dev, llvm-tools-preview
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Run mend on itself
run: cargo run -- --fail-on-warn