-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTaskfile.yml
More file actions
82 lines (73 loc) · 2.22 KB
/
Taskfile.yml
File metadata and controls
82 lines (73 loc) · 2.22 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
version: '3'
vars:
CORE_DIR: core/
UI_DIR: ui/
IMAGE_BASE: multipacman
# Directory for Go source commands
GO_CMD_DIR: cmd
# Directory for build output
BUILD_DIR: build
tasks:
default:
desc: "Lists all available tasks"
cmds:
- task --list --sort=alphanumeric
ui:
desc: "Build the latest web ui in {{.UI_DIR}}"
dir: "{{.UI_DIR}}"
cmds:
- npm run build
ui:dep:
desc: "calls npm install in {{.UI_DIR}}"
dir: "{{.UI_DIR}}"
cmds:
- npm i
tidy:
desc: "Calls go mod tidy in {{.CORE_DIR}}"
dir: "{{.CORE_DIR}}"
cmds:
- go mod tidy -v -x
go:*:
dir: "{{.BUILD_DIR}}"
desc: "Builds and runs a Go target. Usage: task go:r:<target>"
vars:
CMD_NAME: "{{index .MATCH 0}}"
EXE_EXT: '{{if eq OS "windows"}}.exe{{end}}'
ARGS: '{{if eq .CMD_NAME "updater"}} -cr={{.CMD_NAME}}/compose {{else}} -conf={{.CMD_NAME}}/config -cr={{.CMD_NAME}}/compose{{end}}'
cmds:
- task: go:b:{{.CMD_NAME}}
- ../{{.BUILD_DIR}}/{{.CMD_NAME}}{{.EXE_EXT}}{{.ARGS}}
go:b:*:
dir: "{{.CORE_DIR}}"
desc: "Builds a Go target. Usage: task go:<target>"
vars:
CMD_NAME: "{{index .MATCH 0}}"
EXE_EXT: '{{if eq OS "windows"}}.exe{{end}}'
deps:
- task: init:build
sources:
- "**/*.go"
generates:
- "{{.BUILD_DIR}}/{{.CMD_NAME}}{{.EXE_EXT}}"
cmds:
- go build -v -o ../{{.BUILD_DIR}}/{{.CMD_NAME}}{{.EXE_EXT}} ./{{.GO_CMD_DIR}}/{{.CMD_NAME}}
summary: |
Builds the '{{.CMD_NAME}}' Go command.
Source: '{{.GO_CMD_DIR}}/{{.CMD_NAME}}'
Output: '{{.BUILD_DIR}}/{{.CMD_NAME}}{{.EXE_EXT}}'
dk:b:*:
desc: "Builds the main multipacman image for a specific target. Usage: task dk:<target>"
vars:
TARGET: "{{index .MATCH 0}}"
cmds:
- docker build . -t {{.IMAGE_BASE}}:{{.TARGET}}
preconditions:
- sh: 'test -n "{{.TARGET}}"'
msg: "The 'target' variable must be provided. Usage: task dk.<target-name>"
dk:*:
desc: "Builds and runs the main multipacman image for a specific target. Usage: task dk:r:<target>"
vars:
TARGET: "{{index .MATCH 0}}"
cmds:
- task dk:b:{{.TARGET}}
- docker run --rm -p 11300:11300 {{.IMAGE_BASE}}:{{.TARGET}}