-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathTaskfile.yml
More file actions
127 lines (109 loc) · 3.55 KB
/
Taskfile.yml
File metadata and controls
127 lines (109 loc) · 3.55 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
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
---
version: 3
env:
GORACE: halt_on_error=1,history_size=2
GOCOVERDIR: tmp/cover
vars:
HOST: '{{env "HOST" | default "127.0.0.1"}}'
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 Docker Compose services"
deps: [env-up-detach]
cmds:
- task: env-logs-follow
env-down:
desc: "Stop Docker Compose services"
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 ./... {{.TEST_FLAGS}}
test-all:
# keep in sync with CI's go.yml
desc: "Run all tests for all services"
cmds:
- >
env MONGODB_URI='mongodb://username:password@{{.HOST}}:27017/invalid?authSource=admin&authMechanism=SCRAM-SHA-256'
go test -race -count=1 ./...
- >
env MONGODB_URI='mongodb://username:password@{{.HOST}}:37017/admin?tls=true&tlsCaFile=../.dev/build/certs/rootCA-cert.pem'
go test -race -count=1 ./...
- >
env MONGODB_URI='mongodb://username:password@{{.HOST}}:27018/'
go test -race -count=1 ./...
- >
env MONGODB_URI='mongodb://username:password@{{.HOST}}:27019/?authMechanism=PLAIN'
go test -race -count=1 ./... -ferretdbv1
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