-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtaskfile.yaml
79 lines (68 loc) · 2.07 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
version: "3"
vars:
GIT_COMMIT:
sh: git rev-parse HEAD
GIT_SHA:
sh: git rev-parse --short HEAD
GIT_BRANCH:
sh: git branch --show-current
LDFLAGS: >-
-X main.version=dev-{{.GIT_SHA}}
-X main.gitCommit={{.GIT_COMMIT}}
-X main.gitBranch={{.GIT_BRANCH}}
-X main.buildDate={{now | date "2006-01-02T15:04:05Z07:00"}}
GOLANG_DAGGER: "github.com/purpleclay/daggerverse/golang"
tasks:
default:
desc: Runs all of the default tasks
cmds:
- task: ci
ci:
desc: Run all CI tasks
cmds:
- task: deps
- task: unit-test
- task: lint
- task: build
deps:
desc: Install all dependencies
cmds:
- go mod tidy
unit-test:
desc: Run the unit tests
vars:
TEST_FORMAT: '{{default "" .TEST_FORMAT}}'
COVER_PROFILE: '{{default "coverage.out" .COVER_PROFILE}}'
TEST_OPTIONS: '{{default "-short -race -vet=off -shuffle=on" .TEST_OPTIONS}}'
cmds:
- go test {{.TEST_OPTIONS}} -covermode=atomic -coverprofile={{.COVER_PROFILE}} {{.TEST_FORMAT}} ./...
golden-test:
desc: Generate golden files
cmds:
- go test ./internal/tui/... -update
lint:
desc: Lint the code using golangci-lint
vars:
REPORT_FORMAT: '{{default "colored-line-number" .REPORT_FORMAT}}'
cmds:
- dagger call -m {{.GOLANG_DAGGER}} --src . lint --format {{.REPORT_FORMAT}}
build:
desc: Build the binary
cmds:
- go build -ldflags '-s -w {{.LDFLAGS}}' .
format:
desc: Format the code using gofumpt
cmds:
- dagger call -m {{.GOLANG_DAGGER}} --src . format export --path .
bench:
desc: Run the benchmarks
vars:
TEST_OPTIONS: '{{default "-bench=. -benchtime 5s -benchmem" .TEST_OPTIONS}}'
cmds:
- go test {{.TEST_OPTIONS}} -run=^# ./...
docs:
desc: Builds and hosts the MkDocs documentation
vars:
MKDOCS_MATERIAL_VERSION: '{{default "9.5.49-insiders-4.53.14-patched" .MKDOCS_MATERIAL_VERSION}}'
cmds:
- docker run --rm -it -p 8000:8000 -v $PWD:/docs ghcr.io/purpleclay/mkdocs-material-insiders:{{.MKDOCS_MATERIAL_VERSION}}