-
Notifications
You must be signed in to change notification settings - Fork 13
/
Taskfile.dist.yml
149 lines (130 loc) · 5.3 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
version: "3"
env:
GO111MODULE: on
GOPROXY: https://goproxy.io,direct
CGO_ENABLED: 1
CGO_LDFLAGS: -lpcsclite -lnfc -lusb -lcurses
dotenv: [".env"]
tasks:
build:
cmds:
- go build --ldflags "-linkmode external -extldflags -static -s -w" -o _build/${PLATFORM}_{{ARCH}}/${TAPTO_BIN} ./cmd/$PLATFORM
build-image-mister:
vars:
IMAGE_NAME: tapto/mister-build
DOCKERFILE: "./scripts/mister/build"
cmds:
- docker build --platform linux/arm/v7 -t {{.IMAGE_NAME}} {{.DOCKERFILE}}
build-image-mistex:
vars:
IMAGE_NAME: tapto/mistex-build
DOCKERFILE: "./scripts/linux_arm64/build"
cmds:
- docker build --platform linux/arm/v8 -t {{.IMAGE_NAME}} {{.DOCKERFILE}}
build-image-batocera-arm64:
vars:
IMAGE_NAME: tapto/batocera-arm64-build
DOCKERFILE: "./scripts/linux_arm64/build"
cmds:
- docker build --platform linux/arm/v8 -t {{.IMAGE_NAME}} {{.DOCKERFILE}}
build-image-batocera-amd64:
vars:
IMAGE_NAME: tapto/batocera-amd64-build
DOCKERFILE: "./scripts/linux_amd64/build"
cmds:
- docker build --platform linux/amd64 -t {{.IMAGE_NAME}} {{.DOCKERFILE}}
build-mister:
vars:
BUILD_DIR: "./_build/mister_arm"
BUILDCACHE: "{{.BUILD_DIR}}/.go-buildcache"
MODCACHE: "{{.BUILD_DIR}}/.go-modcache"
IMAGE_NAME: tapto/mister-build
IMG_BUILDCACHE: /home/build/.cache/go-build
IMG_MODCACHE: /home/build/go/pkg/mod
cmds:
- docker run --rm --platform linux/arm/v7 -v {{.BUILDCACHE}}:{{.IMG_BUILDCACHE}} -v {{.MODCACHE}}:{{.IMG_MODCACHE}} -v ${PWD}:/build --user 1000:1000 {{.IMAGE_NAME}} build.sh
- rm -f {{.BUILD_DIR}}/tapto-mister_arm.zip
- zip -j {{.BUILD_DIR}}/tapto-mister_arm.zip {{.BUILD_DIR}}/tapto.sh
build-mister-shell:
vars:
BUILD_DIR: "./_build/mister_arm"
BUILDCACHE: "{{.BUILD_DIR}}/.go-buildcache"
MODCACHE: "{{.BUILD_DIR}}/.go-modcache"
IMAGE_NAME: tapto/mister-build
IMG_BUILDCACHE: /home/build/.cache/go-build
IMG_MODCACHE: /home/build/go/pkg/mod
cmds:
- docker run --rm --platform linux/arm/v7 -v {{.BUILDCACHE}}:{{.IMG_BUILDCACHE}} -v {{.MODCACHE}}:{{.IMG_MODCACHE}} -v ${PWD}:/build --user 1000:1000 -ti {{.IMAGE_NAME}} /bin/bash
build-mistex:
vars:
BUILD_DIR: "./_build/mistex_arm64"
BUILDCACHE: "{{.BUILD_DIR}}/.go-buildcache"
MODCACHE: "{{.BUILD_DIR}}/.go-modcache"
IMAGE_NAME: tapto/mistex-build
IMG_BUILDCACHE: /home/build/.cache/go-build
IMG_MODCACHE: /home/build/go/pkg/mod
cmds:
- docker run --rm --platform linux/arm/v8 -v {{.BUILDCACHE}}:{{.IMG_BUILDCACHE}} -v {{.MODCACHE}}:{{.IMG_MODCACHE}} -v ${PWD}:/build --user 1000:1000 {{.IMAGE_NAME}} bash -c "PLATFORM=mistex TAPTO_BIN=tapto.sh task build"
- rm -f {{.BUILD_DIR}}/tapto-mistex_arm64.zip
- zip -j {{.BUILD_DIR}}/tapto-mistex_arm64.zip {{.BUILD_DIR}}/tapto.sh
build-batocera-arm64:
vars:
BUILD_DIR: "./_build/batocera_arm64"
BUILDCACHE: "{{.BUILD_DIR}}/.go-buildcache"
MODCACHE: "{{.BUILD_DIR}}/.go-modcache"
IMAGE_NAME: tapto/batocera-arm64-build
IMG_BUILDCACHE: /home/build/.cache/go-build
IMG_MODCACHE: /home/build/go/pkg/mod
cmds:
- docker run --rm --platform linux/arm/v8 -v {{.BUILDCACHE}}:{{.IMG_BUILDCACHE}} -v {{.MODCACHE}}:{{.IMG_MODCACHE}} -v ${PWD}:/build --user 1000:1000 {{.IMAGE_NAME}} bash -c "PLATFORM=batocera TAPTO_BIN=tapto task build"
- rm -f {{.BUILD_DIR}}/tapto-batocera_arm64.zip
- zip -j {{.BUILD_DIR}}/tapto-batocera_arm64.zip {{.BUILD_DIR}}/tapto
build-batocera-amd64:
vars:
BUILD_DIR: "./_build/batocera_amd64"
BUILDCACHE: "{{.BUILD_DIR}}/.go-buildcache"
MODCACHE: "{{.BUILD_DIR}}/.go-modcache"
IMAGE_NAME: tapto/batocera-amd64-build
IMG_BUILDCACHE: /home/build/.cache/go-build
IMG_MODCACHE: /home/build/go/pkg/mod
cmds:
- docker run --rm --platform linux/amd64 -v {{.BUILDCACHE}}:{{.IMG_BUILDCACHE}} -v {{.MODCACHE}}:{{.IMG_MODCACHE}} -v ${PWD}:/build --user 1000:1000 {{.IMAGE_NAME}} bash -c "PLATFORM=batocera TAPTO_BIN=tapto task build"
- rm -f {{.BUILD_DIR}}/tapto-batocera_amd64.zip
- zip -j {{.BUILD_DIR}}/tapto-batocera_amd64.zip {{.BUILD_DIR}}/tapto
build-windows:
vars:
BUILD_DIR: "./_build/windows_{{.ARCH}}"
env:
GOOS: windows
PLATFORM: windows
TAPTO_BIN: TapTo.exe
CGO_ENABLED: 0
cmds:
- go build -o _build/${PLATFORM}_{{ARCH}}/${TAPTO_BIN} ./cmd/$PLATFORM
build-mac:
vars:
BUILD_DIR: "./_build/mac_{{.ARCH}}"
env:
GOOS: darwin
PLATFORM: mac
TAPTO_BIN: tapto
CGO_ENABLED: 0
cmds:
- go build -o _build/${PLATFORM}_{{ARCH}}/${TAPTO_BIN} ./cmd/$PLATFORM
deploy-mister:
cmds:
- task: build-mister
- scp _build/mister_arm/tapto.sh root@${MISTER_IP}:/media/fat/Scripts/tapto.sh
- ssh root@${MISTER_IP} /media/fat/Scripts/tapto.sh -service restart
deploy-mistex:
cmds:
- task: build-mistex
- scp _build/mistex_arm64/tapto.sh root@${MISTEX_IP}:/media/fat/Scripts/tapto.sh
- ssh root@${MISTEX_IP} /media/fat/Scripts/tapto.sh -service restart
clean: rm -rf _build
test: go test ./...
test-coverage:
cmds:
- go test -coverprofile=coverage.out ./...
- go tool cover -html=coverage.out
- rm coverage.out