-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
73 lines (60 loc) · 1.44 KB
/
Copy pathTaskfile.yml
File metadata and controls
73 lines (60 loc) · 1.44 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
version: '3'
vars:
BINARY_NAME: dataflow
BUILD_CMD: ./cmd/dataflow
DIST_DIR: dist
LOG_DIR: log
tasks:
build:
desc: 构建二进制文件
cmds:
- mkdir -p {{.DIST_DIR}}
- go build -o {{.DIST_DIR}}/{{.BINARY_NAME}} {{.BUILD_CMD}}
run:
desc: 构建并运行,通过 -- 传递参数
cmds:
- go run {{.BUILD_CMD}} {{.CLI_ARGS}}
test:
desc: 运行全部测试
cmds:
- go test ./...
test-race:
desc: 运行全部测试(含竞态检测)
cmds:
- go test -race ./...
test-cover:
desc: 运行全部测试并生成覆盖率报告
cmds:
- go test -race -coverprofile=coverage.out ./...
- go tool cover -func=coverage.out
test-single:
desc: 运行单个测试,通过 -- 传递参数
cmds:
- go test -v {{.CLI_ARGS}}
lint:
desc: 运行 golangci-lint
cmds:
- golangci-lint run
fmt:
desc: 格式化代码
cmds:
- gofmt -w .
- goimports -w .
list:
desc: 列出所有已注册组件(需先 build)
cmds:
- ./{{.DIST_DIR}}/{{.BINARY_NAME}} -l
release:
desc: 跨平台打包,通过 -- 传递参数
cmds:
- ./scripts/build.sh {{.CLI_ARGS}}
clean:
desc: 清理构建产物
cmds:
- rm -f {{.DIST_DIR}}/{{.BINARY_NAME}}
- rm -f coverage.out
clean:log:
desc: 清理日志文件
cmds:
- rm -f {{.LOG_DIR}}/*.log
- rm -f {{.LOG_DIR}}/*.log.gz