-
-
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.
Signed-off-by: Wiktor Kwapisiewicz <wiktor@metacode.biz>
- Loading branch information
Showing
14 changed files
with
331 additions
and
179 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[codespell] | ||
skip = .cargo,.git,target,Cargo.lock | ||
ignore-words-list = crate,ser |
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 @@ | ||
* text eol=lf |
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 @@ | ||
github: wiktor-k |
This file was deleted.
Oops, something went wrong.
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,44 @@ | ||
name: Misc | ||
|
||
on: | ||
pull_request: | ||
push: | ||
tags: | ||
- 'v*' | ||
branches: [ main ] | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: misc-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
code-coverage: | ||
name: Code coverage | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install code coverage tool | ||
uses: actions-rs/install@v0.1 | ||
with: | ||
crate: cargo-tarpaulin | ||
version: latest | ||
- name: Collect code coverage | ||
run: cargo tarpaulin --out Xml | ||
- name: Upload code coverage | ||
uses: codecov/codecov-action@v2 | ||
|
||
valgrind: | ||
name: Valgrind | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install valgrind | ||
run: sudo apt-get install valgrind | ||
- name: Install cargo-valgrind | ||
uses: actions-rs/install@v0.1 | ||
with: | ||
crate: cargo-valgrind | ||
version: latest | ||
- name: Run valgrind tests | ||
run: cargo valgrind test |
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,86 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
push: | ||
tags: | ||
- 'v*' | ||
branches: [ main ] | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: rust-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
check-spelling: | ||
name: Check spelling | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: cargo install --locked just | ||
- run: sudo apt-get install -y codespell | ||
- name: Check spelling | ||
run: just spelling | ||
|
||
formatting: | ||
name: Check formatting | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
- os: macos-latest | ||
- os: windows-latest | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: cargo install --locked just | ||
- run: rustup install nightly | ||
- run: rustup component add rustfmt --toolchain nightly | ||
- name: Check formatting | ||
run: just formatting | ||
|
||
tests: | ||
name: Unit tests | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
- os: macos-latest | ||
- os: windows-latest | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: cargo install --locked just | ||
- name: Run unit tests | ||
run: just tests | ||
|
||
deps: | ||
name: Check dependencies | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
- os: macos-latest | ||
- os: windows-latest | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: cargo install --locked just cargo-deny | ||
- name: Run dependencies check | ||
run: just dependencies | ||
|
||
lints: | ||
name: Clippy lints | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
- os: macos-latest | ||
- os: windows-latest | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: cargo install --locked just | ||
- name: Check for lints | ||
run: just lints |
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,66 @@ | ||
#!/usr/bin/env -S just --working-directory . --justfile | ||
# Since this is a first recipe it's being run by default. | ||
# Faster checks need to be executed first for better UX. For example | ||
|
||
# codespell is very fast. cargo fmt does not need to download crates etc. | ||
check: spelling formatting lints dependencies tests | ||
|
||
# Checks common spelling mistakes | ||
spelling: | ||
codespell | ||
|
||
# Checks source code formatting | ||
formatting: | ||
just --unstable --fmt --check | ||
# We're using nightly to properly group imports, see .rustfmt.toml | ||
cargo +nightly fmt -- --check | ||
# Lints the source code | ||
lints: | ||
cargo clippy --all -- -D warnings | ||
# Checks for issues with dependencies | ||
dependencies: | ||
cargo deny check | ||
# Runs all unit tests. By default ignored tests are not run. Run with `ignored=true` to run only ignored tests | ||
tests: | ||
cargo test --all | ||
# Checks for commit messages | ||
check-commits REFS='main..': | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
for commit in $(git rev-list "{{ REFS }}"); do | ||
MSG="$(git show -s --format=%B "$commit")" | ||
CODESPELL_RC="$(mktemp)" | ||
git show "$commit:.codespellrc" > "$CODESPELL_RC" | ||
if ! grep -q "Signed-off-by: " <<< "$MSG"; then | ||
printf "Commit %s lacks \"Signed-off-by\" line.\n" "$commit" | ||
printf "%s\n" \ | ||
" Please use:" \ | ||
" git rebase --signoff main && git push --force-with-lease" \ | ||
" See https://developercertificate.org/ for more details." | ||
exit 1; | ||
elif ! codespell --config "$CODESPELL_RC" - <<< "$MSG"; then | ||
printf "The spelling in commit %s needs improvement.\n" "$commit" | ||
exit 1; | ||
else | ||
printf "Commit %s is good.\n" "$commit" | ||
fi | ||
done | ||
# Fixes common issues. Files need to be git add'ed | ||
fix: | ||
#!/usr/bin/env bash | ||
if ! git diff-files --quiet ; then | ||
echo "Working tree has changes. Please stage them: git add ." | ||
exit 1 | ||
fi | ||
|
||
codespell --write-changes | ||
just --unstable --fmt | ||
cargo clippy --fix --allow-staged | ||
|
||
# fmt must be last as clippy's changes may break formatting | ||
cargo +nightly fmt |
File renamed without changes.
Oops, something went wrong.