-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMakefile
More file actions
80 lines (68 loc) · 2.75 KB
/
Copy pathMakefile
File metadata and controls
80 lines (68 loc) · 2.75 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
.PHONY: test test-unit test-integration openapi-refresh coverage-gaps coverage-gaps-check coverage-gaps-latest docs-generate docs-check docs-serve
OPENAPI_SOURCE_URL ?= https://api.tailscale.com/api/v2?outputOpenapiSchema=true
OPENAPI_DIR ?= $(CURDIR)/pkg/contract/openapi
OPENAPI_SCHEMA ?= $(OPENAPI_DIR)/tailscale-v2-openapi.yaml
OPENAPI_METADATA ?= $(OPENAPI_DIR)/snapshot-metadata.yaml
OPENAPI_COMMAND_MAP ?= $(OPENAPI_DIR)/command-operation-map.yaml
LEAF_COMMANDS ?= $(CURDIR)/test/cli/testdata/leaf_commands.txt
COVERAGE_DIR ?= $(CURDIR)/coverage
COVERAGE_JSON ?= $(COVERAGE_DIR)/coverage-gaps.json
COVERAGE_MD ?= $(COVERAGE_DIR)/coverage-gaps.md
COVERAGE_DIFF ?= $(COVERAGE_DIR)/coverage-gaps-diff.md
COVERAGE_BASELINE ?= $(COVERAGE_DIR)/coverage-gaps-baseline.json
COVERAGE_EXCLUSIONS ?= $(COVERAGE_DIR)/exclusions.yaml
COVERAGE_PROPERTY_MANIFEST ?= $(COVERAGE_DIR)/property-coverage.yaml
COVERAGE_PROPERTY_EXCLUSIONS ?= $(COVERAGE_DIR)/property-exclusions.yaml
GOCACHE ?= $(CURDIR)/.gocache
GO_RUN = GOCACHE=$(GOCACHE) go run
GO_TEST = GOCACHE=$(GOCACHE) go test
TOOLS_GO_RUN = GOCACHE=$(GOCACHE) go -C tools run
TOOLS_GO_TEST = GOCACHE=$(GOCACHE) go -C tools test
test:
$(GO_TEST) ./...
$(TOOLS_GO_TEST) ./...
test-unit:
$(GO_TEST) ./pkg/...
$(TOOLS_GO_TEST) ./internal/coveragegaps
$(GO_TEST) ./test/cli -run 'Test(Leaf|Version|Config|Do|Load)'
test-integration:
$(GO_TEST) ./test/cli -run 'TestGroupCommandsWithMockedAPI|TestListDevicesOutputModes|TestIntegrationFailsWithoutMockServer'
openapi-refresh:
$(TOOLS_GO_RUN) ./cmd/openapirefresh \
--source-url $(OPENAPI_SOURCE_URL) \
--schema-out $(OPENAPI_SCHEMA) \
--metadata-out $(OPENAPI_METADATA)
coverage-gaps:
$(TOOLS_GO_RUN) ./cmd/coveragegaps \
--openapi $(OPENAPI_SCHEMA) \
--mapping $(OPENAPI_COMMAND_MAP) \
--manifest $(LEAF_COMMANDS) \
--exclusions $(COVERAGE_EXCLUSIONS) \
--property-coverage $(COVERAGE_PROPERTY_MANIFEST) \
--property-exclusions $(COVERAGE_PROPERTY_EXCLUSIONS) \
--json-out $(COVERAGE_JSON) \
--md-out $(COVERAGE_MD) \
--diff-out $(COVERAGE_DIFF) \
--baseline $(COVERAGE_BASELINE)
coverage-gaps-check:
$(TOOLS_GO_RUN) ./cmd/coveragegaps \
--openapi $(OPENAPI_SCHEMA) \
--mapping $(OPENAPI_COMMAND_MAP) \
--manifest $(LEAF_COMMANDS) \
--exclusions $(COVERAGE_EXCLUSIONS) \
--property-coverage $(COVERAGE_PROPERTY_MANIFEST) \
--property-exclusions $(COVERAGE_PROPERTY_EXCLUSIONS) \
--json-out $(COVERAGE_JSON) \
--md-out $(COVERAGE_MD) \
--diff-out $(COVERAGE_DIFF) \
--baseline $(COVERAGE_BASELINE) \
--fail-on-regression \
--fail-on-gaps
coverage-gaps-latest: openapi-refresh
$(MAKE) coverage-gaps-check
docs-generate:
$(GO_RUN) ./coverage/docsgen --mode generate
docs-check:
$(GO_RUN) ./coverage/docsgen --mode check
docs-serve:
docsify serve docs