-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (52 loc) · 2.21 KB
/
Copy pathMakefile
File metadata and controls
62 lines (52 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
.PHONY: help lint build test test-verbose test-coverage test-coverage-html test-clean install-pre-push-hook uninstall-pre-push-hook
help:
@echo "Available commands:"
@echo " help - Show this help message"
@echo " lint - Run golangci-lint on the codebase"
@echo " build - Build the project"
@echo " test - Run all tests"
@echo " test-verbose - Run all tests with verbose output"
@echo " test-coverage - Run tests with coverage report for each package"
@echo " test-coverage-html - Run tests and generate HTML coverage reports for each package"
@echo " test-clean - Clean test cache and run tests"
@echo " install-pre-push-hook - Install the pre-push git hook"
@echo " uninstall-pre-push-hook - Uninstall the pre-push git hook"
lint:
golangci-lint run ./...
build:
go build -v ./...
test:
@echo "Running all tests..."
go test ./...
test-verbose:
@echo "Running all tests with verbose output..."
go test -v ./...
test-coverage:
@echo "Running tests with coverage report for each package..."
@for pkg in $$(go list ./...); do \
pkgname=$$(echo $$pkg | tr '/' '-'); \
echo "Coverage for $$pkg:"; \
go test -v -coverpkg=$$pkg -coverprofile=coverage-$$pkgname.out $$pkg; \
done
test-coverage-html:
@echo "Running tests and generating HTML coverage reports for each package..."
@for pkg in $$(go list ./...); do \
pkgname=$$(echo $$pkg | tr '/' '-'); \
echo "Coverage for $$pkg:"; \
go test -v -coverpkg=$$pkg -coverprofile=coverage-$$pkgname.out $$pkg; \
go tool cover -html=coverage-$$pkgname.out -o coverage-$$pkgname.html; \
done
@echo "Coverage reports generated: coverage-*.html"
test-clean:
@echo "Cleaning test cache and running tests..."
go clean -testcache && go test -v ./...
install-pre-push-hook:
@echo "Installing pre-push git hook..."
@mkdir -p .git/hooks
@cp scripts/git-pre-push.sh .git/hooks/pre-push
@chmod +x .git/hooks/pre-push
@echo "Pre-push hook installed successfully!"
uninstall-pre-push-hook:
@echo "Uninstalling pre-push git hook..."
@rm -f .git/hooks/pre-push
@echo "Pre-push hook uninstalled successfully!"