|
| 1 | +.PHONY: help go-test rust-test go-run rust-run go-lint rust-lint go-fmt rust-fmt test-all lint-all fmt-all pre-push |
| 2 | + |
| 3 | +# Default target |
| 4 | +help: |
| 5 | + @echo "Available targets:" |
| 6 | + @echo " make go-test - Run Go tests" |
| 7 | + @echo " make rust-test - Run Rust tests" |
| 8 | + @echo " make go-run - Run Go application" |
| 9 | + @echo " make rust-run - Run Rust application" |
| 10 | + @echo " make go-lint - Run Go linter" |
| 11 | + @echo " make rust-lint - Run Rust linter and formatter check" |
| 12 | + @echo " make go-fmt - Format Go code" |
| 13 | + @echo " make rust-fmt - Format Rust code" |
| 14 | + @echo " make test-all - Run all tests (Go + Rust)" |
| 15 | + @echo " make lint-all - Run all linters (Go + Rust)" |
| 16 | + @echo " make fmt-all - Format all code (Go + Rust)" |
| 17 | + @echo " make pre-push - Run fmt, lint, and test (use before pushing)" |
| 18 | + |
| 19 | +# Go targets |
| 20 | +go-test: |
| 21 | + @echo "Running Go tests..." |
| 22 | + cd src/Backend/opti-sql-go && go test -v ./... |
| 23 | + |
| 24 | +go-test-race: |
| 25 | + @echo "Running Go tests with race detector..." |
| 26 | + cd src/Backend/opti-sql-go && go test -race -v ./... |
| 27 | + |
| 28 | +go-test-coverage: |
| 29 | + @echo "Running Go tests with coverage..." |
| 30 | + cd src/Backend/opti-sql-go && go test -v -coverprofile=coverage.out ./... |
| 31 | + cd src/Backend/opti-sql-go && go tool cover -func=coverage.out |
| 32 | + |
| 33 | +go-run: |
| 34 | + @echo "Running Go application..." |
| 35 | + cd src/Backend/opti-sql-go && go run main.go |
| 36 | + |
| 37 | +go-build: |
| 38 | + @echo "Building Go application..." |
| 39 | + cd src/Backend/opti-sql-go && go build -o opti-sql-go |
| 40 | + |
| 41 | +go-lint: |
| 42 | + @echo "Running Go linter..." |
| 43 | + cd src/Backend/opti-sql-go && golangci-lint run ./... |
| 44 | + |
| 45 | +go-fmt: |
| 46 | + @echo "Formatting Go code..." |
| 47 | + cd src/Backend/opti-sql-go && go fmt ./... |
| 48 | + |
| 49 | +# Rust targets |
| 50 | +rust-test: |
| 51 | + @echo "Running Rust tests..." |
| 52 | + cd src/Backend/opti-sql-rs && cargo test --verbose |
| 53 | + |
| 54 | +rust-run: |
| 55 | + @echo "Running Rust application..." |
| 56 | + cd src/Backend/opti-sql-rs && cargo run |
| 57 | + |
| 58 | +rust-build: |
| 59 | + @echo "Building Rust application..." |
| 60 | + cd src/Backend/opti-sql-rs && cargo build --release |
| 61 | + |
| 62 | +rust-lint: |
| 63 | + @echo "Running Rust linter..." |
| 64 | + cd src/Backend/opti-sql-rs && cargo clippy --all-targets --all-features -- -D warnings |
| 65 | + |
| 66 | +rust-fmt: |
| 67 | + @echo "Formatting Rust code..." |
| 68 | + cd src/Backend/opti-sql-rs && cargo fmt |
| 69 | + |
| 70 | +rust-fmt-check: |
| 71 | + @echo "Checking Rust formatting..." |
| 72 | + cd src/Backend/opti-sql-rs && cargo fmt --check |
| 73 | + |
| 74 | +# Combined targets |
| 75 | +test-all: go-test rust-test |
| 76 | + @echo "All tests completed!" |
| 77 | + |
| 78 | +lint-all: go-lint rust-lint |
| 79 | + @echo "All linting completed!" |
| 80 | + |
| 81 | +fmt-all: go-fmt rust-fmt |
| 82 | + @echo "All formatting completed!" |
| 83 | + |
| 84 | +# Pre-push verification |
| 85 | +pre-push: fmt-all lint-all test-all |
| 86 | + @echo "All checks passed! Ready to push." |
| 87 | + |
| 88 | +# Clean targets |
| 89 | +clean-go: |
| 90 | + @echo "Cleaning Go build artifacts..." |
| 91 | + cd src/Backend/opti-sql-go && go clean |
| 92 | + rm -f src/Backend/opti-sql-go/opti-sql-go |
| 93 | + rm -f src/Backend/opti-sql-go/coverage.out |
| 94 | + |
| 95 | +clean-rust: |
| 96 | + @echo "Cleaning Rust build artifacts..." |
| 97 | + cd src/Backend/opti-sql-rs && cargo clean |
| 98 | + |
| 99 | +clean-all: clean-go clean-rust |
| 100 | + @echo "All build artifacts cleaned!" |
0 commit comments