66# Use bash with strict error handling for all recipes
77set shell := [" bash" , " -euo" , " pipefail" , " -c" ]
88
9- # Default recipe shows available commands
10- default :
11- @ just --list
9+ # GitHub Actions workflow validation (optional)
10+ action-lint :
11+ #!/usr/bin/env bash
12+ set -euo pipefail
13+ if ! command -v actionlint >/ dev/ null; then
14+ echo " ⚠️ 'actionlint' not found. Install: https://github.com/rhysd/actionlint"
15+ exit 0
16+ fi
17+ files=()
18+ while IFS= read -r -d ' ' file; do
19+ files+ =(" $file" )
20+ done < <(git ls-files -z ' .github/workflows/*.yaml' ' .github/workflows/*.yml' )
21+ if [ " ${#files[@]}" -gt 0 ]; then
22+ printf ' %s\0' " ${files[@]}" | xargs -0 actionlint
23+ else
24+ echo " No workflow files found to lint."
25+ fi
26+
27+ # Benchmarks
28+ bench :
29+ cargo bench
30+
31+ bench-compile :
32+ cargo bench --no-run
1233
1334# Build commands
1435build :
@@ -20,81 +41,83 @@ build-release:
2041check :
2142 cargo check
2243
23- # Code quality and formatting
24- fmt :
25- cargo fmt
44+ # CI simulation (matches delaunay's `just ci` shape)
45+ ci : lint test test-integration bench-compile
46+ @ echo " 🎯 CI simulation complete!"
2647
27- fmt-check :
28- cargo fmt --check
48+ clean :
49+ cargo clean
2950
51+ # Code quality and formatting
3052clippy :
3153 cargo clippy --all-targets --all-features -- -D warnings
3254
33- doc-check :
34- RUSTDOCFLAGS=' -D warnings' cargo doc --no-deps
35-
36- # Lint groups (delaunay-style)
37- lint : lint-code lint-docs lint-config
38-
39- lint-code : fmt-check clippy doc-check
55+ # Pre-commit workflow: comprehensive validation before committing
56+ # Runs: linting + all Rust tests (lib + doc + integration) + examples
57+ commit-check : lint test-all examples
58+ @ echo " 🚀 Ready to commit! All checks passed!"
4059
41- lint-docs : spell-check
60+ # Coverage (cargo-tarpaulin)
61+ #
62+ # Common tarpaulin arguments for all coverage runs
63+ # Note: -t 300 sets per-test timeout to 5 minutes (needed for slow CI environments)
64+ _coverage_base_args := ''' --exclude-files 'benches/*' --exclude-files 'examples/*' \
65+ --workspace --lib --tests --all-features \
66+ -t 300 --verbose --implicit-test-threads'''
67+
68+ # Coverage analysis for local development (HTML output)
69+ coverage :
70+ #!/usr/bin/env bash
71+ set -euo pipefail
4272
43- lint-config : action-lint
73+ if ! command -v cargo-tarpaulin >/ dev/ null 2 >&1 ; then
74+ echo " cargo-tarpaulin not found. Install with: cargo install cargo-tarpaulin"
75+ exit 1
76+ fi
4477
45- # Testing (delaunay-style split)
46- # - test: lib + doc tests (fast)
47- # - test-integration: tests/ (if present)
48- # - test-all: everything in Rust
78+ mkdir -p target/ tarpaulin
79+ cargo tarpaulin {{ _coverage_base_args}} --out Html --output-dir target/ tarpaulin
80+ echo " Coverage report generated: target/tarpaulin/tarpaulin-report.html"
4981
50- test :
51- cargo test --lib --verbose
52- cargo test --doc --verbose
82+ # Coverage analysis for CI (XML output for codecov/codacy)
83+ coverage-ci :
84+ #!/usr/bin/env bash
85+ set -euo pipefail
5386
54- test-integration :
55- cargo test --tests --verbose
87+ if ! command -v cargo-tarpaulin >/ dev/ null 2 >&1 ; then
88+ echo " cargo-tarpaulin not found. Install with: cargo install cargo-tarpaulin"
89+ exit 1
90+ fi
5691
57- test-all : test test-integration
58- @ echo " ✅ All tests passed"
92+ mkdir -p coverage
93+ cargo tarpaulin {{ _coverage_base_args }} --out Xml --output-dir coverage
5994
60- # Benchmarks
61- bench :
62- cargo bench
95+ # Default recipe shows available commands
96+ default :
97+ @ just --list
6398
64- bench-compile :
65- cargo bench --no-run
99+ doc-check :
100+ RUSTDOCFLAGS= ' -D warnings' cargo doc --no-deps
66101
67102# Examples
68103examples :
69104 cargo run --quiet --example det_3x3
70105 cargo run --quiet --example solve_3x3
71106
72- # CI simulation (matches delaunay's `just ci` shape)
73- ci : lint test test-integration bench-compile
74- @ echo " 🎯 CI simulation complete!"
107+ fmt :
108+ cargo fmt --all
75109
76- # Pre-commit workflow: comprehensive validation before committing
77- # Runs: linting + all Rust tests (lib + doc + integration) + examples
78- commit-check : lint test-all examples
79- @ echo " 🚀 Ready to commit! All checks passed!"
110+ fmt-check :
111+ cargo fmt --check
80112
81- # GitHub Actions workflow validation (optional)
82- action-lint :
83- #!/usr/bin/env bash
84- set -euo pipefail
85- if ! command -v actionlint >/ dev/ null; then
86- echo " ⚠️ 'actionlint' not found. Install: https://github.com/rhysd/actionlint"
87- exit 0
88- fi
89- files=()
90- while IFS= read -r -d ' ' file; do
91- files+ =(" $file" )
92- done < <(git ls-files -z ' .github/workflows/*.yml' ' .github/workflows/*.yaml' )
93- if [ " ${#files[@]}" -gt 0 ]; then
94- printf ' %s\0' " ${files[@]}" | xargs -0 actionlint
95- else
96- echo " No workflow files found to lint."
97- fi
113+ # Lint groups (delaunay-style)
114+ lint : lint-code lint-docs lint-config
115+
116+ lint-code : fmt-check clippy doc-check
117+
118+ lint-config : action-lint
119+
120+ lint-docs : spell-check
98121
99122# Spell check (cspell)
100123#
@@ -114,5 +137,17 @@ spell-check:
114137 exit 1
115138 fi
116139
117- clean :
118- cargo clean
140+ # Testing (delaunay-style split)
141+ # - test: lib + doc tests (fast)
142+ # - test-all: everything in Rust
143+ # - test-integration: tests/ (if present)
144+
145+ test :
146+ cargo test --lib --verbose
147+ cargo test --doc --verbose
148+
149+ test-all : test test-integration
150+ @ echo " ✅ All tests passed"
151+
152+ test-integration :
153+ cargo test --tests --verbose
0 commit comments