2026-03-17 20:33:41 +00:00
|
|
|
.PHONY: test test-unit test-e2e test-testscript build run clean fmt lint check-fmt check install
|
2025-06-08 12:02:29 -04:00
|
|
|
|
|
|
|
|
# Test flags - run single-threaded to avoid env var races
|
|
|
|
|
TEST_FLAGS := -- --test-threads=1
|
2025-06-07 20:46:08 -04:00
|
|
|
|
|
|
|
|
# Build the project
|
|
|
|
|
build:
|
2025-06-08 12:02:29 -04:00
|
|
|
cargo build --verbose
|
|
|
|
|
|
2025-06-07 20:46:08 -04:00
|
|
|
# Run the project
|
|
|
|
|
run:
|
|
|
|
|
cargo run
|
|
|
|
|
|
|
|
|
|
# Run all tests
|
|
|
|
|
test: test-unit test-e2e
|
|
|
|
|
|
|
|
|
|
# Run unit tests only
|
|
|
|
|
test-unit:
|
2025-06-08 20:06:14 -04:00
|
|
|
cargo test --verbose --lib --bins $(TEST_FLAGS)
|
2025-06-07 20:46:08 -04:00
|
|
|
|
|
|
|
|
# Run e2e tests only
|
|
|
|
|
test-e2e:
|
2025-06-08 20:06:14 -04:00
|
|
|
cargo test --verbose --test '*' $(TEST_FLAGS)
|
2025-06-07 20:46:08 -04:00
|
|
|
|
2025-10-15 11:56:14 -04:00
|
|
|
# Run testscript tests only
|
|
|
|
|
test-testscript:
|
|
|
|
|
cargo test --verbose --test testscript_test
|
|
|
|
|
|
|
|
|
|
# Install krust to ~/.local/bin
|
|
|
|
|
install:
|
|
|
|
|
@echo "Building krust in release mode..."
|
|
|
|
|
@cargo build --release
|
|
|
|
|
@mkdir -p ~/.local/bin
|
|
|
|
|
@cp target/release/krust ~/.local/bin/krust
|
|
|
|
|
@echo "Installed krust to ~/.local/bin/krust"
|
|
|
|
|
@echo "Make sure ~/.local/bin is in your PATH"
|
|
|
|
|
|
2025-06-07 20:46:08 -04:00
|
|
|
# Clean build artifacts
|
|
|
|
|
clean:
|
|
|
|
|
cargo clean
|
|
|
|
|
|
|
|
|
|
# Format code
|
|
|
|
|
fmt:
|
|
|
|
|
cargo fmt
|
|
|
|
|
|
|
|
|
|
# Run linter
|
|
|
|
|
lint:
|
|
|
|
|
cargo clippy -- -D warnings
|
|
|
|
|
|
|
|
|
|
# Check formatting
|
|
|
|
|
check-fmt:
|
|
|
|
|
cargo fmt -- --check
|
|
|
|
|
|
2025-06-08 12:02:29 -04:00
|
|
|
# Check code (for pre-commit)
|
|
|
|
|
check-code:
|
|
|
|
|
cargo check
|
|
|
|
|
|
2025-06-07 20:46:08 -04:00
|
|
|
# Run all checks (format, lint, test)
|
2025-06-07 21:27:18 -04:00
|
|
|
check: check-fmt lint test
|
2025-06-08 19:42:00 -04:00
|
|
|
|
|
|
|
|
push-ttl:
|
|
|
|
|
@echo "Pushing to ttl.sh..."
|
2025-10-15 14:59:48 -04:00
|
|
|
KRUST_REPO=ttl.sh/krust cargo run build ./example/hello-krust
|
2025-06-08 19:42:00 -04:00
|
|
|
|
|
|
|
|
run-built-image:
|
2025-10-15 14:59:48 -04:00
|
|
|
@image=$$(KRUST_REPO=ttl.sh/krust cargo run build ./example/hello-krust) && \
|
2025-06-08 19:42:00 -04:00
|
|
|
echo "Running image: $$image" && \
|
|
|
|
|
docker run --rm $$image
|