-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTaskfile.yml
61 lines (50 loc) · 1.35 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: "3"
vars:
APP_NAME: tpm
APP_VERSION:
sh: git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0"
COMMIT_HASH:
sh: git rev-parse HEAD
LD_FLAG_VERSION: "-X github.com/Madh93/tpm/internal/version.appVersion={{.APP_VERSION}}"
LD_FLAG_COMMIT: "-X github.com/Madh93/tpm/internal/version.commitHash={{.COMMIT_HASH}}"
env:
GCO_ENABLED: 0
tasks:
default:
desc: "Build and run"
cmds:
- task update-dependencies
- task build
- task install
clean:
desc: "Clean build artifacts"
cmds:
- go clean
- rm -rf bin
install:
desc: "Install the application"
cmds:
- go install -trimpath -ldflags "-s -w {{.LD_FLAG_VERSION}} {{.LD_FLAG_COMMIT}}"
test:
desc: "Run tests"
cmds:
- go test ./...
lint:
desc: "Run linters"
cmds:
- golangci-lint run
update-dependencies:
desc: "Update dependencies"
cmds:
- go get -u all && go mod tidy
#############
### BUILD ###
#############
build:
desc: "Build the application"
cmds:
- go build -trimpath -ldflags "-s -w {{.LD_FLAG_VERSION}} {{.LD_FLAG_COMMIT}}" -o bin/{{.APP_NAME}} main.go
build:debug:
desc: "Build the application for debug mode"
cmds:
- go build -ldflags "{{.LD_FLAG_VERSION}} {{.LD_FLAG_COMMIT}}" -gcflags=all="-N -l" -o bin/{{.APP_NAME}}-debug main.go