-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (63 loc) · 2.83 KB
/
Copy pathMakefile
File metadata and controls
81 lines (63 loc) · 2.83 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
SHELL := /bin/sh
GO ?= go
MODULE := github.com/wowdev-org/wowapi-kernel
FUZZ_TIME ?= 5s
.PHONY: status metadata-check source-check format format-check lint test test-race fuzz-smoke docs-check community-health-check api-check dependency-check license-check build release-check ci
status:
@stability=$$(sed -n 's/^stability:[[:space:]]*//p' .wowapi/component.yaml); \
printf 'wowapi-kernel: stability=%s module=%s\n' "$$stability" "$(MODULE)"
metadata-check:
@test -s .wowapi/component.yaml
@test -s README.md
@test -s LICENSE
@test -s docs/architecture.md
@test -s docs/invariants.md
@test "$$(go list -m -f '{{.Path}}')" = "$(MODULE)"
@test "$$(sed -n 's/^module:[[:space:]]*//p' .wowapi/component.yaml)" = "$(MODULE)"
@test "$$(sed -n 's/^repository:[[:space:]]*//p' .wowapi/component.yaml)" = "$(MODULE)"
@stability=$$(sed -n 's/^stability:[[:space:]]*//p' .wowapi/component.yaml); \
test -n "$$stability"; \
test "$$stability" != bootstrap || { echo "ERROR: kernel remains in bootstrap state" >&2; exit 1; }
source-check:
@find . -type f -name '*.go' ! -name '*_test.go' ! -path './test/*' ! -path './vendor/*' -print -quit | grep -q . || { \
echo "ERROR: no production Go source exists" >&2; exit 1; }
format:
@files=$$(find . -type f -name '*.go' ! -path './vendor/*' -print); \
test -n "$$files"; gofmt -w $$files
format-check: source-check
@files=$$(find . -type f -name '*.go' ! -path './vendor/*' -print); \
bad=$$(gofmt -l $$files); \
test -z "$$bad" || { printf '%s\n' "$$bad"; echo "ERROR: run make format" >&2; exit 1; }
lint: source-check
@command -v golangci-lint >/dev/null 2>&1 || { echo "ERROR: pinned golangci-lint is required" >&2; exit 2; }
golangci-lint run ./...
test: source-check
$(GO) test -count=1 ./...
test-race: source-check
$(GO) test -race -count=1 ./...
fuzz-smoke: source-check
FUZZ_TIME="$(FUZZ_TIME)" sh scripts/fuzz-smoke.sh
docs-check:
@test -s README.md
@test -s docs/architecture.md
@test -s docs/invariants.md
@! grep -RniE 'TODO|TBD|placeholder' README.md docs --include='*.md'
community-health-check:
@test -s .github/CODEOWNERS
@if test -d .github/ISSUE_TEMPLATE && find .github/ISSUE_TEMPLATE -type f -print -quit | grep -q .; then \
echo "ERROR: local ISSUE_TEMPLATE files disable the complete WowDev organization default set" >&2; \
exit 1; \
fi
api-check: source-check
sh scripts/api-check.sh
dependency-check: source-check
@command -v govulncheck >/dev/null 2>&1 || { echo "ERROR: pinned govulncheck is required" >&2; exit 2; }
sh scripts/dependency-check.sh
govulncheck ./...
license-check:
@grep -q 'Apache License' LICENSE
@grep -q 'Version 2.0, January 2004' LICENSE
build: source-check
$(GO) build ./...
release-check: metadata-check format-check lint docs-check community-health-check api-check dependency-check license-check test test-race fuzz-smoke build
ci: release-check