-
Notifications
You must be signed in to change notification settings - Fork 13
/
Taskfile.yaml
104 lines (87 loc) · 2.55 KB
/
Taskfile.yaml
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
---
version: "3"
vars:
DB: ""
CONFIG: ""
RACE_FLAG: -race={{and (ne OS "windows") (ne ARCH "arm") (ne ARCH "riscv64")}}
tasks:
init-tools:
dir: tools
cmds:
- go mod tidy
- go mod verify
- go generate -x
init-tools-golangci:
dir: tools/golangci
cmds:
- go mod tidy
- go mod verify
- go generate -x
init:
desc: "Install development tools"
deps: [init-tools, init-tools-golangci]
cmds:
- go mod tidy
- go mod verify
fmt:
desc: "Format code"
cmds:
- bin/gofumpt -w ./cmd/ ./internal/
env-up:
desc: "Start development environment"
deps: [env-up-detach]
cmds:
- task: env-logs
env-up-detach:
cmds:
# use -t instead of --timeout / --wait-timeout to be compatible with all versions:
# https://github.com/docker/compose/issues/10269#issuecomment-1495205234
- >
docker compose up --always-recreate-deps --force-recreate --remove-orphans --renew-anon-volumes -t 0 --detach
--build {{.DB}}
env-pull:
cmds:
- docker compose pull
- docker compose build --pull
env-logs:
cmds:
- docker compose ps --all
- docker compose logs --follow
env-logs-collect:
cmds:
- docker compose ps --all
- docker compose logs
env-down:
desc: "Stop development environment"
cmds:
- docker compose down --remove-orphans --volumes
build:
desc: "Build dance tool"
cmds:
- go build -v -o bin/ ./cmd/dance/
test:
desc: "Run unit tests (with caching)"
cmds:
- go test {{.RACE_FLAG}} -shuffle=on ./internal/...
dance:
desc: "Dance!"
deps: [build]
dir: projects
cmds:
- ../bin/dance --database={{.DB}} {{.CONFIG}}
lint:
desc: "Run linters"
cmds:
- bin/golangci-lint run --config=.golangci.yml ./cmd/... ./internal/... ./projects/mongo-tools/...
- bin/golangci-lint run --config=.golangci-new.yml ./cmd/... ./internal/... ./projects/mongo-tools/...
- bin/go-consistent -pedantic ./cmd/... ./internal/... ./projects/mongo-tools/...
godocs:
desc: "Serve Go code documentation"
cmds:
- bin/pkgsite{{exeExt}} -http=127.0.0.1:6060 -open
# see https://github.com/DavidAnson/markdownlint-cli2#command-line for the reason we use double-quotes
docs-fmt:
desc: "Format and lint documentation"
cmds:
- docker compose run --rm textlint --fix --rule one-sentence-per-line "**/*.md" ".github/**/*.md"
- docker compose run --rm markdownlint "**/*.md" "#dumps" "#projects"