-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathTaskfile.yml
111 lines (94 loc) · 2.84 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
---
version: 3
env:
GORACE: halt_on_error=1,history_size=2
GOCOVERDIR: tmp/cover
vars:
BENCH: Benchmark.*
BENCH_TIME: 1s
BENCH_COUNT: 5
FUZZ_TIME: 15s
tasks:
init-tools:
dir: tools
cmds:
- go mod tidy
- go mod verify
- go generate -x
init:
desc: "Install development tools"
deps: [init-tools]
cmds:
- go mod tidy
- go mod verify
env-up-detach:
cmds:
- docker version
- docker compose version
- >
docker compose --file=.dev/docker-compose.yml --project-name=wire
build --pull
- >
docker compose --file=.dev/docker-compose.yml --project-name=wire
up --always-recreate-deps --force-recreate --remove-orphans --renew-anon-volumes --timeout=0 --detach
env-logs:
cmds:
- docker compose --file=.dev/docker-compose.yml --project-name=wire logs
env-logs-follow:
cmds:
- docker compose --file=.dev/docker-compose.yml --project-name=wire logs --follow
env-up:
desc: "Start development environment"
deps: [env-up-detach]
cmds:
- task: env-logs-follow
env-down:
desc: "Stop development environment"
cmds:
- docker compose --file=.dev/docker-compose.yml --project-name=wire down --remove-orphans --volumes
gen:
desc: "Run code generators (and formatters)"
cmds:
- go generate -x ./...
- task: fmt
fmt:
desc: "Run code formatters"
run: once
cmds:
- bin/golangci-lint fmt
lint:
desc: "Run linters"
deps: [fmt]
cmds:
- bin/golangci-lint run
- bin/go-consistent -pedantic . ./wirebson ./wireclient ./internal/...
- bin/govulncheck -test -show=verbose,color ./...
test-short:
desc: "Run short tests"
cmds:
- go test -short -race -coverpkg=./... -coverprofile=cover.txt ./...
test:
desc: "Run all tests (requires MONGODB_URI set)"
cmds:
- go test -race -count=1 -coverpkg=./... -coverprofile=cover.txt ./...
env:
MONGODB_URI: mongodb://localhost:27017/
bench:
desc: "Run benchmarks"
cmds:
- go test -list='{{.BENCH}}' ./wirebson
# -timeout is needed due to https://github.com/golang/go/issues/69181
- go test -bench='{{.BENCH}}' -count={{.BENCH_COUNT}} -benchtime={{.BENCH_TIME}} -timeout=60m ./wirebson | tee new.txt
- bin/benchstat old.txt new.txt
fuzz:
desc: "Run fuzzers for about 1 minute (with default FUZZ_TIME)"
cmds:
- go test -list='Fuzz.*' ./...
- go test -run=XXX -fuzz=FuzzDocument -fuzztime={{.FUZZ_TIME}} ./wirebson
- go test -run=XXX -fuzz=FuzzMsg -fuzztime={{.FUZZ_TIME}} .
- go test -run=XXX -fuzz=FuzzQuery -fuzztime={{.FUZZ_TIME}} .
- go test -run=XXX -fuzz=FuzzReply -fuzztime={{.FUZZ_TIME}} .
godocs:
desc: "Serve Go code documentation"
cmds:
- bin/pkgsite -http=127.0.0.1:6060 -open