-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
104 lines (86 loc) · 3.97 KB
/
Copy pathjustfile
File metadata and controls
104 lines (86 loc) · 3.97 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
96
97
98
99
100
101
102
103
104
golangci_lint_version := "v2.12.0"
secure_go_toolchain := "go1.26.5"
govulncheck_version := "v1.5.0"
gosec_version := "v2.27.1"
# list available recipes
default:
@just --list
# ensure dev tools are installed at the right versions
setup:
@if command -v golangci-lint >/dev/null && golangci-lint --version 2>&1 | grep -q "{{trim_start_match(golangci_lint_version, "v")}}"; then \
echo "golangci-lint {{golangci_lint_version}} already installed"; \
else \
echo "Installing golangci-lint {{golangci_lint_version}}..."; \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b "$(go env GOPATH)/bin" {{golangci_lint_version}}; \
fi
@if command -v govulncheck >/dev/null \
&& govulncheck -version 2>&1 | grep -q "govulncheck@{{govulncheck_version}}" \
&& go version "$(command -v govulncheck)" 2>&1 | grep -q "{{secure_go_toolchain}}"; then \
echo "govulncheck {{govulncheck_version}} already installed"; \
else \
echo "Installing govulncheck {{govulncheck_version}}..."; \
GOTOOLCHAIN={{secure_go_toolchain}} go install golang.org/x/vuln/cmd/govulncheck@{{govulncheck_version}}; \
fi
@if command -v gosec >/dev/null \
&& go version -m "$(command -v gosec)" 2>&1 | grep -q "github.com/securego/gosec/v2[[:space:]]*{{gosec_version}}" \
&& go version "$(command -v gosec)" 2>&1 | grep -q "{{secure_go_toolchain}}"; then \
echo "gosec {{gosec_version}} already installed"; \
else \
echo "Installing gosec {{gosec_version}}..."; \
GOTOOLCHAIN={{secure_go_toolchain}} go install github.com/securego/gosec/v2/cmd/gosec@{{gosec_version}}; \
fi
# run all tests
test:
go test ./...
# run the public, reproducible protocol evidence suite (not NMEA certification)
conformance-local:
go test -count=1 -v . -run '^(TestConformance|TestHeartbeat_|TestISORequest_|TestGroupFunction_|TestProtocolTransmission|TestRequiredProtocol|TestAdvisoryProtocol|TestTCPClientReconnect|TestObservationHub|TestReplayObservation)'
go test -count=1 ./internal/adapter ./internal/claiming ./internal/framer ./internal/gateway ./internal/transport
# compare runtime PGN support against the current upstream schema
upstream-parity:
UPSTREAM_PARITY=1 go test ./pgn -run TestUpstreamParity -count=1 -v
# regenerate upstream source-derived runtime metadata from upstream master
generate-pgn:
go run ./cmd/pgngen
# run tests with verbose output
test-v:
go test -v ./...
# run tests with race detector
test-race:
go test -race ./...
# short, deterministic smoke run of every fuzz harness
fuzz-smoke:
go test ./internal/adapter -run=^$ -fuzz=FuzzCANAdapter -fuzztime=2s
go test ./internal/canbus -run=^$ -fuzz=FuzzUSBCANParseFrames -fuzztime=2s
go test ./internal/gateway -run=^$ -fuzz=FuzzActisenseReader -fuzztime=2s
go test ./pgn -run=^$ -fuzz=FuzzDecodeEncodeMessage -fuzztime=2s
# run tests with coverage
test-cover:
go test -coverpkg=./... -coverprofile=c.out ./...
# format all Go source files
fmt:
gofmt -w .
# regenerate pgn/manifest.json from the initialized runtime PGN metadata
pgn-manifest:
UPDATE_PGN_MANIFEST=1 go test ./pgn -run TestPGNManifestMatchesMetadata -count=1
# sync generated upstream source metadata and regenerate the runtime PGN manifest
pgn-sync:
go run ./cmd/pgngen
UPDATE_PGN_MANIFEST=1 go test ./pgn -run TestPGNManifestMatchesMetadata -count=1
# check whether generated upstream source metadata and runtime PGN manifest are current
pgn-sync-check:
go run ./cmd/pgngen --check
go test ./pgn -run TestPGNManifestMatchesMetadata -count=1
# run go vet
vet:
go vet ./...
# run golangci-lint
lint:
golangci-lint run ./...
# run security review (vulnerability scan + static analysis)
secure:
GOTOOLCHAIN={{secure_go_toolchain}} govulncheck ./...
GOTOOLCHAIN={{secure_go_toolchain}} gosec -exclude-dir=.claude -exclude-generated -exclude=G115 ./...
# tidy go modules
tidy:
go mod tidy