forked from bangumi/server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yaml
132 lines (112 loc) · 2.55 KB
/
Taskfile.yaml
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
version: "3"
dotenv: [".env", ".envrc"]
includes:
mock:
taskfile: "./etc/mock.task.yaml"
internal: true
tasks:
default:
silent: true
cmds:
- task --list
install:
cmds:
- go install google.golang.org/protobuf/cmd/protoc-gen-go
- go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
- echo "please install buf by yourself https://docs.buf.build/installation"
build:
desc: Build Web Server Binary
sources:
- ./**/*.go
- go.mod
generates:
- ./dist/chii.exe
cmds:
- go build -ldflags '-w -s' -trimpath -o dist/chii.exe main.go
env:
CGO_ENABLED: "0"
lint:
silent: true
desc: Run 'golangci-lint'
cmds:
- golangci-lint run --fix
test:
desc: Run mocked tests, need nothing.
cmds:
- go test -timeout 3s -tags test {{.CLI_ARGS}} ./...
env:
CGO_ENABLED: "0"
web:
desc: Run Web Server
aliases:
- serve
- server
cmds:
- go run main.go --config config.yaml web
consumer:
desc: Run Kafka Consumer
aliases:
- canal
cmds:
- go run main.go canal --config config.yaml
openapi-test:
desc: Test OpenAPI Schema
cmds:
- npm run test
openapi:
desc: Build OpenAPI Schema
cmds:
- npm run build
bench:
desc: Run benchmark
cmds:
- go test -bench=. -benchmem ./pkg/wiki
test-db:
desc: Run mocked tests, and tests require mysql and redis. alias for `TEST_MYSQL=1 TEST_REDIS=1 task test`
cmds:
- go test -timeout 10s -tags test {{.CLI_ARGS}} ./...
env:
TEST_MYSQL: "1"
TEST_REDIS: "1"
test-all:
desc: Run all tests.
cmds:
- go test -timeout 10s -tags test ./...
env:
TEST_MYSQL: "1"
TEST_REDIS: "1"
coverage:
desc: Run tests with coverage report, used in CI.
cmds:
- go test -timeout 10s -tags test -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.out ./...
env:
TEST_MYSQL: "1"
TEST_REDIS: "1"
mod:
desc: "go mod tidy"
cmds:
- go mod tidy
gen:
desc: Generate all generated GO files
cmds:
- cmd: buf generate
- task: gorm
- task: mock
mock:
desc: Generate Mocks.
deps:
- mock:all
gorm:
desc: Run gorm-gen to generate go struct from mysql database.
generates:
- ./dal/query/gen.go
sources:
- ./cmd/gen/gorm/main.go
- go.mod
cmds:
- go run --tags gen ./cmd/gen/gorm/main.go
clean:
cmds:
- rm -rf ./dist/
- rm -rf .task
- rm -rf .bin