Skip to content

Commit a192ca4

Browse files
committed
build(task): rename and optimize tasks
Use `run` and `status`.
1 parent ef76c25 commit a192ca4

File tree

1 file changed

+33
-18
lines changed

1 file changed

+33
-18
lines changed

Taskfile.yml

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
version: '3'
22

33
vars:
4-
pago_agent_cmd_dir: cmd/pago-agent
5-
pago_cmd_dir: cmd/pago
4+
PAGO_AGENT_CMD_DIR: cmd/pago-agent
5+
PAGO_CMD_DIR: cmd/pago
66

77
env:
88
CGO_ENABLED: 0
@@ -21,25 +21,41 @@ tasks:
2121
build:
2222
desc: 'Build all components'
2323
deps:
24-
- build-pago
25-
- build-pago-agent
24+
- build:bin
2625

27-
build-pago:
28-
dir: '{{.pago_cmd_dir}}'
29-
desc: 'Build the pago executable'
26+
build:bin:
27+
desc: 'Build all binaries'
28+
deps:
29+
- build:pago
30+
- build:pago-agent
31+
32+
build:package:
33+
desc: 'Build a single Go package'
34+
internal: true
35+
dir: '{{.PACKAGE}}'
36+
cmds:
37+
- 'go build -trimpath # {{.PACKAGE}}'
38+
39+
build:pago:
40+
desc: 'Build the pago binary'
41+
run: once
3042
cmds:
31-
- cmd: go build -trimpath
43+
- task: build:package
44+
vars:
45+
PACKAGE: '{{.PAGO_CMD_DIR}}'
3246
sources:
3347
- '*.go'
3448
- '../../**/*.go'
3549
generates:
3650
- pago
3751

38-
build-pago-agent:
39-
dir: '{{.pago_agent_cmd_dir}}'
40-
desc: 'Build the pago agent executable'
52+
build:pago-agent:
53+
desc: 'Build the pago agent binary'
54+
run: once
4155
cmds:
42-
- cmd: go build -trimpath
56+
- task: build:package
57+
vars:
58+
PACKAGE: '{{.PAGO_AGENT_CMD_DIR}}'
4359
sources:
4460
- '*.go'
4561
- '../../**/*.go'
@@ -54,9 +70,9 @@ tasks:
5470
- test
5571

5672
clean:
57-
desc: 'Clean up executables'
73+
desc: 'Clean up binaries'
5874
cmds:
59-
- rm -f {{.pago_cmd_dir}}/pago{{exeExt}} {{.pago_agent_cmd_dir}}/pago-agent{{exeExt}}
75+
- rm -f {{.PAGO_CMD_DIR}}/pago {{.PAGO_AGENT_CMD_DIR}}/pago-agent
6076

6177
lint:
6278
desc: 'Run golangci-lint'
@@ -66,14 +82,13 @@ tasks:
6682
release:
6783
desc: 'Prepare a release'
6884
deps:
69-
- build-pago
85+
- build:bin
7086
cmds:
71-
- VERSION=$({{.pago_cmd_dir}}/pago{{exeExt}} version) go run script/release.go
87+
- VERSION=$({{.PAGO_CMD_DIR}}/pago version) go run script/release.go
7288

7389
test:
7490
desc: 'Run tests'
7591
deps:
76-
- build-pago
77-
- build-pago-agent
92+
- build:bin
7893
cmds:
7994
- go test ./...

0 commit comments

Comments
 (0)