mirror of
https://github.com/Xevion/Pac-Man.git
synced 2026-01-31 02:25:04 -06:00
refactor(just): reorganize recipes with sections and add quality checks
- Group recipes by purpose (Quality, Testing, Performance, Web, Server) - Add check/quick/ci recipes for standard workflows - Add format-check, audit, and smoke test utilities - Simplify docker commands and improve UX
This commit is contained in:
@@ -7,17 +7,63 @@ binary_extension := if os() == "windows" { ".exe" } else { "" }
|
|||||||
default:
|
default:
|
||||||
just --list
|
just --list
|
||||||
|
|
||||||
# Open HTML coverage report
|
# === Quality & Validation ===
|
||||||
html: coverage
|
|
||||||
cargo llvm-cov report \
|
|
||||||
# prevents the absolute path from being used in the generated report
|
|
||||||
--remap-path-prefix \
|
|
||||||
--html \
|
|
||||||
--open
|
|
||||||
|
|
||||||
# Display coverage report
|
# Run all checks (format, lint, test)
|
||||||
report-coverage: coverage
|
check:
|
||||||
cargo llvm-cov report --remap-path-prefix
|
@echo "Running all checks..."
|
||||||
|
@just format-check
|
||||||
|
@just lint
|
||||||
|
@just test
|
||||||
|
@echo "All checks passed!"
|
||||||
|
|
||||||
|
# Quick format + lint for fast iteration
|
||||||
|
quick:
|
||||||
|
cargo fmt --all
|
||||||
|
@cargo clippy --all-targets --all-features --quiet -- -D warnings
|
||||||
|
|
||||||
|
# Full CI pipeline
|
||||||
|
ci: format-check lint test coverage
|
||||||
|
@echo "CI pipeline complete!"
|
||||||
|
|
||||||
|
# Auto-format code
|
||||||
|
format:
|
||||||
|
cargo fmt --all
|
||||||
|
|
||||||
|
# Check formatting without modifying files
|
||||||
|
format-check:
|
||||||
|
cargo fmt --all -- --check
|
||||||
|
|
||||||
|
# Run strict multi-platform lints (desktop + wasm)
|
||||||
|
lint:
|
||||||
|
@echo "Running clippy for desktop target..."
|
||||||
|
@cargo clippy --all-targets --all-features --quiet -- -D warnings
|
||||||
|
@echo "Running clippy for wasm target..."
|
||||||
|
@cargo clippy -p pacman --target wasm32-unknown-emscripten --all-targets --all-features --quiet -- -D warnings
|
||||||
|
@echo "All lints passed!"
|
||||||
|
|
||||||
|
# Fix linting errors & formatting
|
||||||
|
fix:
|
||||||
|
cargo fix --workspace --lib --allow-dirty
|
||||||
|
cargo fmt --all
|
||||||
|
|
||||||
|
# Security audit for vulnerabilities
|
||||||
|
audit:
|
||||||
|
cargo audit
|
||||||
|
|
||||||
|
# Verify required tools are installed
|
||||||
|
smoke:
|
||||||
|
@command -v cargo >/dev/null || (echo "❌ cargo not found" && exit 1)
|
||||||
|
@command -v samply >/dev/null || (echo "❌ samply not found" && exit 1)
|
||||||
|
@command -v bun >/dev/null || (echo "❌ bun not found" && exit 1)
|
||||||
|
@command -v caddy >/dev/null || (echo "❌ caddy not found" && exit 1)
|
||||||
|
@echo "✓ All required tools present!"
|
||||||
|
|
||||||
|
# === Testing & Coverage ===
|
||||||
|
|
||||||
|
# Run tests with nextest
|
||||||
|
test:
|
||||||
|
cargo nextest run --no-fail-fast
|
||||||
|
|
||||||
# Generate baseline LCOV report
|
# Generate baseline LCOV report
|
||||||
coverage:
|
coverage:
|
||||||
@@ -29,34 +75,38 @@ coverage:
|
|||||||
--profile coverage \
|
--profile coverage \
|
||||||
--no-fail-fast nextest
|
--no-fail-fast nextest
|
||||||
|
|
||||||
|
# Display coverage report
|
||||||
|
report-coverage: coverage
|
||||||
|
cargo llvm-cov report --remap-path-prefix
|
||||||
|
|
||||||
|
# Open HTML coverage report
|
||||||
|
html: coverage
|
||||||
|
cargo llvm-cov report \
|
||||||
|
--remap-path-prefix \
|
||||||
|
--html \
|
||||||
|
--open
|
||||||
|
|
||||||
|
# === Performance & Profiling ===
|
||||||
|
|
||||||
# Profile the project using samply
|
# Profile the project using samply
|
||||||
samply:
|
samply:
|
||||||
cargo build --profile profile
|
cargo build --profile profile
|
||||||
samply record ./target/profile/pacman{{ binary_extension }}
|
samply record ./target/profile/pacman{{ binary_extension }}
|
||||||
|
|
||||||
# Build the project for Emscripten
|
# === Web Build (Emscripten) ===
|
||||||
|
|
||||||
|
# Build and serve the web version
|
||||||
web *args:
|
web *args:
|
||||||
bun run pacman/web.build.ts {{args}}
|
bun run pacman/web.build.ts {{args}}
|
||||||
bun run --cwd web build
|
bun run --cwd web build
|
||||||
caddy file-server --root web/dist/client --listen :8547
|
caddy file-server --root web/dist/client --listen :8547
|
||||||
|
|
||||||
# Run strict multi-platform lints (desktop + wasm)
|
# Build web version only (no server)
|
||||||
lint:
|
build-web *args:
|
||||||
@echo "Running clippy for desktop target..."
|
bun run pacman/web.build.ts {{args}}
|
||||||
@cargo clippy --all-targets --all-features --quiet -- -D warnings
|
bun run --cwd web build
|
||||||
@echo "Running clippy for wasm target..."
|
|
||||||
@cargo clippy -p pacman --target wasm32-unknown-emscripten --all-features --quiet -- -D warnings
|
|
||||||
@echo "All lints passed!"
|
|
||||||
|
|
||||||
# Fix linting errors & formatting
|
# === Server (Docker) ===
|
||||||
fix:
|
|
||||||
cargo fix --workspace --lib --allow-dirty
|
|
||||||
cargo fmt --all
|
|
||||||
|
|
||||||
# Push commits & tags
|
|
||||||
push:
|
|
||||||
git push origin --tags;
|
|
||||||
git push
|
|
||||||
|
|
||||||
# Create a postgres container for the server
|
# Create a postgres container for the server
|
||||||
server-postgres:
|
server-postgres:
|
||||||
@@ -64,7 +114,6 @@ server-postgres:
|
|||||||
|
|
||||||
# Build the server image
|
# Build the server image
|
||||||
server-image:
|
server-image:
|
||||||
# build the server image
|
|
||||||
docker build \
|
docker build \
|
||||||
--platform linux/amd64 \
|
--platform linux/amd64 \
|
||||||
--file ./pacman-server/Dockerfile \
|
--file ./pacman-server/Dockerfile \
|
||||||
@@ -73,10 +122,7 @@ server-image:
|
|||||||
|
|
||||||
# Build and run the server in a Docker container
|
# Build and run the server in a Docker container
|
||||||
run-server: server-image
|
run-server: server-image
|
||||||
# remove the server container if it exists
|
docker rm --force --volumes pacman-server 2>/dev/null || true
|
||||||
docker rm --force --volumes pacman-server
|
|
||||||
|
|
||||||
# run the server container
|
|
||||||
docker run \
|
docker run \
|
||||||
--rm \
|
--rm \
|
||||||
--stop-timeout 2 \
|
--stop-timeout 2 \
|
||||||
@@ -85,3 +131,9 @@ run-server: server-image
|
|||||||
--env PORT=3000 \
|
--env PORT=3000 \
|
||||||
--env-file pacman-server/.env \
|
--env-file pacman-server/.env \
|
||||||
pacman-server
|
pacman-server
|
||||||
|
|
||||||
|
# === Utilities ===
|
||||||
|
|
||||||
|
# Clean build artifacts
|
||||||
|
clean:
|
||||||
|
cargo clean
|
||||||
|
|||||||
Reference in New Issue
Block a user