-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
86 lines (83 loc) · 2.28 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
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
version: '3'
vars:
VERSION:
sh: git describe --tags | sed -r 's/-.+//'
tasks:
prepare:
desc: 'Create folder for results of building'
cmds:
- |
task clean
mkdir result
build-all:
desc: 'Build for all platforms and architectures'
cmds:
- task: prepare
- task: build-loop
vars:
GOOS: GOOS="linux"
GOARCH: GOARCH="amd64"
PLATFORM: linux-amd64
- task: build-loop
vars:
GOOS: GOOS="linux"
GOARCH: GOARCH="386"
PLATFORM: linux-386
- task: build-loop
vars:
GOOS: GOOS="darwin"
GOARCH: GOARCH="amd64"
PLATFORM: darwin-amd64
- task: build-loop
vars:
GOOS: GOOS="darwin"
GOARCH: GOARCH="arm64"
PLATFORM: darwin-arm64
- task: build-loop
vars:
GOOS: GOOS="freebsd"
GOARCH: GOARCH="amd64"
PLATFORM: freebsd-amd64
- task: build-loop
vars:
GOOS: GOOS="freebsd"
GOARCH: GOARCH="386"
PLATFORM: freebsd-386
- task: build-loop
vars:
GOOS: GOOS="windows"
GOARCH: GOARCH="amd64"
PLATFORM: windows-amd64
WIN: true
- task: build-loop
vars:
GOOS: GOOS="windows"
GOARCH: GOARCH="386"
PLATFORM: windows-386
WIN: true
- rm -rf temp
build:
desc: 'Build for the current platform'
cmds:
- go build .
build-loop:
cmds:
- |
rm -rf temp && mkdir temp
{{ .GOOS }} {{ .GOARCH }} go build -ldflags="-X 'colligendis/cmd/version.Version={{ .VERSION }}'" -o temp/colligendis{{ if .WIN }}.exe{{ end }}
cp LICENSE temp/LICENSE{{ if .WIN }}.txt{{ end }}
cp docs/INSTALL temp/INSTALL{{ if .WIN }}.txt{{ end }}
cd temp
tar -czf ../colligendis-{{ .VERSION }}-{{ .PLATFORM }}.tar.gz .
mv ../colligendis-{{ .VERSION }}-{{ .PLATFORM }}.tar.gz ../result/colligendis-{{ .VERSION }}-{{ .PLATFORM }}.tar.gz
clean:
desc: 'Clean files and folders'
cmds:
- |
rm -rf ./result
run-for-test-with-file:
desc: 'Run utility with generation of output file'
cmds:
- task: build
- |
./colligendis collect --habr --file -v