-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
72 lines (70 loc) · 1.83 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
# 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
ORM_OUTPUT_FOLDER: src/main/app/ent
tasks:
lint:
desc: Use golangci-lint (.golangci.yml).
cmds:
- golangci-lint run --fix
test:
desc: Run test.
cmds:
- go test -race ./...
- go test ./...
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
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: lint
- task: swagger
- task: test
default:
desc: Run [build] task.
cmds:
- task: build
run:
desc: Run $ENTRY_POINT
cmds:
- echo '{{OS}}'
- ./$BUILD_FOLDER/$ENTRY_POINT