Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (47 loc) · 1.42 KB
/
Copy pathMakefile
File metadata and controls
56 lines (47 loc) · 1.42 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
GOTEST := go test
TAGS :=
COVERAGE_FILE := coverage.out
FUZZTIME := 5m
.PHONY: codespell
codespell:
@echo "Running codespell"
@codespell
.PHONY: test
test:
@echo "Running tests"
@go test ./... -count=1
.PHONY: testrace
testrace:
@echo "Running tests with race flag"
@go test ./... -count=100 -race
.PHONY: fuzz
fuzz:
@echo "Fuzzing YAML ranges for $(FUZZTIME)"
@go test ./collectors/ -run '^$$' -fuzz '^FuzzYamlRanges$$' -fuzztime $(FUZZTIME)
.PHONY: coverage
coverage:
@echo "Running tests with coverage (excluding internal/testutil)"
go test -tags "$(TAGS)" ./... -v -p 1 -covermode=atomic -coverprofile=$(COVERAGE_FILE) -count=1
@echo "Excluding internal/testutil from coverage report"
@grep -v "internal/testutil" $(COVERAGE_FILE) > $(COVERAGE_FILE).tmp && mv $(COVERAGE_FILE).tmp $(COVERAGE_FILE)
go tool cover -func=$(COVERAGE_FILE)
.PHONY: deps
deps:
@echo "Installing lint deps"
@go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.11.4
@echo "Installing govulncheck"
@go install golang.org/x/vuln/cmd/govulncheck@latest
@echo "Install goveralls"
@go install github.com/mattn/goveralls@latest
.PHONY: coveralls
coveralls:
@echo "uploading coverage to coveralls"
@goveralls -coverprofile=$(COVERAGE_FILE) -service=github
.PHONY: lint
lint:
@echo "Running go-linter"
@golangci-lint run --config=./.golangci.yml ./...
.PHONY: govulncheck
govulncheck:
@echo "Running govulncheck"
@govulncheck ./...