-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (47 loc) · 1.5 KB
/
Copy pathMakefile
File metadata and controls
63 lines (47 loc) · 1.5 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
SHELL := /bin/sh
GO ?= go
GOLANGCI_LINT ?= golangci-lint
GOLANGCI_VERSION?= v2.11.4
PKG ?= ./...
COVER ?= cover.out
FUZZTIME ?= 30s
.PHONY: all test race vet lint lint-fix spec-lint cover cover-gate fuzz fuzz-smoke tidy clean tools ci
all: vet lint test cover-gate
# ci mirrors the steps run by .github/workflows/ci.yml so that
# `make ci` failing locally implies the same failure in CI.
ci: tools
$(GO) mod verify
$(GO) vet $(PKG)
$(GOLANGCI_LINT) run $(PKG)
$(GO) test -race -count=1 -covermode=atomic -coverprofile=$(COVER) $(PKG)
$(GO) run ./internal/spec/cmd/covergate $(COVER)
$(GO) run ./internal/spec/cmd/speclint
$(GO) test ./wbxml -run='^$$' -fuzz=FuzzDecode -fuzztime=$(FUZZTIME)
test:
$(GO) test -count=1 $(PKG)
race:
$(GO) test -race -count=1 $(PKG)
vet:
$(GO) vet $(PKG)
tools:
@command -v $(GOLANGCI_LINT) >/dev/null 2>&1 || { \
echo "installing golangci-lint $(GOLANGCI_VERSION)"; \
$(GO) install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_VERSION); \
}
lint: tools
$(GOLANGCI_LINT) run $(PKG)
lint-fix: tools
$(GOLANGCI_LINT) run --fix $(PKG)
spec-lint:
$(GO) run ./internal/spec/cmd/speclint
cover:
$(GO) test -race -count=1 -covermode=atomic -coverprofile=$(COVER) $(PKG)
$(GO) tool cover -func=$(COVER) | tail -n 1
cover-gate: cover
$(GO) run ./internal/spec/cmd/covergate $(COVER)
fuzz:
$(GO) test ./wbxml -run='^$$' -fuzz=FuzzDecode -fuzztime=$(FUZZTIME)
tidy:
$(GO) mod tidy
clean:
rm -f $(COVER) cover.html