Skip to content

Commit

Permalink
chore: collect coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
9renpoto committed Dec 31, 2023
1 parent 3a39022 commit 9b81b86
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 25 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ name: Rust

on:
push:
branches: [main]
pull_request:
branches: [main]

env:
CARGO_TERM_COLOR: always
Expand All @@ -31,16 +29,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
- name: rustup toolchain install
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Install Rust
run: rustup update stable
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Check
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: rustfmt
run: cargo fmt --all --check
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: lcov.info
fail_ci_if_error: true

28 changes: 28 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
repos:
- repo: https://github.com/DevinR528/cargo-sort
rev: v1.0.7
hooks:
- id: cargo-sort
- repo: local
hooks:
- id: fmt
name: fmt
language: system
types: [file, rust]
entry: cargo fmt -- --check
pass_filenames: false

- id: clippy
name: clippy
language: system
types: [file, rust]
entry: cargo clippy --bins --tests --examples --all -- -D rust_2018_idioms -D warnings # Use -D warnings option to ensure the job fails when encountering warnings
pass_filenames: false

- id: test
name: test
language: system
types: [file, rust]
entry: cargo test --lib
pass_filenames: false

9 changes: 0 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
[package]
name = "app"
version = "0.1.0"
authors = ["Keisuke Kan <[email protected]>"]
authors = ["Keisuke Umeno <[email protected]>"]
edition = "2021"

[dependencies]

[dev-dependencies.cargo-husky]
version = "1"
default-features = false
features = ["run-cargo-fmt"]

0 comments on commit 9b81b86

Please sign in to comment.