Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
158 lines (134 loc) · 3.75 KB
/
Copy pathTaskfile.yml
File metadata and controls
158 lines (134 loc) · 3.75 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# Copyright 2026 ysicing
# SPDX-License-Identifier: AGPL-3.0-only
version: '3'
vars:
SOURCE_FILES: >-
find . -type d \( -name .git -o -name .mygo -o -name .agents -o -name node_modules -o -name vendor -o -name build -o -name dist -o -name graft \) -prune
-o -type f \( -name '*.go' -o -name '*.ts' -o -name '*.mjs' -o -name '*.css' -o -name '*.html' -o -name '*.yml' -o -name '*.yaml' \) -print0
tasks:
default:
desc: 列出可用任务
cmds:
- task --list
setup:
desc: 安装打包工具与 Go 依赖
cmds:
- bun install
- GOMAXPROCS=2 go mod download
dev:
desc: 启动桌面开发模式
cmds:
- GOMAXPROCS=2 GOFLAGS=-p=1 bun run dev
build:
desc: 构建当前平台应用与安装包
cmds:
- GOMAXPROCS=2 GOFLAGS=-p=1 bun run build
fmt:
desc: 补齐版权头并使用 golangci-lint 格式化 Go 代码
aliases: [format]
env:
GOMAXPROCS: '2'
GOFLAGS: -p=1
cmds:
- task: license
- task: tools:lint
- golangci-lint fmt
tools:lint:
internal: true
status:
- command -v golangci-lint
cmds:
- GOMAXPROCS=2 go install -p=1 github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
tools:vuln:
internal: true
status:
- command -v govulncheck
cmds:
- GOMAXPROCS=2 go install -p=1 golang.org/x/vuln/cmd/govulncheck@latest
tools:license:
internal: true
status:
- command -v addlicense
cmds:
- GOMAXPROCS=2 go install -p=1 github.com/google/addlicense@latest
license:
desc: 为源码、脚本和配置补齐 AGPL 版权头
aliases: [gencopyright]
env:
GOMAXPROCS: '2'
cmds:
- task: tools:license
- '{{.SOURCE_FILES}} | xargs -0 -n 1 addlicense -c ysicing -l AGPL-3.0-only -s=only'
license:check:
desc: 检查源码文件头是否缺失,包含平台专用文件
run: once
env:
GOMAXPROCS: '2'
cmds:
- task: tools:license
- '{{.SOURCE_FILES}} | xargs -0 -n 1 addlicense -check'
gomod:
desc: 整理 Go 模块依赖
cmds:
- GOMAXPROCS=2 go mod tidy
fmt:check:
desc: 检查文件头是否缺失及 Go 格式,不修改源码
env:
GOMAXPROCS: '2'
GOFLAGS: -p=1
cmds:
- task: license:check
- task: tools:lint
- golangci-lint fmt --diff
lint:
desc: 使用 golangci-lint 检查 Go 文件头、格式及 govet
env:
GOMAXPROCS: '2'
GOFLAGS: -p=1
cmds:
- task: license:check
- task: tools:lint
- golangci-lint run ./...
govulncheck:
desc: 检查当前构建可调用代码的已知漏洞(需要联网)
env:
GOMAXPROCS: '2'
GOFLAGS: -p=1
cmds:
- task: tools:vuln
- govulncheck ./...
vet:
desc: 检查 Go 代码
cmds:
- GOMAXPROCS=2 go vet -p=1 ./...
test:
desc: 串行运行 Go(含原生界面)与发布脚本测试
cmds:
- task: test:go
- task: test:release
test:go:
desc: 运行 Go 测试
cmds:
- GOMAXPROCS=2 go test -p=1 -parallel=2 ./...
test:ui:
desc: 运行原生界面与交互测试
cmds:
- GOMAXPROCS=2 go test -p=1 -parallel=2 ./internal/app
test:release:
desc: 运行发布脚本测试
cmds:
- bun run test:release
check:
desc: 串行运行文件头与格式检查、全部测试及 golangci-lint
cmds:
- task: fmt:check
- task: test
- task: lint
release:
desc: 构建并发布全平台安装包与更新,可传入 -- --dry-run 仅构建校验
cmds:
- GOMAXPROCS=2 GOFLAGS=-p=1 bun run release {{.CLI_ARGS}}
publish:
desc: 发布已有产物,使用 -- --dir build/release-实际目录,可加 --dry-run
cmds:
- bun run publish {{.CLI_ARGS}}