-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtaskfile.yml
118 lines (101 loc) · 2.51 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
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
116
117
118
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"
vars:
MODS: [conf, prettylog, color, errors, log, oss, util]
env:
GO111MODULE: on
GOPROXY: https://goproxy.cn,direct
includes:
color:
dir: ./color
taskfile: ./color/taskfile.yml
errors:
dir: ./errors
taskfile: ./errors/taskfile.yml
log:
dir: ./log
taskfile: ./log/taskfile.yml
oss:
dir: ./oss
taskfile: ./oss/taskfile.yml
prettylog:
dir: ./prettylog
taskfile: ./prettylog/taskfile.yml
_:
dir: ./internal
taskfile: ./internal/taskfile.yml
tasks:
default:
desc: show help
cmds:
- go version
- task --version
- task --list-all
githooks:
desc: setup git hooks
cmd: git config core.hooksPath ./internal/githooks
setup:
desc: setup project
cmds:
- task: githooks
- go mod download
lint:
desc: run linters
cmds:
- for: { var: MODS }
cmd: golangci-lint run ./{{.ITEM}}/...
tidy:
desc: go mod tidy for all sub packages
deps:
- for: { var: MODS }
task: _tidy
vars: { MOD: "{{.ITEM}}" }
cmd: go work sync
_tidy:
internal: true
dir: "./{{.MOD}}"
cmd: go mod tidy
cov:
desc: gen test coverages
deps:
- task: _:integration
- for: { var: MODS }
task: _cov
vars: { MOD: "{{.ITEM}}" }
cmd:
task: cov:merge
_cov:
internal: true
vars:
COV_OUT: ./coverage/cov_unit.txt
cmds:
- cmd: powershell New-Item -ItemType Directory -Force -Path ./{{.MOD}}/coverage
platforms: [windows]
- cmd: mkdir -p ./{{.MOD}}/coverage
platforms: [linux, darwin]
- go test -coverprofile=./{{.MOD}}/{{.COV_OUT}} -covermode=atomic ./{{.MOD}}/...
cov:merge:
desc: merge coverage
vars:
COV_OUT: coverage/cov_unit.txt
ALL_OUT: coverage/coverage.out
cmds:
- cmd: powershell ./scripts/merge_unit_cov.ps1 -Mods '"{{.MODS}}"' -TotalCoverageOut {{.ALL_OUT}} -ModCoverageOut {{.COV_OUT}}
platforms: [windows]
- cmd: bash ./scripts/merge_unit_cov.sh "{{.MODS}}" {{.ALL_OUT}} {{.COV_OUT}}
platforms: [linux, darwin]
cov:preview:
desc: preview coverage report
deps:
- task: cov
cmd: go tool cover -html=./coverage/coverage.out -o ./coverage/cov.html
unit:
desc: run all unit tests
deps:
- for: { var: MODS }
task: _unit
vars: { MOD: "{{.ITEM}}" }
_unit:
internal: true
dir: "./{{.MOD}}"
cmd: go test -v ./...