-
Notifications
You must be signed in to change notification settings - Fork 13
/
justfile
106 lines (84 loc) · 2.65 KB
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
binary-crate := "."
export JUST_ROOT := justfile_directory()
# Default to listing recipes
_default:
@just --list --list-prefix ' > '
# Open project documentation in your local browser
open-docs: (_build-docs "open")
@echo '==> Opening documentation in system browser'
# Fast check project for errors
check:
@echo '==> Checking project for compile errors'
cargo check --workspace
# Build service for development
build:
@echo '==> Building project'
cargo build
# Build project documentation
build-docs: (_build-docs "")
# Run project test suite, skipping storage tests
test:
@echo '==> Testing project (default)'
cargo test --workspace
# Run project test suite, testing all features
test-all:
@echo '==> Testing project (all features)'
cargo test --workspace --all-features
# Run test from project documentation
test-doc:
@echo '==> Testing project docs'
cargo test --workspace --doc
# Clean build artifacts
clean:
@echo '==> Cleaning project target/*'
cargo clean
# Lint the project for any quality issues
lint: check fmt clippy commit-check
# Run project linter
clippy:
#!/bin/bash
set -euo pipefail
if command -v cargo-clippy >/dev/null; then
echo '==> Running clippy'
cargo clippy --workspace --all-features --all-targets -- -D warnings
else
echo '==> clippy not found in PATH, skipping'
echo ' ^^^^^^ To install `rustup component add clippy`, see https://github.com/rust-lang/rust-clippy for details'
fi
# Run code formatting check
fmt:
#!/bin/bash
set -euo pipefail
if command -v cargo-fmt >/dev/null; then
echo '==> Running rustfmt'
cargo +nightly fmt --all
else
echo '==> rustfmt not found in PATH, skipping'
echo ' ^^^^^^ To install `rustup component add rustfmt`, see https://github.com/rust-lang/rustfmt for details'
fi
fmt-imports:
#!/bin/bash
set -euo pipefail
if command -v cargo-fmt >/dev/null; then
echo '==> Running rustfmt'
cargo +nightly fmt -- --config group_imports=StdExternalCrate,imports_granularity=One
else
echo '==> rustfmt not found in PATH, skipping'
fi
unit: lint test test-all
devloop: unit fmt-imports
# Run commit checker
commit-check:
#!/bin/bash
set -euo pipefail
if command -v cog >/dev/null; then
echo '==> Running cog check'
cog check --from-latest-tag
else
echo '==> cog not found in PATH, skipping'
echo ' ^^^ To install `cargo install --locked cocogitto`, see https://github.com/cocogitto/cocogitto for details'
fi
# Build project documentation
_build-docs $open="":
@echo "==> Building project documentation @$JUST_ROOT/target/doc"
@cargo doc --all-features --workspace --no-deps ${open:+--open}