-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
67 lines (56 loc) · 1.53 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
version: "3"
env:
BUILD_DIR: build/
DIST_DIR: dist/
GO_FILES: main.go cmd/ internal/ pkg/
GOIMPORTS_LOCAL_PATH: -local github.com/matty-rose/gha-docs
SHELL: /bin/bash
tasks:
all:
desc: Runs all main tasks
cmds:
- task: clean
- task: fmt
- task: lint
- task: verify
- task: test
- task: build
clean:
desc: Cleans out build artifacts.
cmds:
- rm -rf ./$BUILD_DIR ./$DIST_DIR
fmtcheck:
desc: Checks all go files for proper formatting.
cmds:
- test -z $(goimports -l $GOIMPORTS_LOCAL_PATH $GO_FILES | tee /dev/stderr) || echo "[WARNING] Fix formatting issues with 'task fmt'"
fmt:
desc: Formats all go files.
cmds:
- goimports -w $GOIMPORTS_LOCAL_PATH $GO_FILES
lint:
desc: Lints all source code.
cmds:
- golangci-lint run ./... -v
verify:
desc: Verifies downloaded go dependencies.
cmds:
- go mod verify
test:
desc: Runs test suite.
cmds:
- gotestsum --format testname --junitfile junit.xml -- ./... -covermode=atomic -coverprofile=coverage.out
run:
desc: Runs application.
cmds:
- go run main.go {{ .CLI_ARGS }}
build:
desc: Builds main application binary.
cmds:
- CGO_ENABLED=0 go build -ldflags="-s -w -X github.com/matty-rose/gha-docs/internal/version.BuildVersion={{ .VERSION }}" -o build/{{ .GOOS }}-{{ .GOARCH }}/gha-docs -v main.go
vars:
VERSION:
sh: git log -n 1 --format=%h
GOOS:
sh: go env GOOS
GOARCH:
sh: go env GOARCH