-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
60 lines (57 loc) · 1.5 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
# https://taskfile.dev
version: "3"
vars:
targetbin: ~/bin
buildname: pathhelper
dir: >
{{.DIR}}
LDFLAGS: >
-X 'main.GitCommit=$GIT_COMMIT'
-X 'main.CompilationDate=$COMPILATION_DATE'
-X 'main.CommitDate=$COMMIT_DATE'
env:
GIT_COMMIT:
sh: git rev-parse --short HEAD
COMPILATION_DATE:
sh: date "+%Y-%m-%d %H:%M:%S %z"
COMMIT_DATE:
sh: git log -1 --format="%ci"
tasks:
default:
cmds:
- echo "use 'task -l' to list tasks"
silent: true
install:
desc: copy build file to local bin
dir: .
preconditions:
- test -d {{.targetbin}}/
cmds:
- task: build
- cmd: rm {{.targetbin}}/{{.buildname}}
ignore_error: true
- cmd: cp ./build/{{.buildname}} {{.targetbin}}
ignore_error: true
- cmd: rm -f ./build/{{.buildname}}
ignore_error: true
build:
desc: build app
dir: cmd/{{.buildname}}
cmds:
- cmd: rm -f ../../build/{{.buildname}}
ignore_error: true
# - go build -ldflags="{{.LDFLAGS}}" -o ../../build/{{.buildname}} .
- go build -o ../../build/{{.buildname}} .
show-allocations:
desc: show build optimizations
dir: cmd/{{.buildname}}
cmds:
- cmd: go build -gcflags '-m -l' pathhelper.go 2>&1
- cmd: go build -gcflags '-m -l' ../paths/paths.go 2>&1
- rm -f {{.buildname}}
show-build:
desc: show build optimizations
dir: cmd/{{.buildname}}
cmds:
- cmd: go build -gcflags '-S -N' pathhelper.go 2>&1
- rm -f {{.buildname}}