name: Rust
on:
push:
branches: [ MAIN ]
pull_request:
branches: [ MAIN ]
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_PROFILE_TEST_DEBUG: 0
jobs:
build:
runs-on: ubuntu-latest
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- uses: actions/checkout@v4
- name: Install latest stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustc
- name: Sccache Action
uses: Mozilla-Actions/sccache-action@v0.0.9
- name: Build
run: cargo build --locked --release --verbose
- name: Run Tests
run: cargo test --locked --release --verbose
- name: Run Tests (All Features)
run: cargo test --locked --release --verbose --all-features
lints:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install latest stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: 'rustfmt, clippy'
- name: Install clippy-sarif
uses: baptiste0928/cargo-install@v3.3.1
with:
crate: clippy-sarif
- name: Install sarif-fmt
uses: baptiste0928/cargo-install@v3.3.1
with:
crate: sarif-fmt
- name: Format
uses: actions-rs/cargo@v1
with:
command: fmt
args: '-- --check'
- name: Run rust-clippy
run:
cargo clippy --locked
--message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
continue-on-error: true
- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: rust-clippy-results.sarif
category: clippy
wait-for-processing: true
- name: Run rust-clippy for check
run:
cargo clippy --locked -- -D warnings
- name: Format
run:
cargo fmt -- --check