Skip to content

Commit

Permalink
Create a Justfile
Browse files Browse the repository at this point in the history
Just[^1] is a modern command runner that makes it easy to define and run
project-specific commands in a project. We use it to define the commands
to format, lint, and test the code.

[^1]: https://github.com/casey/just
  • Loading branch information
jdno committed Mar 17, 2024
1 parent 0784daa commit fbcca0b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ jobs:
if: needs.detect-changes.outputs.any_changed == 'true'

steps:
- name: Install Just
run: sudo snap install --edge --classic just

- name: Checkout code
uses: actions/checkout@v4

Expand All @@ -62,7 +65,7 @@ jobs:
uses: mozilla-actions/[email protected]

- name: Run Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
run: just lint

style:
name: Check style
Expand All @@ -72,11 +75,14 @@ jobs:
if: needs.detect-changes.outputs.any_changed == 'true'

steps:
- name: Install Just
run: sudo snap install --edge --classic just

- name: Checkout code
uses: actions/checkout@v4

- name: Run Rustfmt
run: cargo fmt --all -- --check
run: just format --check

test:
name: Run tests
Expand All @@ -86,6 +92,9 @@ jobs:
if: needs.detect-changes.outputs.any_changed == 'true'

steps:
- name: Install Just
run: sudo snap install --edge --classic just

- name: Checkout code
uses: actions/checkout@v4

Expand All @@ -98,4 +107,4 @@ jobs:
uses: mozilla-actions/[email protected]

- name: Run tests
run: cargo test --all-features --all-targets
run: just test
15 changes: 15 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# List available commands
_default:
just --list

format ARGS:
cargo fmt --all -- {{ARGS}}

lint:
cargo clippy --all-targets --all-features -- -D warnings

run ARGS:
cargo run -- {{ARGS}}

test:
cargo test --all-features --all-targets

0 comments on commit fbcca0b

Please sign in to comment.