feat: add CI for audit,fmt,test separated from build

This commit is contained in:
Cyrix126 2024-06-07 10:52:32 +02:00
parent 800e36345a
commit 5c47849875
3 changed files with 81 additions and 2 deletions

34
.github/workflows/audit.yml vendored Normal file
View file

@ -0,0 +1,34 @@
# This runs `cargo audit` on all dependencies (only if Cargo deps changed)
name: Audit
on:
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
env:
CARGO_TERM_COLOR: always
jobs:
audit:
runs-on: ubuntu-latest
steps:
- name: Cache
uses: actions/cache@v3.2.3
with:
path: |
~/.cargo
target
key: audit
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: cargo install cargo-audit --locked
- name: Audit
run: cargo audit

View file

@ -44,8 +44,6 @@ jobs:
fi fi
shell: bash shell: bash
- name: Test
run: cargo test --release
- name: Build - name: Build
run: | run: |

47
.github/workflows/rust.yml vendored Normal file
View file

@ -0,0 +1,47 @@
name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Format
run: cargo fmt --all --check
- name: Test
run: cargo test
# Run typo checker separately.
# This will fast-cancel other CI early if this fails.
typo:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Spell Check
uses: crate-ci/typos@master
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Clippy (fail on warnings)
run: cargo clippy --workspace --all-features --all-targets -- -D warnings
- name: Check compilation
run: cargo check --all-features --verbose
- name: Tests
run: cargo test --all-features
- name: Documentation
run: cargo doc --workspace --all-features --no-deps