Merge pull request #36 from tgecho/lint #104
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: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
fmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- name: Run fmt | |
run: cargo fmt --all -- --check | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- run: cargo clippy -- --deny clippy::all | |
stable: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@stable | |
- run: cargo build --verbose | |
- run: cargo test --verbose | |
minimum: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/[email protected] | |
- run: cargo build --verbose | |
- run: cargo test --verbose | |
nightly: | |
runs-on: ubuntu-latest | |
env: | |
CARGO_TARGET_DIR: "./target/coverage" | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: llvm-tools-preview | |
- name: Build and test | |
env: | |
CARGO_INCREMENTAL: "0" | |
RUSTFLAGS: "-Cinstrument-coverage -Clink-dead-code" | |
RUSTDOCFLAGS: "-Cinstrument-coverage -Clink-dead-code" | |
LLVM_PROFILE_FILE: "%p-%m.profraw" | |
run: | | |
cargo build --verbose | |
cargo test --verbose | |
- name: Install grcov | |
if: github.repository == 'tgecho/canrun_rs' | |
run: cargo install grcov | |
- name: Collect coverage | |
if: github.repository == 'tgecho/canrun_rs' | |
run: | | |
grcov . -s . \ | |
-t cobertura \ | |
--binary-path "$CARGO_TARGET_DIR/debug" \ | |
--llvm --branch --ignore-not-existing \ | |
-o ./coverage.xml \ | |
--excl-line '// *coverage-ignore' | |
- name: Send to codecov | |
uses: codecov/codecov-action@v4 | |
if: github.repository == 'tgecho/canrun_rs' | |
with: | |
files: ./coverage.xml | |
fail_ci_if_error: true | |
verbose: true | |
token: ${{ secrets.CODECOV_TOKEN }} |