commands #643
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust CI | |
on: | |
pull_request: | |
branches: [ "master" ] | |
push: | |
branches: [ "master" ] | |
workflow_dispatch: | |
concurrency: | |
group: ci-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
env: | |
CARGO_TERM_COLOR: always | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
formatting_and_security: | |
name: Formatting and Security | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo- | |
- name: Cache cargo bin tools | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo/bin | |
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('rust-toolchain.toml') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-bin- | |
- name: Install Rust nightly | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt, clippy | |
- name: Run cargo fmt | |
run: cargo fmt --all -- --check | |
- name: Run Clippy | |
run: cargo clippy --all-targets -- -D warnings | |
- name: Install cargo-audit | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-audit | |
- name: Run Cargo Audit | |
run: cargo audit | |
test: | |
name: Run Tests | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: macos-14 | |
target: aarch64-apple-darwin | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust nightly | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
targets: ${{ matrix.target }} | |
- name: Cache Rust dependencies and build | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-${{ matrix.target }}-rust-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.target }}-rust- | |
- name: Cache cargo bin tools | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo/bin | |
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('rust-toolchain.toml') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-bin- | |
- name: Install cargo-nextest | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-nextest | |
- name: Run Tests | |
run: cargo nextest run --target ${{ matrix.target }} --all-targets --all-features -E "not kind(bench)" |