👷 add test coverage and openssf scorecard #23
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: Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
RUSTFLAGS: -D warnings | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@nightly | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo test -- --nocapture | |
- name: Generate coverage report | |
run: cargo install cargo-tarpaulin && cargo tarpaulin --out Xml | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4.0.1 | |
with: | |
files: ./coverage.xml | |
token: ${{ secrets.CODECOV_TOKEN }} | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@nightly | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo clippy --all --all-features --all-targets -- -D warnings | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo +nightly fmt --all -- --check | |
typos: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: crate-ci/typos@v1.16.23 | |
with: | |
files: . |