forked from brutella/hkcam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
61 lines (58 loc) · 2.68 KB
/
Taskfile.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
version: '2'
# expansions: 3
vars:
PWD:
sh: pwd
TAG:
sh: git describe --tags
VERSION: "{{or .BUILD_VERSION .TAG}}"
DATE:
sh: date +%FT%TZ%z
BUILD_DIR: "{{ .PWD }}/build"
tasks:
clean:
cmds:
- go clean
- rm -rf "{{ .BUILD_DIR }}"
test:
cmds:
- go test ./... -race -count=1
lint:
cmds:
- golangci-lint run
hkcam:
cmds:
- "go build -o {{ .BUILD_DIR }}/hkcam -ldflags {{ .LDFLAGS }} cmd/hkcam/main.go"
- "{{ .BUILD_DIR }}/hkcam --verbose"
vars:
LDFLAGS: "\"-X main.Version={{ .VERSION }} -X main.Date={{ .DATE }}\""
sources:
- cmd/hkcam/main.go
- ./*.go
- Taskfile.yml
pack:
cmds:
# Raspberry Pi
- "GOOS=linux GOARCH=arm GOARM=6 go build -o {{ .BUILD_DIR }}/{{ .PACKAGE_RPI }}/{{ .BINARY }} -ldflags {{ .LDFLAGS }} cmd/hkcam/main.go"
# Linux
- "GOOS=linux GOARCH=amd64 go build -o {{ .BUILD_DIR }}/{{ .PACKAGE_LINUX_64 }}/{{ .BINARY }} -ldflags {{ .LDFLAGS }} cmd/hkcam/main.go"
# Linux
- "GOOS=linux GOARCH=386 go build -o {{ .BUILD_DIR }}/{{ .PACKAGE_LINUX_32 }}/{{ .BINARY }} -ldflags {{ .LDFLAGS }} cmd/hkcam/main.go"
# Intel Mac
- "GOOS=darwin GOARCH=amd64 go build -o {{ .BUILD_DIR }}/{{ .PACKAGE_INTEL_MAC }}/{{ .BINARY }} -ldflags {{ .LDFLAGS }} cmd/hkcam/main.go"
# M1 Mac
- "GOOS=darwin GOARCH=arm64 go build -o {{ .BUILD_DIR }}/{{ .PACKAGE_M1_MAC }}/{{ .BINARY }} -ldflags {{ .LDFLAGS }} cmd/hkcam/main.go"
# pack
- "tar -cvzf {{ .PACKAGE_RPI }}.tar.gz -C {{ .BUILD_DIR }}/{{ .PACKAGE_RPI }} {{ .BINARY }}"
- "tar -cvzf {{ .PACKAGE_LINUX_64 }}.tar.gz -C {{ .BUILD_DIR }}/{{ .PACKAGE_LINUX_64 }} {{ .BINARY }}"
- "tar -cvzf {{ .PACKAGE_LINUX_32 }}.tar.gz -C {{ .BUILD_DIR }}/{{ .PACKAGE_LINUX_32 }} {{ .BINARY }}"
- "tar -cvzf {{ .PACKAGE_INTEL_MAC }}.tar.gz -C {{ .BUILD_DIR }}/{{ .PACKAGE_INTEL_MAC }} {{ .BINARY }}"
- "tar -cvzf {{ .PACKAGE_M1_MAC }}.tar.gz -C {{ .BUILD_DIR }}/{{ .PACKAGE_M1_MAC }} {{ .BINARY }}"
vars:
BINARY: hkcam
PACKAGE_RPI: "{{ .BINARY }}-{{ .VERSION }}_linux_arm"
PACKAGE_LINUX_64: "{{ .BINARY }}-{{ .VERSION }}_linux_amd64"
PACKAGE_LINUX_32: "{{ .BINARY }}-{{ .VERSION }}_linux_386"
PACKAGE_INTEL_MAC: "{{ .BINARY }}-{{ .VERSION }}_darwin_amd64"
PACKAGE_M1_MAC: "{{ .BINARY }}-{{ .VERSION }}_darwin_arm64"
LDFLAGS: "\"-X main.Version={{ .VERSION }} -X main.Date={{ .DATE }}\""