Add code coverage to testing actions and add badge. #37
Workflow file for this run
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: mtrack | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
# Clippy effectively lints the code. | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Update apt | |
run: sudo apt update | |
- name: Install alsa | |
run: sudo apt-get install -y libasound2-dev | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- uses: Swatinem/rust-cache@v2 | |
- name: Run clippy | |
run: cargo clippy --all --all-features | |
# Make sure the code is properly formatted. | |
rustfmt-check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Update apt | |
run: sudo apt update | |
- name: Install alsa | |
run: sudo apt-get install -y libasound2-dev | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
- name: Run rustfmt | |
run: cargo fmt --all -- --check | |
# Make sure the tests pass. | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Update apt | |
run: sudo apt update | |
- name: Install alsa | |
run: sudo apt-get install -y libasound2-dev | |
- uses: dtolnay/rust-toolchain@stable | |
- run: cargo install cargo-tarpaulin | |
- uses: Swatinem/rust-cache@v2 | |
- name: Test mtrack | |
run: cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out xml | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4.0.1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
slug: mdwn/mtrack | |
# Make sure all code has an appropriate license header. | |
licensure: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Install licensure | |
run: cargo install licensure | |
- name: Check for licenses | |
run: licensure --check -p |