.PHONY: help all build test lint format clean coverage examples bench install doc ci prepare-publish quality-gate
help:
@echo "Ruchy Language - Development Commands"
@echo ""
@echo "Core Commands:"
@echo " make build - Build the project in release mode"
@echo " make test - Run fast tests only (~5 seconds)"
@echo " make test-all - Run ALL tests including slow ones"
@echo " make test-property - Run property-based tests"
@echo " make test-repl - Run ALL REPL tests (unit, property, fuzz, examples, coverage)"
@echo " make test-nextest - Run tests with nextest (better output)"
@echo " make lint - Run clippy linter"
@echo " make format - Format code with rustfmt"
@echo " make clean - Clean build artifacts"
@echo ""
@echo "Quality Commands:"
@echo " make coverage - Generate test coverage report"
@echo " make quality-gate - Run PMAT quality checks"
@echo " make ci - Run full CI pipeline"
@echo ""
@echo "Development Commands:"
@echo " make examples - Run all examples"
@echo " make bench - Run benchmarks"
@echo " make doc - Generate documentation"
@echo " make install - Install ruchy locally"
@echo ""
@echo "Publishing:"
@echo " make prepare-publish - Prepare for crates.io publication"
@echo " make pre-release-checks - Run all pre-release quality checks"
@echo " make release-patch - Create patch release (bug fixes)"
@echo " make release-minor - Create minor release (new features)"
@echo " make release-major - Create major release (breaking changes)"
@echo " make release-auto - Auto-detect version bump type"
@echo " make crate-release - Publish to crates.io"
build:
@echo "Building Ruchy..."
@cargo build --release
@echo "✓ Build complete"
test:
@echo "Running fast tests only..."
@cargo test --lib --quiet
@echo "✓ Fast tests completed (~5 seconds after initial build)"
test-nextest:
@echo "Running tests with nextest..."
@cargo nextest run --lib --profile quick
@echo "✓ Nextest tests passed"
test-all:
@echo "Running all tests comprehensively (including slow/ignored tests)..."
@cargo test --all-features --workspace -- --include-ignored
@cargo test --doc
@echo "✓ All tests passed"
test-property:
@echo "Running property-based tests..."
@cargo test property_ --lib --release -- --nocapture
@cargo test proptest --lib --release -- --nocapture
@cargo test quickcheck --lib --release -- --nocapture
@echo "✓ Property tests passed"
test-repl:
@echo "════════════════════════════════════════════════════════════════════"
@echo " COMPREHENSIVE REPL TESTING SUITE"
@echo "════════════════════════════════════════════════════════════════════"
@echo ""
@echo "1️⃣ Running REPL unit tests..."
@cargo test repl --lib --quiet || (echo "❌ REPL unit tests failed" && exit 1)
@echo "✅ REPL unit tests passed"
@echo ""
@echo "2️⃣ Running REPL integration tests..."
@cargo test --test repl_commands_test --quiet || (echo "❌ REPL integration tests failed" && exit 1)
@cargo test --test cli_oneliner_tests --quiet || (echo "❌ CLI oneliner tests failed" && exit 1)
@echo "✅ REPL integration tests passed"
@echo ""
@echo "3️⃣ Running REPL property tests..."
@cargo test repl_function_tests::property --lib --release --quiet || (echo "❌ REPL property tests failed" && exit 1)
@echo "✅ REPL property tests passed"
@echo ""
@echo "4️⃣ Running REPL doctests..."
@cargo test --doc runtime::repl --quiet || (echo "❌ REPL doctests failed" && exit 1)
@echo "✅ REPL doctests passed"
@echo ""
@echo "5️⃣ Running REPL examples..."
@cargo run --example repl_demo --quiet || (echo "❌ REPL demo example failed" && exit 1)
@cargo run --example debug_repl --quiet || (echo "❌ Debug REPL example failed" && exit 1)
@echo "✅ REPL examples passed"
@echo ""
@echo "6️⃣ Running REPL fuzz tests (5 seconds)..."
@cargo +nightly fuzz run repl_input -- -max_total_time=5 2>/dev/null || true
@echo "✅ REPL fuzz test completed"
@echo ""
@echo "7️⃣ Generating REPL coverage report..."
@cargo llvm-cov test repl --lib --quiet --no-report
@cargo llvm-cov report --lib --ignore-filename-regex="tests/|benches/|examples/" 2>&1 | grep -E "src/runtime/repl" || true
@echo ""
@echo "════════════════════════════════════════════════════════════════════"
@echo " ✅ ALL REPL TESTS COMPLETED SUCCESSFULLY!"
@echo "════════════════════════════════════════════════════════════════════"
lint:
@echo "Running clippy..."
@cargo clippy --all-targets --all-features -- -D warnings
@echo "✓ Linting complete"
format:
@echo "Formatting code..."
@cargo fmt --all
@echo "✓ Formatting complete"
format-check:
@echo "Checking formatting..."
@cargo fmt --all -- --check
@echo "✓ Format check complete"
clean:
@echo "Cleaning..."
@cargo clean
@rm -rf target/
@rm -rf ~/.ruchy/cache/
@echo "✓ Clean complete"
coverage:
@echo "Generating coverage report with cargo-llvm-cov..."
@cargo install cargo-llvm-cov 2>/dev/null || true
@cargo llvm-cov clean --workspace
@cargo llvm-cov --all-features --workspace --html --output-dir target/coverage/html --ignore-filename-regex "tests/|benches/|examples/"
@cargo llvm-cov report --lcov --output-path target/coverage/lcov.info
@echo "✓ Coverage report generated in target/coverage/html/index.html"
@echo "✓ LCOV report generated in target/coverage/lcov.info"
@echo "Coverage summary:"
@cargo llvm-cov report --summary-only 2>&1 | tail -1
examples:
@echo "Running examples..."
@echo ""
@echo "=== Parser Demo ==="
@cargo run --example parser_demo --quiet
@echo ""
@echo "=== Transpiler Demo ==="
@cargo run --example transpiler_demo --quiet
@echo ""
@echo "✓ All examples complete"
example-scripts:
@echo "Testing Ruchy scripts..."
@cargo run --package ruchy-cli --bin ruchy -- transpile examples/fibonacci.ruchy
@cargo run --package ruchy-cli --bin ruchy -- transpile examples/marco_polo.ruchy
@echo "✓ Script examples complete"
bench:
@echo "Running benchmarks..."
@cargo bench --workspace
@echo "✓ Benchmarks complete"
doc:
@echo "Generating documentation..."
@cargo doc --no-deps --workspace --all-features
@echo "✓ Documentation generated in target/doc"
install:
@echo "Installing ruchy..."
@cargo install --path ruchy-cli --force
@echo "✓ Ruchy installed to ~/.cargo/bin/ruchy"
quality-gate:
@echo "Running PMAT quality checks..."
@~/.local/bin/pmat quality-gate || true
@echo "Checking complexity..."
@~/.local/bin/pmat analyze --metrics complexity src/ || true
@echo "✓ Quality check complete"
ci: format-check lint test-all coverage quality-gate
@echo "✓ CI pipeline complete"
prepare-publish:
@echo "Preparing for crates.io publication..."
@echo "Checking package metadata..."
@cargo publish --dry-run --package ruchy
@cargo publish --dry-run --package ruchy-cli
@echo ""
@echo "Checklist for publication:"
@echo " [ ] Version numbers updated in Cargo.toml"
@echo " [ ] CHANGELOG.md updated"
@echo " [ ] README.md complete with examples"
@echo " [ ] Documentation complete"
@echo " [ ] All tests passing"
@echo " [ ] Coverage > 80%"
@echo " [ ] No clippy warnings"
@echo " [ ] PMAT quality gates passing"
@echo ""
@echo "To publish:"
@echo " cargo publish --package ruchy"
@echo " cargo publish --package ruchy-cli"
dev: format lint test
@echo "✓ Development checks complete"
all: clean build test-all lint format coverage examples bench doc quality-gate
@echo "✓ Full validation complete"
.PHONY: install-release-tools pre-release-checks release-patch release-minor release-major release-auto release-dry crate-release release-verify
install-release-tools:
@echo "📦 Installing release tools..."
@cargo install cargo-release --locked 2>/dev/null || echo "cargo-release already installed"
@cargo install cargo-semver-checks --locked 2>/dev/null || echo "cargo-semver-checks already installed"
@cargo install cargo-audit --locked 2>/dev/null || echo "cargo-audit already installed"
@cargo install cargo-outdated --locked 2>/dev/null || echo "cargo-outdated already installed"
@echo "✅ Release tools installed"
pre-release-checks:
@echo "🔍 Running pre-release checks..."
@echo ""
@echo "1️⃣ Version consistency check..."
@MAIN_VERSION=$$(grep -m1 '^version = ' Cargo.toml | cut -d'"' -f2); \
CLI_VERSION=$$(grep -m1 '^version = ' ruchy-cli/Cargo.toml | cut -d'"' -f2 || echo $$MAIN_VERSION); \
if [ "$$MAIN_VERSION" != "$$CLI_VERSION" ] && [ -n "$$CLI_VERSION" ]; then \
echo "❌ Version mismatch: ruchy=$$MAIN_VERSION, ruchy-cli=$$CLI_VERSION"; \
exit 1; \
fi; \
echo "✅ Versions consistent: $$MAIN_VERSION"
@echo ""
@echo "2️⃣ Running tests..."
@$(MAKE) test-all
@echo ""
@echo "3️⃣ Checking formatting and lints..."
@$(MAKE) format-check
@$(MAKE) lint
@echo ""
@echo "4️⃣ Security audit..."
@cargo audit || echo "⚠️ Some vulnerabilities found (review before release)"
@echo ""
@echo "5️⃣ Checking outdated dependencies..."
@cargo outdated || echo "⚠️ Some dependencies outdated (review before release)"
@echo ""
@echo "6️⃣ Documentation check..."
@cargo doc --no-deps --workspace --all-features --quiet
@echo "✅ Documentation builds successfully"
@echo ""
@echo "7️⃣ Dry-run publish check..."
@cargo publish --dry-run --package ruchy --quiet
@echo "✅ Package ruchy ready for publication"
@cargo publish --dry-run --package ruchy-cli --quiet 2>/dev/null || echo "⚠️ ruchy-cli may need separate publication"
@echo ""
@echo "✅ All pre-release checks completed!"
release-patch: install-release-tools pre-release-checks
@echo "🔖 Creating PATCH release (bug fixes only)..."
@cargo release patch --execute --no-confirm
release-minor: install-release-tools pre-release-checks
@echo "🔖 Creating MINOR release (new features, backward compatible)..."
@cargo release minor --execute --no-confirm
release-major: install-release-tools pre-release-checks
@echo "🔖 Creating MAJOR release (breaking changes)..."
@cargo release major --execute --no-confirm
release-auto: install-release-tools pre-release-checks
@echo "🤖 Auto-determining version bump type..."
@if git log --oneline $$(git describe --tags --abbrev=0 2>/dev/null || echo HEAD~10)..HEAD | grep -qE '^[a-f0-9]+ (feat!|fix!|refactor!|BREAKING)'; then \
echo "💥 Breaking changes detected - MAJOR release"; \
$(MAKE) release-major; \
elif git log --oneline $$(git describe --tags --abbrev=0 2>/dev/null || echo HEAD~10)..HEAD | grep -qE '^[a-f0-9]+ feat:'; then \
echo "✨ New features detected - MINOR release"; \
$(MAKE) release-minor; \
else \
echo "🐛 Bug fixes/patches only - PATCH release"; \
$(MAKE) release-patch; \
fi
release-dry:
@echo "🧪 Dry run for release..."
@cargo release patch --dry-run
crate-release:
@echo "📦 Publishing to crates.io..."
@echo "Current version: $$(grep '^version' Cargo.toml | head -1 | cut -d'"' -f2)"
@echo ""
@echo "Pre-publish checklist:"
@echo " ✓ Version bumped in Cargo.toml"
@echo " ✓ CHANGELOG.md updated"
@echo " ✓ All tests passing"
@echo " ✓ Documentation builds"
@echo ""
@printf "Continue with publish? [y/N] "; \
read REPLY; \
case "$$REPLY" in \
[yY]*) \
echo "Publishing ruchy..."; \
cargo publish --package ruchy; \
echo "Waiting 30 seconds for crates.io to index..."; \
sleep 30; \
echo "Publishing ruchy-cli..."; \
cargo publish --package ruchy-cli || echo "ruchy-cli may already be published or needs manual intervention"; \
;; \
*) echo "❌ Publish cancelled" ;; \
esac
release-verify:
@echo "🔍 Verifying release..."
@LATEST_TAG=$$(git describe --tags --abbrev=0); \
echo "Latest tag: $$LATEST_TAG"; \
CRATE_VERSION=$$(cargo search ruchy | head -1 | cut -d'"' -f2); \
echo "Crates.io version: $$CRATE_VERSION"; \
echo ""; \
echo "📦 Testing installation from crates.io..."; \
cargo install ruchy --force && ruchy --version; \
echo "✅ Release verification complete!"