-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from tofubert/cleanups
Cleanups
- Loading branch information
Showing
16 changed files
with
242 additions
and
64 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,94 @@ | ||
name: Rust | ||
name: Continuous Integration | ||
|
||
on: | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
push: | ||
branches: [ "main" ] | ||
branches: | ||
- main | ||
pull_request: | ||
branches: [ "main" ] | ||
branches: | ||
- main | ||
merge_group: | ||
|
||
# ensure that the workflow is only triggered once per PR, subsequent pushes to the PR will cancel | ||
# and restart the workflow. See https://docs.github.com/en/actions/using-jobs/using-concurrency | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
build: | ||
rustfmt: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build | ||
run: cargo build --verbose | ||
|
||
test: | ||
- uses: actions/checkout@v4 | ||
- uses: taiki-e/install-action@cargo-make | ||
- uses: Swatinem/rust-cache@v2 | ||
- run: cargo make lint-format | ||
|
||
typos: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run tests | ||
run: cargo test --verbose | ||
- name: Install and run tarpaulin | ||
run: cargo install cargo-tarpaulin && cargo tarpaulin --ignore-tests | ||
|
||
lint: | ||
- uses: actions/checkout@v4 | ||
- uses: taiki-e/install-action@cargo-make | ||
- uses: Swatinem/rust-cache@v2 | ||
- run: cargo make lint-typos | ||
|
||
dependencies: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: EmbarkStudios/cargo-deny-action@v2 | ||
|
||
clippy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: taiki-e/install-action@cargo-make | ||
- uses: Swatinem/rust-cache@v2 | ||
- run: cargo make clippy | ||
|
||
check: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: taiki-e/install-action@cargo-make | ||
- uses: Swatinem/rust-cache@v2 | ||
- run: cargo make check | ||
env: | ||
RUST_BACKTRACE: full | ||
|
||
coverage: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: llvm-tools | ||
- uses: taiki-e/install-action@v2 | ||
with: | ||
tool: cargo-llvm-cov,cargo-make | ||
- uses: Swatinem/rust-cache@v2 | ||
- run: cargo make coverage | ||
- uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
fail_ci_if_error: true | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: lint | ||
run: rustup component add clippy && cargo clippy -- -D warnings | ||
- name: format | ||
run: rustup component add rustfmt && cargo fmt -- --check | ||
- name: audit | ||
run: cargo install cargo-audit && cargo audit | ||
- uses: taiki-e/install-action@v2 | ||
with: | ||
tool: cargo-make | ||
- uses: Swatinem/rust-cache@v2 | ||
- name: Build | ||
run: cargo make build | ||
env: | ||
RUST_BACKTRACE: full |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ devlogs | |
config_*.toml | ||
CONFIG_*.toml | ||
.vscode/settings.json | ||
.pre-commit-config.yaml |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# configuration for https://github.com/sagiegurari/cargo-make | ||
|
||
[config] | ||
skip_core_tasks = true | ||
|
||
[tasks.default] | ||
alias = "ci" | ||
|
||
[tasks.ci] | ||
description = "Run continuous integration tasks" | ||
dependencies = ["lint", "clippy", "check", "test"] | ||
|
||
|
||
[tasks.clippy] | ||
description = "Run Clippy for linting" | ||
command = "cargo" | ||
args = [ | ||
"clippy", | ||
"--all-targets", | ||
"--all-features", | ||
"--tests", | ||
"--benches", | ||
"--", | ||
"-W", | ||
"clippy::pedantic", | ||
"-D", | ||
"warnings", | ||
] | ||
|
||
[tasks.lint] | ||
description = "Lint code style (formatting, typos, docs, markdown)" | ||
dependencies = ["lint-format"] | ||
|
||
[tasks.lint-format] | ||
description = "Lint code formatting" | ||
command = "cargo" | ||
args = ["fmt", "--all", "--check"] | ||
|
||
[tasks.format] | ||
description = "Fix code formatting" | ||
command = "cargo" | ||
args = ["fmt", "--all"] | ||
|
||
[tasks.lint-typos] | ||
description = "Run typo checks" | ||
install_crate = { crate_name = "typos-cli", binary = "typos", test_arg = "--version" } | ||
command = "typos" | ||
|
||
[tasks.audit] | ||
command = "cargo" | ||
install_crate = "cargo-audit" | ||
args = ["audit", "-D", "warnings"] | ||
|
||
|
||
[tasks.check] | ||
description = "Check code for errors and warnings" | ||
command = "cargo" | ||
args = ["check", "--all-targets", "--all-features"] | ||
|
||
[tasks.coverage] | ||
description = "Generate code coverage report" | ||
command = "cargo" | ||
args = [ | ||
"llvm-cov", | ||
"--lcov", | ||
"--output-path", | ||
"target/lcov.info", | ||
] | ||
|
||
[tasks.build] | ||
command = "cargo" | ||
args = ["build"] | ||
dependencies = ["format", "clippy", "audit"] | ||
|
||
[tasks.test] | ||
command = "cargo" | ||
args = ["test"] | ||
dependencies = ["build"] |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
coverage: # https://docs.codecov.com/docs/codecovyml-reference#coverage | ||
precision: 1 # e.g. 89.1% | ||
round: down | ||
range: 85..100 # https://docs.codecov.com/docs/coverage-configuration#section-range | ||
status: # https://docs.codecov.com/docs/commit-status | ||
project: | ||
default: | ||
threshold: 1% # Avoid false negatives | ||
|
||
comment: # https://docs.codecov.com/docs/pull-request-comments | ||
# make the comments less noisy | ||
require_changes: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# configuration for https://github.com/EmbarkStudios/cargo-deny | ||
|
||
[licenses] | ||
confidence-threshold = 0.8 | ||
allow = [ | ||
"Apache-2.0", | ||
"BSD-2-Clause", | ||
"BSD-3-Clause", | ||
"ISC", | ||
"MIT", | ||
"Unicode-DFS-2016", | ||
"GPL-3.0", | ||
] | ||
|
||
[bans] | ||
multiple-versions = "allow" |
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
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
Oops, something went wrong.