-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathMakefile
More file actions
95 lines (76 loc) 路 3.45 KB
/
Copy pathMakefile
File metadata and controls
95 lines (76 loc) 路 3.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
COVERAGE_THRESHOLD ?= 85.0
.DEFAULT_GOAL := help
.PHONY: help build test test-race fmt lint coverage deps snapshot test-release secrets sqlc check release verify-release release-artifacts clean
help:
@printf '%s\n' \
'Available targets:' \
' help Print available targets (default).' \
' build Build the CLI into bin/wacrawl.' \
' test Run the full Go test suite.' \
' fmt Check formatting with gofumpt.' \
' lint Run every static-analysis gate enforced by CI.' \
' check Run every local gate enforced by CI.' \
' snapshot Build credential-free release artifacts.' \
' release Refuse local publishing and print the official CI command.' \
' verify-release Verify existing release artifacts (VERSION=vX.Y.Z).' \
' coverage Run tests and enforce the coverage floor.' \
' test-race Run the Go test suite with the race detector.' \
' deps Verify modules, tidiness, and vulnerabilities.' \
' test-release Test the macOS release scripts.' \
' secrets Scan Git history and the working tree for secrets.' \
' sqlc Regenerate sqlc output.' \
' release-artifacts Alias for release.' \
' clean Remove local build output.'
build:
mkdir -p bin
GOWORK=off go build -o bin/wacrawl ./cmd/wacrawl
test:
GOWORK=off go test -count=1 ./...
test-race:
GOWORK=off go test -count=1 -race ./...
fmt:
@set -e; \
changed="$$(GOWORK=off go run mvdan.cc/gofumpt@v0.11.0 -l .)"; \
if [ -n "$$changed" ]; then printf 'gofumpt wants changes in:\n%s\n' "$$changed"; exit 1; fi
lint:
golangci-lint run ./...
GOWORK=off go vet ./...
GOWORK=off go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 ./...
@set -e; \
output_file="$$(mktemp)"; \
trap 'rm -f "$$output_file"' 0; \
GOWORK=off go run golang.org/x/tools/cmd/deadcode@v0.48.0 -test ./... > "$$output_file"; \
if [ -s "$$output_file" ]; then cat "$$output_file"; exit 1; fi
GOWORK=off go run github.com/securego/gosec/v2/cmd/gosec@v2.28.0 -exclude=G101,G115,G202,G301,G304 ./...
coverage:
GOWORK=off ./scripts/coverage.sh $(COVERAGE_THRESHOLD)
deps:
GOWORK=off go mod verify
GOWORK=off go mod tidy
git diff --exit-code -- go.mod go.sum
GOWORK=off go run golang.org/x/vuln/cmd/govulncheck@v1.6.0 ./...
snapshot:
GOWORK=off goreleaser release --snapshot --clean --skip=publish
test-release:
bash scripts/test-macos-release.sh
secrets:
GOWORK=off go run github.com/zricethezav/gitleaks/v8@v8.30.1 git --no-banner --redact
GOWORK=off go run github.com/zricethezav/gitleaks/v8@v8.30.1 dir . --no-banner --redact
sqlc:
go run github.com/sqlc-dev/sqlc/cmd/sqlc@v1.31.1 generate
check: fmt lint test test-race coverage build deps snapshot test-release secrets
release:
@test -n "$(VERSION)" || (echo "usage: make release VERSION=vX.Y.Z" >&2; exit 2)
@version="$(VERSION)"; version="$${version#v}"; \
echo "local releases are disabled; official releases run in GitHub Actions" >&2; \
echo "gh workflow run release-unified.yml --repo openclaw/wacrawl --ref main -f version=$$version" >&2; \
exit 1
verify-release:
@test -n "$(VERSION)" || (echo "usage: make verify-release VERSION=vX.Y.Z" >&2; exit 2)
@release_version="$(VERSION)"; \
./scripts/verify-macos-release.sh "$(VERSION)" \
"dist/wacrawl_$${release_version#v}_darwin_arm64.tar.gz" \
"dist/wacrawl_$${release_version#v}_darwin_amd64.tar.gz"
release-artifacts: release
clean:
rm -rf bin