-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (33 loc) · 1.45 KB
/
Makefile
File metadata and controls
42 lines (33 loc) · 1.45 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
.PHONY: all fmt lint test e2e build clean security release
all: lint test build
fmt:
goimports -w .
lint:
golangci-lint run
test:
go test -race -coverprofile=coverage.out ./...
e2e:
go test -v -tags e2e -count=1 -timeout 120s ./internal/e2e/
build:
go build -o httpmon ./cmd/httpmon
clean:
rm -f httpmon coverage.out
release: lint test security
@git fetch --tags origin && \
if [ -n "$(VERSION)" ]; then TAG=$(VERSION); \
else LATEST=$$(git tag -l 'v*' --sort=-v:refname | sed -n '1p'); \
if [ -z "$$LATEST" ]; then TAG=v0.1.0; \
else V=$${LATEST#v}; P=$${V##*.}; TAG=v$${V%.*}.$$((P+1)); fi; \
fi && \
printf "Release $$TAG? [y/N] " && read ans && [ "$$ans" = y ] && \
git tag "$$TAG" && git push origin "$$TAG" && \
GITHUB_TOKEN=$$(gh auth token) goreleaser release --clean
security:
@echo "==> gosec"
@command -v gosec >/dev/null 2>&1 && gosec ./... || echo "gosec not installed (go install github.com/securego/gosec/v2/cmd/gosec@latest)"
@echo "==> govulncheck"
@command -v govulncheck >/dev/null 2>&1 && govulncheck ./... || echo "govulncheck not installed (go install golang.org/x/vuln/cmd/govulncheck@latest)"
@echo "==> gitleaks"
@command -v gitleaks >/dev/null 2>&1 && gitleaks detect --source . --verbose || echo "gitleaks not installed (brew install gitleaks)"
@echo "==> trufflehog"
@command -v trufflehog >/dev/null 2>&1 && trufflehog git file://. --only-verified --fail || echo "trufflehog not installed (brew install trufflehog)"