-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
62 lines (53 loc) · 1.33 KB
/
Taskfile.yml
File metadata and controls
62 lines (53 loc) · 1.33 KB
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
# https://taskfile.dev
version: '3'
vars:
OUT_DIR: dist
OUT_FILE: smtp-cli
OUT_ARCHIVE: "{{ env \"OUT_ARCHIVE\" | default \"smtp-cli\" }}"
tasks:
build:
internal: true
aliases:
- build
- compile
vars:
BUILD_VERSION: "{{ env \"BUILD_VERSION\" | default \"dev\" }}"
BUILD_COMMIT:
sh: git rev-parse --short HEAD
cmd: |
go build \
-ldflags="{{.LDFLAGS}} -X 'main.Version={{.BUILD_VERSION}}' -X 'main.CommitHash={{.BUILD_COMMIT}}' -X 'main.BuildTimestamp={{ now }}'" \
-o "{{.OUT_DIR}}/{{.OUT_FILE}}" \
.
deps:
- clean
default:
cmds:
- task: build:debug
build:release:
cmds:
- task: build
vars:
LDFLAGS: -s -w
- task: dist
build:debug:
cmds:
- task: build
vars:
LDFLAGS: ""
- task: dist
dist:
desc: Install additional files for release.
cmds:
- cp install.sh "{{.OUT_DIR}}/"
- cp config/smtp-cli.json.example "{{.OUT_DIR}}/smtp-cli.json"
- cp config/template.gotmpl.example "{{.OUT_DIR}}/template.gotmpl"
- tar czvf "{{.OUT_ARCHIVE}}.tar.gz" "{{.OUT_DIR}}/"
sources:
- dist/**
generates:
- "{{.OUT_ARCHIVE}}.tar.gz"
clean:
cmd: rm -rf "{{.OUT_DIR}}"
test:
cmd: go test -v -cover -coverprofile=coverage.out ./...