-
Notifications
You must be signed in to change notification settings - Fork 13
/
Taskfile.yml
125 lines (108 loc) · 2.54 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
---
# https://taskfile.dev
version: "3"
vars:
GO_LD_FLAGS: -w -s
BINARY_DIR: dist
BINARY_NAME: pipe
BINARY_APPEND_OS: true
BINARY_APPEND_ARCH: true
env:
CGO_ENABLED: 0
tasks:
install:
desc: Installs the required dependencies on pull.
cmds:
- go mod vendor
sources:
- go.{sum,mod}
generates:
- "vendor/**"
format:
desc: Formats the current code base.
cmds:
- goimports -w .
- golangci-lint run --fix
lint:
desc: Lints the codebase with predefined rules.
cmds:
- golangci-lint run
sources:
- "**/*.go"
update:
desc: Updates all the dependencies to their latest minor version.
cmds:
- go get -u all
- task: tidy
tidy:
desc: Tidies the go.mod file.
cmds:
- go mod tidy -compat={{ .GO_VERSION }}
- task: install
sources:
- "go.{mod,sum}"
clean:
desc: Cleans the output binary folder and build cache.
cmds:
- go clean
- rm -f {{ .BINARY_DIR }}
test:
desc: Tests the given application.
cmds:
- go test -v -p 1 ./...
build:
desc: Builds the application.
deps:
- task: build.platform
vars:
os: linux
arch: amd64
- task: build.platform
vars:
os: linux
arch: arm64
build.platform:
internal: true
vars:
binary_output: '{{ .BINARY_DIR }}/{{ .BINARY_NAME }}{{ if .BINARY_APPEND_OS }}-{{ .os }}{{ end }}{{ if .BINARY_APPEND_ARCH }}-{{ .arch }}{{ end }}'
cmds:
- GOOS={{ .os }} GOARCH={{ .arch }} go build -mod=vendor {{- if .GO_LD_FLAGS }} -ldflags="{{ .GO_LD_FLAGS }}"{{- end }} -o {{ .binary_output }}
sources:
- "**/*.go"
- "go.{mod,sum}"
generates:
- "{{ .binary_output }}"
start:
desc: Starts the given application.
interactive: true
env:
LOG_LEVEL: debug
cmds:
- go run . {{ .CLI_ARGS }}
docs:
desc: Generates the documentation for the application.
interactive: true
env:
LOG_LEVEL: trace
cmds:
- go run . MARKDOWN_DOC
- go run . MARKDOWN_EMBED
help:
desc: Generates help for the application.
cmds:
- go run . --help
docker.build:
desc: Builds the docker container for the application for testing.
cmds:
- docker-compose build
sources:
- "dist/**"
- "Dockerfile*"
- "docker-compose*.yml"
docker.up:
desc: Runs the docker-compose application.
interactive: true
cmds:
- task: build
- task: docker.build
- docker-compose up