-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
83 lines (74 loc) · 1.95 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
72
73
74
75
76
77
78
79
80
81
82
83
version: '3'
silent: true
vars:
LINTER_VERSION: '1.50.1'
HOME_BIN_DIR:
sh: eval echo "~$USER/bin"
BUILD_BIN_DIR: ./.build/bin
BIN_DIR: '{{default .BUILD_BIN_DIR .HOME_BIN_DIR}}'
tasks:
setup:
desc: Setup dependencies
deps:
- examples:setup:jsonapi
- examples:setup:simple-http
- examples:setup:validation
cmds:
- go mod tidy
- go mod download
lint:
desc: Lint the Go code with golangci-lint
deps:
- install:golangci
cmds:
- '{{.BIN_DIR}}/golangci-lint run ./...'
test:
desc: Test the Go code
cmds:
- echo "Running tests..."
- 'go test -race -coverprofile=coverage.txt -covermode=atomic ./...'
# Internal tasks
examples:setup:jsonapi:
desc: Setup dependencies for JSON:API example
internal: true
sources:
- ./go.mod
- ./go.sum
- ./*.go
dir: ./examples/jsonapi
cmds:
- go mod tidy
- go mod download
examples:setup:simple-http:
desc: Setup dependencies for simple HTTP response example
internal: true
sources:
- ./go.mod
- ./go.sum
- ./*.go
dir: ./examples/simple_http
cmds:
- go mod tidy
- go mod download
examples:setup:validation:
desc: Setup dependencies for validation example
internal: true
sources:
- ./go.mod
- ./go.sum
- ./*.go
dir: ./examples/validation
cmds:
- go mod tidy
- go mod download
install:golangci:
desc: Install the correct version of the golangci-lint binary
internal: true
status:
- 'if [[ -f "{{.BIN_DIR}}/golangci-lint" ]] && [[ "$({{.BIN_DIR}}/golangci-lint version)" == *"version v{{.LINTER_VERSION}}"* ]]; then exit 0; else exit 1; fi'
env:
GOBIN: '{{.BIN_DIR}}'
cmds:
- echo "Installing golangci-lint version {{.LINTER_VERSION}}..."
- 'go install github.com/golangci/golangci-lint/cmd/golangci-lint@v{{.LINTER_VERSION}}'
- echo "Linter installed."