-
Notifications
You must be signed in to change notification settings - Fork 1
/
Taskfile.yml
135 lines (114 loc) · 3.35 KB
/
Taskfile.yml
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
version: "3"
vars:
OUT_DIR: ./out
INETMOCK_PKG: inetmock.icb4dc0.de/inetmock/cmd/inetmock
IMCTL_PKG: inetmock.icb4dc0.de/inetmock/cmd/imctl
DOCKER_ENDPOINT:
sh: echo "${DOCKER_ENDPOINT:-localhost}"
env:
GOOS: linux
GOARCH: amd64
CGO_ENABLED: 0
tasks:
default:
desc: By default run tests and build all binaries
cmds:
- task: test
- task: build
clean:
desc: clean all generated files
cmds:
- find . -type f \( -name "*.pb.go" -or -name "*.mock.go" -or -name "*_enum.go" \) -exec rm -f {} \;
- rm -rf ./main {{ .OUT_DIR }}
format:
desc: Format all changed source files
cmds:
- go run github.com/magefile/mage format
dep-graph:
desc: generate dependency graph
sources:
- go.mod
- go.sum
cmds:
- mkdir -p {{ .OUT_DIR }}
- gomod graph "**" | dot -Gdpi=0 -T svg -o {{ .OUT_DIR }}/dependency_graph.svg
lint:
desc: run all linters
cmds:
- go run github.com/magefile/mage testAll
generate:
desc: run all code generation steps
cmds:
- go run github.com/magefile/mage generate
test:
desc: run short running unit tests that do not need sudo
cmds:
- go run github.com/magefile/mage generate testShort
test-all:
desc: run all unit tests
cmds:
- go run github.com/magefile/mage generate testAll
integration-test:
desc: run all benchmarks/integration tests
cmds:
- go run github.com/magefile/mage generate integrationTests
debug-integration-test:
desc: run all benchmarks/integration tests
deps:
- generate
cmds:
- cat testdata/integration.imcs | dlv debug --headless --listen=:2345 --api-version=2 --accept-multiclient ./cmd/imctl -- check run --insecure --target {{ .DOCKER_ENDPOINT }} --log-level debug
cli-cover-report:
desc: generate a coverage report on the CLI
deps:
- test-all
cmds:
- go tool cover -func={{ .OUT_DIR }}/cov.out
html-cover-report:
desc: generate a coverage report as HTML page
deps:
- test-all
cmds:
- go tool cover -html={{ .OUT_DIR }}/cov.out -o {{ .OUT_DIR }}/coverage.html
build-inetmock:
desc: build the INetMock server part
cmds:
- task: build
vars:
TARGET_ID: inetmock
debug-inetmock:
desc: run INetMock server with delve for remote debugging
cmds:
- dlv --listen=:2345 --headless=true --api-version=2 --accept-multiclient --output {{ .OUT_DIR }}/__debug_bin debug {{ .INETMOCK_PKG }} -- serve
build-imctl:
desc: build the imctl INetMock client CLI
cmds:
- task: build
vars:
TARGET_ID: imctl
build:
desc: build all binaries
deps:
- generate
vars:
TARGET_ID: '{{ default "" .TARGET_ID }}'
cmds:
- goreleaser build --single-target --skip-validate --rm-dist {{ if .TARGET_ID }}--id {{ .TARGET_ID }}{{end}}
- mkdir -p {{ .OUT_DIR }}
- cp ./dist/*_linux_amd64/* {{ .OUT_DIR }}
snapshot-release:
desc: create a snapshot/test release without publishing any artifacts
deps:
- generate
cmds:
- goreleaser release --snapshot --skip-publish --rm-dist
release:
desc: create a release - includes artifact publishing
deps:
- generate
cmds:
- goreleaser release --rm-dist
docs:
desc: generate docs
cmds:
- mdbook build -d ./../public ./docs