diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 03e8f44..4f989af 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,25 +1,90 @@
-name: "Test"
+name: "CI Pipeline"
on:
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+ push:
+ branches:
+ - main
pull_request:
+ branches:
+ - main
+# 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
+
+# Make obvious and fast tests to run first, to catch issues as early as possible
jobs:
- check:
- name: "Cargo check"
- runs-on: "ubuntu-latest"
+ # Lint the formatting of the codebase.
+ formatting:
+ name: Check Formatting
+ runs-on: ubuntu-latest
steps:
- - name: "Check out the repo"
- uses: actions/checkout@v3
+ - uses: actions/checkout@v4
+ - uses: dtolnay/rust-toolchain@nightly
+ with: { components: rustfmt }
+ - run: cargo fmt
- - uses: "actions-rs/toolchain@v1"
- with:
- profile: "minimal"
- toolchain: "stable"
- override: true
+ # Check for typos in the codebase.
+ # See
+ lint-typos:
+ name: Check Typos
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: crate-ci/typos@master
- - uses: "actions-rs/cargo@v1"
+ # Check for any disallowed dependencies in the codebase due to license / security issues.
+ # See
+ dependencies:
+ name: Check Dependencies
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: EmbarkStudios/cargo-deny-action@v2
+
+ # Run cargo clippy.
+ lint-clippy:
+ name: Check Clippy
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: dtolnay/rust-toolchain@stable
+ with: { components: clippy }
+ - uses: Swatinem/rust-cache@v2
+ - run: cargo clippy
+
+ # Run markdownlint on all markdown files in the repository.
+ lint-markdown:
+ name: Check Markdown
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: DavidAnson/markdownlint-cli2-action@v17
+ with:
+ globs: |
+ '**/*.md'
+ '!target'
+
+ # Run cargo check. This is a fast way to catch any obvious errors in the code.
+ check:
+ name: Check ${{ matrix.os }} ${{ matrix.toolchain }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest, windows-latest, macos-latest]
+ toolchain: ["1.80", "stable"]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - uses: actions/checkout@v4
+ - uses: dtolnay/rust-toolchain@master
with:
- command: "check"
+ toolchain: ${{ matrix.toolchain }}
+ - uses: Swatinem/rust-cache@v2
+ - run: cargo check
test:
name: "Cargo test"
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index 597af86..8b13789 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -1,38 +1 @@
-name: coverage
-on:
- push:
- branches: [ "main" ]
- pull_request:
- branches: [ "main" ]
-
-env:
- CARGO_TERM_COLOR: always
-
-jobs:
- test:
- name: Test
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
-
- - name: Install Rust
- uses: dtolnay/rust-toolchain@stable
-
- - name: Install cargo-tarpaulin
- uses: taiki-e/install-action@cargo-tarpaulin
-
- - name: Run tests
- run: cargo test
-
- - name: Generate coverage report
- run: |
- cargo tarpaulin --verbose --workspace --timeout 120 --out xml --out html
-
- - name: Upload coverage to Codecov
- uses: codecov/codecov-action@v3
- with:
- token: ${{ secrets.CODECOV_TOKEN }}
- files: ./cobertura.xml
- fail_ci_if_error: true
- verbose: true
diff --git a/codecov.yml b/codecov.yml
new file mode 100644
index 0000000..127c2eb
--- /dev/null
+++ b/codecov.yml
@@ -0,0 +1,14 @@
+coverage: # https://docs.codecov.com/docs/codecovyml-reference#coverage
+ precision: 1 # e.g. 89.1%
+ round: down
+ range: 80..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
+ignore:
+ - "examples"
+ - "benches"
+comment: # https://docs.codecov.com/docs/pull-request-comments
+ # make the comments less noisy
+ require_changes: true