-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
93 lines (78 loc) · 2.11 KB
/
Copy pathTaskfile.yml
File metadata and controls
93 lines (78 loc) · 2.11 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
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
version: '3'
set: [pipefail] # exit if any pipe component fails
shopt: [globstar] # support double star glob paths: **/*.go
# # include env vars
# dotenv: ['.env']
# include other taskfiles
includes:
webserver:
taskfile: ./cmd/webserver/Taskfile.yml
dir: ./cmd/webserver
tasks:
# building
build:
desc: Builds webserver
cmds:
- task: webserver:build
# - task: webserver:completion
# build container image
image:
desc: Builds container images for current os/arch
cmds:
- earthly --secret github_token="" +release-local
# cleaning
clean:
desc: Removes any files created by tasks
cmds:
- task: webserver:clean
- rm -rf build
# run
run-webserver:
desc: Runs the webserver program
aliases: [run]
cmds:
- go run ./cmd/webserver/ -c . server
## upgrade dependencies
upgrade:
desc: Upgrades golang dependencies
cmds:
- go get -u ./...
- go mod tidy
# static tests
## unit testing
test:
desc: Unit testing of go code
cmds:
- go test -race -cover ./...
## code linting
lint:
desc: Lints golang
cmds:
- golangci-lint version || go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- golangci-lint run ./...
# CI tests
## unit testing with coverage
cover:
desc: "CI: runs golang unit and coverage testing"
cmds:
- go test -race -coverprofile=/tmp/coverage.out ./...
- go tool cover -html=/tmp/coverage.out -o /tmp/coverage.html
- go tool cover -func=/tmp/coverage.out | tee /tmp/coverage.txt
## update licenses
licenses:
desc: Generates license tree
cmds:
- go-licenses --help 2>/dev/null || go install github.com/google/go-licenses@latest
- rm -rf LICENSES
- go-licenses save --save_path LICENSES ./...
- go-licenses report ./... > LICENSES/licenses.csv
# setups your environment
envsetup:
desc: "Setups your environment, run on post-attach"
deps: [gomoddownload]
## runs go mod download
gomoddownload:
internal: true
cmds:
- cmd: go mod download
ignore_error: true