forked from ZaparooProject/zaparoo-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.dist.yml
250 lines (222 loc) · 6.73 KB
/
Taskfile.dist.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
version: "3"
env:
GO111MODULE: on
GOPROXY: https://goproxy.io,direct
CGO_ENABLED: 1
CGO_LDFLAGS: -lpcsclite -lnfc -lusb -lcurses
UID:
sh: id -u
GID:
sh: id -g
dotenv: [".env"]
tasks:
build:
cmds:
- go build --ldflags "-linkmode external -extldflags -static -s -w" -o _build/${PLATFORM}_{{ARCH}}/${APP_BIN} ./cmd/$PLATFORM
build-docker-image:
internal: true
cmds:
- docker build --platform linux/{{.ARCH}} --build-arg UID=$UID --build-arg GID=$GID {{default "" .CACHE_ARGS}} -t {{.IMAGE_NAME}} {{.DOCKERFILE}}
build-image-mister:
cmds:
- task: build-docker-image
vars:
IMAGE_NAME: zaparoo/mister-build
DOCKERFILE: "./scripts/mister/build"
ARCH: arm/v7
build-image-mistex:
cmds:
- task: build-docker-image
vars:
IMAGE_NAME: zaparoo/mistex-build
DOCKERFILE: "./scripts/linux_arm64/build"
ARCH: arm64/v8
build-image-batocera-arm64:
cmds:
- task: build-docker-image
vars:
IMAGE_NAME: zaparoo/batocera-arm64-build
DOCKERFILE: "./scripts/linux_arm64/build"
ARCH: arm64/v8
build-image-batocera-amd64:
cmds:
- task: build-docker-image
vars:
IMAGE_NAME: zaparoo/batocera-amd64-build
DOCKERFILE: "./scripts/linux_amd64/build"
ARCH: amd64
build-image-steamos-amd64:
cmds:
- task: build-docker-image
vars:
IMAGE_NAME: zaparoo/steamos-amd64-build
DOCKERFILE: "./scripts/linux_amd64/build"
ARCH: amd64
run-docker:
internal: true
vars:
BUILDCACHE: "{{.HOME}}/.cache/go-build"
GOCACHE: "{{.HOME}}/go"
IMG_BUILDCACHE: /home/build/.cache/go-build
IMG_GOCACHE: /home/build/go
cmds:
- mkdir -p {{.BUILDCACHE}} {{.GOCACHE}}
- docker run --rm --platform linux/{{.DOCKER_ARCH}} -v {{.BUILDCACHE}}:{{.IMG_BUILDCACHE}} -v {{.GOCACHE}}:{{.IMG_GOCACHE}} -v ${PWD}:/build -e PLATFORM={{.PLATFORM}} -e APP_BIN={{.APP_BIN}} {{.EXTRA_DOCKER_ARGS}} {{.IMAGE_NAME}} {{.EXEC}}
build-docker:
internal: true
vars:
BUILD_NAME: "{{.PLATFORM}}{{if .BUILD_ARCH}}_{{.BUILD_ARCH}}{{end}}"
BUILD_DIR: "./_build/{{.BUILD_NAME}}"
ZIP_FULLPATH: "{{.BUILD_DIR}}/zaparoo-{{.BUILD_NAME}}.zip"
cmds:
- task: run-docker
vars:
IMAGE_NAME: "{{.IMAGE_NAME}}"
BUILD_DIR: "{{.BUILD_DIR}}"
DOCKER_ARCH: "{{.DOCKER_ARCH}}"
PLATFORM: "{{.PLATFORM}}"
APP_BIN: "{{.APP_BIN}}"
EXEC: '{{default "task build" .EXEC}}'
EXTRA_DOCKER_ARGS: '{{default "" .EXTRA_DOCKER_ARGS}}'
- rm -f {{.ZIP_FULLPATH}}
- zip -j {{.ZIP_FULLPATH}} {{.BUILD_DIR}}/{{.APP_BIN}}
build-mister-arm:
cmds:
- task: build-image-mister
- task: build-docker
vars:
PLATFORM: mister
BUILD_ARCH: arm
DOCKER_ARCH: arm/v7
IMAGE_NAME: zaparoo/mister-build
APP_BIN: zaparoo.sh
EXEC: build.sh
build-mister-shell:
vars:
BUILDCACHE: "{{.BUILD_DIR}}/.go-buildcache"
GOCACHE: "{{.BUILD_DIR}}/.go-cache"
IMAGE_NAME: zaparoo/mister-build
IMG_BUILDCACHE: /home/build/.cache/go-build
IMG_GOCACHE: /home/build/go
cmds:
- task: build-image-mister
- task: run-docker
vars:
BUILD_DIR: "./_build/mister"
PLATFORM: mister
BUILD_ARCH: arm
DOCKER_ARCH: arm/v7
IMAGE_NAME: zaparoo/mister-build
EXTRA_DOCKER_ARGS: -it
EXEC: bash
build-mistex-arm64:
cmds:
- task: build-image-mistex
- task: build-docker
vars:
PLATFORM: mistex
BUILD_ARCH: arm64
DOCKER_ARCH: arm64/v8
IMAGE_NAME: zaparoo/mistex-build
APP_BIN: zaparoo.sh
build-batocera-arm64:
cmds:
- task: build-image-batocera-arm64
- task: build-docker
vars:
PLATFORM: batocera
BUILD_ARCH: arm64
DOCKER_ARCH: arm64/v8
IMAGE_NAME: zaparoo/batocera-arm64-build
APP_BIN: zaparoo
build-batocera-amd64:
cmds:
- task: build-image-batocera-amd64
- task: build-docker
vars:
PLATFORM: batocera
BUILD_ARCH: amd64
DOCKER_ARCH: amd64
IMAGE_NAME: zaparoo/batocera-amd64-build
APP_BIN: zaparoo
build-steamos-amd64:
cmds:
- task: build-image-steamos-amd64
- task: build-docker
vars:
PLATFORM: steamos
BUILD_ARCH: amd64
DOCKER_ARCH: amd64
IMAGE_NAME: zaparoo/steamos-amd64-build
APP_BIN: zaparoo
build-basic:
internal: true
vars:
BUILD_NAME: "{{if .ARCHLESS}}{{.PLATFORM}}{{else}}{{.PLATFORM}}_{{.BUILD_ARCH}}{{end}}"
BUILD_DIR: "./_build/{{.BUILD_NAME}}"
env:
GOARCH: "{{default .ARCH .BUILD_ARCH}}"
GOOS: '{{default "windows" .BUILD_OS}}'
cmds:
- go build -o {{.BUILD_DIR}}/{{.APP_BIN}} ./cmd/{{.PLATFORM}}
- rm -f {{.BUILD_DIR}}/zaparoo-{{.BUILD_NAME}}.zip
- zip -j {{.BUILD_DIR}}/zaparoo-{{.BUILD_NAME}}.zip {{.BUILD_DIR}}/{{.APP_BIN}}
build-windows-arm64:
cmds:
- task: build-basic
vars:
BUILD_OS: windows
BUILD_ARCH: arm64
GOOS: windows
PLATFORM: windows
APP_BIN: Zaparoo.exe
CGO_ENABLED: 0
build-windows-amd64:
cmds:
- task: build-basic
vars:
BUILD_OS: windows
BUILD_ARCH: amd64
GOOS: windows
PLATFORM: windows
APP_BIN: Zaparoo.exe
CGO_ENABLED: 0
build-mac-arm64:
cmds:
- task: build-basic
vars:
BUILD_OS: darwin
BUILD_ARCH: arm64
PLATFORM: mac
APP_BIN: zaparoo
CGO_ENABLED: 0
build-mac-amd64:
cmds:
- task: build-basic
vars:
BUILD_OS: darwin
BUILD_ARCH: amd64
PLATFORM: mac
APP_BIN: zaparoo
CGO_ENABLED: 0
deploy-mister:
cmds:
- task: build-mister-arm
- scp _build/mister_arm/zaparoo.sh root@${MISTER_IP}:/media/fat/Scripts/zaparoo.sh
- ssh root@${MISTER_IP} /media/fat/Scripts/zaparoo.sh -service restart
deploy-mistex:
cmds:
- task: build-mistex-arm64
- scp _build/mistex_arm64/zaparoo.sh root@${MISTEX_IP}:/media/fat/Scripts/zaparoo.sh
- ssh root@${MISTEX_IP} /media/fat/Scripts/zaparoo.sh -service restart
deploy-steamos:
cmds:
- task: build-steamos-amd64
- scp _build/steamos_amd64/zaparoo deck@${STEAMOS_IP}:/home/deck/zaparoo/zaparoo
clean: rm -rf _build
test: go test ./...
test-coverage:
cmds:
- go test -coverprofile=coverage.out ./...
- go tool cover -html=coverage.out
- rm coverage.out