-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yaml
103 lines (88 loc) · 2.04 KB
/
Taskfile.yaml
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# https://taskfile.dev
version: "3"
tasks:
#unix setup
setup:
- brew update
- brew install go golangci-lint yq hadolint
- task: setup:imports-reviser
- task: setup:precommit:install
setup:imports-reviser:
cmds:
- brew tap incu6us/homebrew-tap
- brew update
- brew install goimports-reviser
status:
- command -v goimports-reviser
setup:precommit:cli:
cmds:
- brew update
- brew install pre-commit
- pre-commit install
status:
- command -v pre-commit
setup:precommit:install:
deps:
- setup:precommit:cli
cmds:
- pre-commit install
#local tasks
go:mod-tidy:
cmds:
- go mod tidy
sources:
- go.mod
- go.sum
go:fmt:
- gofmt -l -s -w .
sources:
- "**/*.go"
go:lint:
cmds:
- golangci-lint run
sources:
- "**/*.go"
go:isort:
cmds:
- goimports-reviser -rm-unused -company-prefixes github.com/CallumKerson -project-name github.com/CallumKerson/Athenaeum -use-cache -format ./...
sources:
- "**/*.go"
test:
cmds:
- go test ./...
sources:
- "**/*.go"
compile:
desc: "Compiles for the current OS and architecture"
cmds:
- go build -ldflags "-s -w -X main.Version={{.VERSION}} -X main.Commit={{.COMMIT}} -X main.Date={{now | date "2006-01-02T15:04:05-0700"}}" -o . ./...
vars:
COMMIT:
sh: git rev-parse HEAD
VERSION:
sh: echo "$(git describe --tags)-dev+$(git rev-parse --short HEAD)"
sources:
- "**/*.go"
linux-compile:
desc: "Compiles for Linux"
cmds:
- GOOS=linux go build -ldflags "-s -w" -o . ./...
tidy:
desc: "Tidies the go project"
cmds:
- task: go:mod-tidy
- task: go:fmt
- task: go:isort
- task: go:lint
- pre-commit run -a
build:
desc: "Builds the go project"
cmds:
- task: tidy
- task: compile
docker:
desc: "Build and run container"
cmds:
- task: tidy
- task: linux-compile
- docker compose up --build