| 1 |
name: Rust |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: [ main ] |
| 6 |
pull_request: |
| 7 |
branches: [ main ] |
| 8 |
|
| 9 |
env: |
| 10 |
CARGO_TERM_COLOR: always |
| 11 |
RUST_VERSION: 1.85.0 |
| 12 |
|
| 13 |
jobs: |
| 14 |
build: |
| 15 |
|
| 16 |
runs-on: ubuntu-latest |
| 17 |
|
| 18 |
steps: |
| 19 |
- uses: actions/checkout@v3 |
| 20 |
- name: Build |
| 21 |
run: cargo build --verbose |
| 22 |
- name: Run tests |
| 23 |
run: cargo test --verbose |
| 24 |
|
| 25 |
cargo-fmt-check: |
| 26 |
runs-on: ubuntu-latest |
| 27 |
steps: |
| 28 |
- uses: actions/checkout@v3 |
| 29 |
- name: Install toolchain |
| 30 |
uses: dtolnay/rust-toolchain@master |
| 31 |
with: |
| 32 |
toolchain: ${{ env.RUST_VERSION }} |
| 33 |
components: rustfmt |
| 34 |
- name: Check Formatting |
| 35 |
run: cargo fmt --all -- --check |
| 36 |
|
| 37 |
cargo-clippy: |
| 38 |
runs-on: ubuntu-latest |
| 39 |
steps: |
| 40 |
- uses: actions/checkout@v3 |
| 41 |
- name: Install toolchain |
| 42 |
uses: dtolnay/rust-toolchain@master |
| 43 |
with: |
| 44 |
toolchain: ${{ env.RUST_VERSION }} |
| 45 |
components: clippy |
| 46 |
- uses: Swatinem/rust-cache@v2 |
| 47 |
- name: Check Clippy Linter |
| 48 |
run: cargo clippy --all-features --all-targets -- -D warnings |