diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 0000000..1e0015a --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,95 @@ +version: '3' + +tasks: + test: + desc: Run all tests + cmds: + - go test ./... + + test-verbose: + desc: Run all tests with verbose output + cmds: + - go test -v ./... + + test-coverage: + desc: Run tests with coverage report + cmds: + - go test -cover ./... + + test-coverage-html: + desc: Generate HTML coverage report + cmds: + - go test -coverprofile=coverage.out ./... + - go tool cover -html=coverage.out -o coverage.html + - echo Coverage report generated at coverage.html + + test-race: + desc: Run tests with race detection + cmds: + - go test -race ./... + + test-bench: + desc: Run benchmarks + cmds: + - go test -bench=. ./... + + test-pow: + desc: Run only PoW package tests + cmds: + - go test -v ./internal/pow/... + + build: + desc: Build all packages + cmds: + - go build ./... + + clean: + desc: Clean build artifacts and test cache + cmds: + - go clean -cache + - go clean -testcache + - rm -f coverage.out coverage.html + + lint: + desc: Run linter (if available) + cmds: + - | + if command -v golangci-lint >/dev/null 2>&1; then + golangci-lint run + else + echo "golangci-lint not installed, skipping lint" + fi + + fmt: + desc: Format Go code + cmds: + - go fmt ./... + + mod: + desc: Tidy and verify go modules + cmds: + - go mod tidy + - go mod verify + + mocks: + desc: Generate mocks using mockery + cmds: + - mockery + + check: + desc: Run all checks (fmt, build, test, lint) + deps: [fmt, build, test, lint] + + dev: + desc: Development workflow - format, build and test + deps: [fmt, build, test] + + cpu-burner: + desc: Run the CPU burner to stress test PoW solver + cmds: + - go run ./cmd/cpu-burner + + burn: + desc: Alias for cpu-burner + cmds: + - task: cpu-burner