Skip to content

Add CI pipeline for tests, code coverage, linting, formatting, and se… #1

Add CI pipeline for tests, code coverage, linting, formatting, and se…

Add CI pipeline for tests, code coverage, linting, formatting, and se… #1

Workflow file for this run

name: Sample Rust CI Pipeline
on: [push, pull_request]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# not using dtolnay/rust-toolchain@stable
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Run tests
run: cargo test --all-features
fmt: # formatters
name: Check code formatting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Rust rustfmt
run: cargo fmt --all -- --check
clippy: # linting
name: Run Clippy linter
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Rust Clippy
run: cargo clippy -- -D warnings
coverage:
name: Code coverage
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install and run Cargo tarpaulin
run: |
cargo install cargo-tarpaulin
cargo tarpaulin --ignore-tests
security_audit: # uses cargo deny instead of cargo audit
name: Security audit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup toolchain for cargo deny
uses: taiki-e/install-action@cargo-deny
- name: Scan for vulnerabilities
run: cargo deny check advisories