generated from arielsrv/golang-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
94 lines (92 loc) · 2.53 KB
/
Taskfile.yml
File metadata and controls
94 lines (92 loc) · 2.53 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
94
# yaml-language-server: $schema=https://json.schemastore.org/taskfile.json
version: '3'
env:
ENTRY_POINT: program
SOURCE_FOLDER: src/main
BUILD_FOLDER: build
COVERAGE_OUT_FILE: coverage.out
COVERAGE_HTML_FILE: coverage.html
SWAGGER_INPUT_FOLDER: src/main
SWAGGER_OUTPUT_FOLDER: src/resources/docs
tasks:
setup:
desc: Minimal scripts to send a receive messages
cmds:
- ./setup.sh
lsif:
desc: Code Intelligence
cmds:
- lsif-go --repository-remote=gitlab.com/iskaypet/digital/tools/dev/go-consumer-app -v
lint:
desc: Use golangci-lint (.golangci.yml).
cmds:
- golangci-lint run --fix
lint:report:
desc: Linter report
cmds:
- golangci-lint run --issues-exit-code 0 --print-issued-lines=false --out-format code-climate:gl-code-quality-report.json,line-number
test:race:
desc: Run race conditions test.
cmds:
- go test -race ./...
test:
desc: Run test.
cmds:
- go test ./...
test:report:
desc: CI test report.
cmds:
- go install gotest.tools/gotestsum@latest
- gotestsum --junitfile report.xml --format testname
coverage:
desc: Makes report coverage.
cmds:
- go test ./... -covermode=count -coverprofile=$COVERAGE_OUT_FILE
- go tool cover -html $COVERAGE_OUT_FILE -o $COVERAGE_HTML_FILE
- go tool cover -func=$COVERAGE_OUT_FILE -o=$COVERAGE_OUT_FILE
coverage:report:
desc: CI coverage report
cmds:
- CGO_ENABLED=0 go test ./... -coverprofile=coverage-report.out
clean:
desc: Clean binaries and reports.
cmds:
- rm -rf $BUILD_FOLDER
- rm -rf $COVERAGE_OUT_FILE $COVERAGE_HTML_FILE
download:
desc: Run go mod tidy.
cmds:
- go mod tidy
upgrade:
desc: Check for latest direct dependencies.
cmds:
- go-mod-upgrade
swagger:
desc: Generate RESTful API documentation with Swagger.
cmds:
- go install github.com/swaggo/swag/cmd/swag@latest
- swag init -d $SWAGGER_INPUT_FOLDER -g $ENTRY_POINT.go -o $SWAGGER_OUTPUT_FOLDER --parseGoList
build:
desc: Build the go EXECUTABLE.
generates:
- server
interactive: true
cmds:
- mkdir -p $BUILD_FOLDER/..
- go build -v $SOURCE_FOLDER/$ENTRY_POINT.go
- mv $ENTRY_POINT $BUILD_FOLDER
all:
desc: Run relevant tasks.
cmds:
- task: download
- task: swagger
- task: test
default:
desc: Run [build] task.
cmds:
- task: build
run:
desc: Run $ENTRY_POINT
cmds:
- echo '{{OS}}'
- ./$BUILD_FOLDER/$ENTRY_POINT