helpers #72
This file contains 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: Fmt, Clippy, Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: 1 | |
jobs: | |
test: | |
name: test | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
node_index: [clippy, fmt, test] | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: 1.78.0 | |
components: rustfmt, clippy | |
- name: Cache cargo dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo- | |
- name: Install cargo-audit | |
run: cargo install cargo-audit | |
- name: Run cargo fmt | |
if: ${{ matrix.node_index == 'fmt' }} | |
run: cargo fmt --all -- --check | |
- name: Run cargo clippy | |
if: ${{ matrix.node_index == 'clippy' }} | |
run: cargo clippy -- -D warnings | |
- name: Run cargo test | |
if: ${{ matrix.node_index == 'test' }} | |
run: cargo test | |
coverage: | |
name: coverage | |
runs-on: ubuntu-latest | |
container: | |
image: xd009642/tarpaulin:develop-nightly | |
options: --security-opt seccomp=unconfined | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Generate code coverage | |
run: | | |
cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out xml | |
- name: Upload to Coveralls | |
uses: coverallsapp/github-action@v2 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
file: cobertura.xml | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: code-coverage-report | |
path: cobertura.xml |