-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTaskfile.yaml
115 lines (101 loc) · 2.81 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
104
105
106
107
108
109
110
111
112
113
114
115
# https://taskfile.dev
version: "3"
tasks:
default:
cmds:
- task: run
build:
desc: "Build the goat binary."
cmds:
- bash scripts/version.sh
- defer: git checkout internal/version/version.go
- "{{.ENV}} go build -v -o bin/goat{{.SUFFIX}} cmd/goat/main.go"
install:
desc: "Build the goat binary and install it to the GOPATH binary directory."
cmds:
- bash scripts/version.sh
- defer: git checkout internal/version/version.go
- go build -v -o $(go env GOPATH)/bin/goat cmd/goat/main.go
run:
desc: "Compiles and runs goat."
cmds:
- go run -v cmd/goat/main.go {{.CLI_ARGS}}
release:
desc: "Build binaries for different architectures."
cmds:
- task: build
vars:
SUFFIX: "_darwin_amd64"
ENV: "GOOS=darwin GOARCH=amd64"
- task: build
vars:
SUFFIX: "_darwin_arm64"
ENV: "GOOS=darwin GOARCH=arm64"
- task: build
vars:
SUFFIX: "_linux_amd64"
ENV: "GOOS=linux GOARCH=amd64"
- task: build
vars:
SUFFIX: "_linux_arm64"
ENV: "GOOS=linux GOARCH=arm64"
- task: build
vars:
SUFFIX: "_windows_amd64.exe"
ENV: "GOOS=windows GOARCH=amd64"
- task: build
vars:
SUFFIX: "_windows_arm64.exe"
ENV: "GOOS=windows GOARCH=arm64"
test:
desc: "Run all unit tests."
deps:
- mockgen
cmds:
- go test -v -cover ./...
e2e:
desc: "Run end to end tests."
cmds:
- task: install
- bash ./e2e/run.bash
lint:
desc: "Run staticcheck linter."
preconditions:
- sh: which staticcheck
msg: staticcheck is not installed!
deps:
- mockgen
cmds:
- staticcheck -checks all,-ST1000,-ST1022,-ST1003 ./...
bundle:
desc: "Builds binaries for different architectures and bundles the
current directory into a gzipped tarball."
deps:
- release
cmds:
- tar -czvf goat.tar.gz $(ls -a1 | grep -v "^\.\.$" | grep -v "^\.$")
mockgen:
desc: "(Re-)generate mock files for unit tests."
preconditions:
- sh: which mockgen
msg: mockgen is not installed. Use 'task dev-env' to set up all required tools.
cmds:
- "[ -d mocks ] || mkdir mocks"
- mockgen -package mocks io/fs FS,File,FileInfo > mocks/fs.go
dev-env:
desc: "Execute all necessary steps to set up a working dev environment for goat."
cmds:
- go install github.com/golang/mock/mockgen@latest
- task: mockgen
serve-book:
desc: "Start the documentation mdbook server."
aliases: [book-serve]
dir: "docs/book"
cmds:
- mdbook serve
build-book:
desc: "Build the mdbook documentation."
aliases: [book-build]
dir: "docs/book"
cmds:
- mdbook build