Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
130 lines (116 loc) · 2.79 KB
/
Copy pathTaskfile.yml
File metadata and controls
130 lines (116 loc) · 2.79 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
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
126
127
128
129
130
version: 3
vars:
CONTAINER_ENGINE:
sh: |
if command -v docker &> /dev/null; then
echo "docker"
elif command -v podman &> /dev/null; then
echo "podman"
else
echo "No docker or podman found. Please edit Taskfile manually to support your container engine." 1>&2
exit 1
fi
CONTAINER_UP_TIMEOUT: 5
tasks:
install:
desc: Install dependencies for both Go and Vue, and setup containers.
cmds:
- task: install-go
- task: install-vue
- task: up
up:
desc: Setup containers.
cmds:
- task: start-podman
- "{{.CONTAINER_ENGINE}} compose up -d"
- task: sleep-windows:{{.CONTAINER_UP_TIMEOUT}}
- task: sleep-posix:{{.CONTAINER_UP_TIMEOUT}}
- go run ./cmd/migrate
- go run ./cmd/miniosetup
- go run ./cmd/redissetup
silent: true
down:
desc: Teardown containers.
cmds:
- "{{.CONTAINER_ENGINE}} compose down -v"
silent: true
check:
desc: Perform static analysis for both Go and Vue.
cmds:
- task: check-go
- task: check-vue
go:
desc: Start Go server
cmds:
- go run ./cmd/api
interactive: true
silent: true
ignore_error: true
vue:
desc: Start Vue server
dir: "{{.ROOT_DIR}}/web"
cmds:
- pnpm dev
interactive: true
silent: true
ignore_error: true
install-go:
desc: Install Go dependencies
internal: true
cmds:
- go get ./...
silent: true
install-vue:
desc: Install Vue dependencies
internal: true
dir: "{{.ROOT_DIR}}/web"
cmds:
- pnpm install
silent: true
check-go:
desc: Perform Go static analysis
internal: true
cmds:
- go fmt ./...
- go vet ./...
silent: true
check-vue:
desc: Perform Vue static analysis
internal: true
dir: "{{.ROOT_DIR}}/web"
cmds:
- pnpm -s format
- pnpm -s lint:eslint
- pnpm -s type-check
silent: true
sleep-windows:*:
desc: Sleep several seconds (Windows only)
internal: true
platforms:
- windows
cmds:
- powershell -Command "Start-Sleep -Seconds {{index .MATCH 0}}"
silent: true
sleep-posix:*:
desc: Sleep several seconds (POSIX platforms only)
internal: true
platforms:
- linux
- darwin
cmds:
- sleep {{index .MATCH 0}}
silent: true
start-podman:
desc: Start Podman engine because itself does not automatically start.
internal: true
preconditions:
- test "{{.CONTAINER_ENGINE}}" = "podman"
cmd: |
machinestate="$(podman machine info)"
machinestate=${machinestate##*machinestate:}
machinestate=${machinestate%%numberofmachines:*}
if [[ "$machinestate" =~ Running ]]; then
exit 0
fi
podman machine start
silent: true