-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTaskfile.yml
71 lines (58 loc) · 1.59 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
version: "3"
vars:
APP_NAME: hoarderbot
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/hoarderbot/internal/version.appVersion={{.APP_VERSION}}"
LD_FLAG_COMMIT: "-X github.com/Madh93/hoarderbot/internal/version.commitHash={{.COMMIT_HASH}}"
env:
GCO_ENABLED: 0
tasks:
default:
desc: "Build and run"
cmds:
- task update-dependencies
- task install
- task run
clean:
desc: "Clean build artifacts"
cmds:
- go clean
- rm -rf bin
install:
desc: "Install the bot"
cmds:
- go install -trimpath -ldflags "-s -w {{.LD_FLAG_VERSION}} {{.LD_FLAG_COMMIT}}"
run:
desc: "Run the bot"
cmds:
- $GOPATH/bin/{{.APP_NAME}}
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 bot"
cmds:
- go build -trimpath -ldflags -s -w "{{.LD_FLAG_VERSION}} {{.LD_FLAG_COMMIT}}" -o bin/{{.APP_NAME}}
build:debug:
desc: "Build the bot for debug mode"
cmds:
- go build -ldflags "{{.LD_FLAG_VERSION}} {{.LD_FLAG_COMMIT}}" -gcflags=all="-N -l" -o bin/{{.APP_NAME}}-debug
build:docker:
desc: "Build the bot docker image"
cmds:
- docker build -t {{.APP_NAME}}:latest --build-arg APP_VERSION={{.APP_VERSION}} --build-arg COMMIT_HASH={{.COMMIT_HASH}} .