-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (40 loc) · 2.06 KB
/
Makefile
File metadata and controls
50 lines (40 loc) · 2.06 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
.PHONY: all fmt lint test e2e build clean security release generate-proto
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 && \
if [ "$(CONFIRM)" = "y" ]; then ans=y; else printf "Release $$TAG? [y/N] " && read ans; fi && [ "$$ans" = y ] && \
git tag "$$TAG" && git push origin "$$TAG" && \
GITHUB_TOKEN=$$(gh auth token) goreleaser release --clean
# Requires: go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
# go install connectrpc.com/connect/cmd/protoc-gen-connect-go@latest
# go install github.com/bufbuild/buf/cmd/buf@latest
generate-proto:
buf generate \
--template '{"version":"v2","plugins":[{"remote":"buf.build/protocolbuffers/go","out":"internal/e2e/testpb","opt":"paths=source_relative"},{"remote":"buf.build/connectrpc/go","out":"internal/e2e/testpb","opt":"paths=source_relative"}]}' \
internal/bodydecoder/testdata/test.proto
security:
@echo "==> gosec"
@command -v gosec >/dev/null 2>&1 && gosec -exclude-dir=internal/e2e/testpb ./... || 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)"