adding github actions for linting and testing #17
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: CI | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache Rust | |
uses: Swatinem/rust-cache@v2 | |
with: | |
save-if: false | |
shared-key: base | |
- name: Install Cargo tools | |
run: | | |
rustup component add rustfmt clippy | |
- name: Check for license headers | |
run: ./ci/lintHeaders.sh | |
- name: "`cargo fmt` check" | |
run: | | |
cargo fmt --all -- --check | |
- name: "Clippy check on" | |
run: | | |
cargo clippy --all-targets -- -D warnings | |
test: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache Rust | |
uses: Swatinem/rust-cache@v2 | |
with: | |
save-if: false | |
shared-key: base | |
- name: Run tests | |
run: | | |
cargo test |