Skip to content

Commit

Permalink
Bring back justfile adjustments from other projects
Browse files Browse the repository at this point in the history
Signed-off-by: Wiktor Kwapisiewicz <[email protected]>
  • Loading branch information
wiktor-k committed Jul 19, 2024
1 parent 9860aa8 commit b204aca
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ubuntu packages
UBUNTU_PACKAGES=
# Windows packages
WINDOWS_PACKAGES=
# macOS packages
MACOS_PACKAGES=
21 changes: 20 additions & 1 deletion .justfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#!/usr/bin/env -S just --working-directory . --justfile
# Load project-specific properties from the `.env` file

set dotenv-load := true

# 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.

# Perform all checks
check: spelling formatting docs lints dependencies tests

# Checks common spelling mistakes
Expand Down Expand Up @@ -31,6 +36,16 @@ tests:
docs:
cargo doc --no-deps

# Installs packages required to build
[linux]
install-packages:
sudo apt-get install --assume-yes --no-install-recommends $UBUNTU_PACKAGES

[macos]
[windows]
install-packages:
echo no-op

# Checks for commit messages
check-commits REFS='main..':
#!/usr/bin/env bash
Expand All @@ -57,13 +72,17 @@ check-commits REFS='main..':
# Fixes common issues. Files need to be git add'ed
fix:
#!/usr/bin/env bash
set -euo pipefail
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
# try to fix rustc issues
cargo fix --allow-staged
# try to fix clippy issues
cargo clippy --fix --allow-staged

# fmt must be last as clippy's changes may break formatting
Expand Down

0 comments on commit b204aca

Please sign in to comment.