-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathTaskfile.yml
98 lines (82 loc) · 2.18 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
# https://taskfile.dev
version: '3'
silent: true
vars:
GO_MODULE: github.com/Antonboom/tinkoff-invest-robot-contest-2022
GO_FILES:
sh: find . -type f -name '*.go' -not -path "./.gocache/*" -not -path "./.go/*" -not -path "./vendor/*" -not -path "*.pb.go" -not -path "*generated*.go" | tr "\n" " "
DEV_TOOLS: |
github.com/daixiang0/gci
github.com/golang/mock/mockgen
google.golang.org/grpc/cmd/protoc-gen-go-grpc
google.golang.org/protobuf/cmd/protoc-gen-go
mvdan.cc/gofumpt
tasks:
default:
cmds:
- task: tidy
- task: fmt
- task: lint
- task: tests
- task: build
tidy:
- echo "- Tidy & vendor"
- go mod tidy
- go mod vendor
fmt:
- echo "- Format"
- gofumpt -w {{.GO_FILES}}
- gci write -s Std -s Def -s "Prefix({{.GO_MODULE}})" {{.GO_FILES}} 2> /dev/null
lint:
cmds:
- echo "- Lint"
- golangci-lint run --fix ./...
tests:
cmds:
- echo "- Tests"
- go test ./...
build:
cmds:
- echo "- Build"
- go build ./cmd/trading-robot/...
dev-tools:install:
dir: tools
cmds:
- echo "- Install dev tools"
- go mod tidy
- go install {{ .DEV_TOOLS | splitLines | join " " }}
contracts:generate:
vars:
IN: api/tinkoff-invest/*.proto
OUT: internal/clients/tinkoffinvest/pb
cmds:
- echo "- Generate .go from protos"
- rm -rf {{.OUT}} && mkdir -p {{.OUT}}
- |
protoc \
-I api/tinkoff-invest \
--go_opt=paths=source_relative \
--go-grpc_opt=paths=source_relative \
--go-grpc_out={{.OUT}} \
--go_out={{.OUT}} \
{{.IN}}
run:
cmds:
- echo "- Run"
- go run ./cmd/trading-robot
dump-instruments:
cmds:
- echo "- Dump instruments"
- go run ./cmd/dump-instruments > testdata/instruments.json
up:
cmds:
- docker-compose -f ./deploy/docker-compose.yml up --build
down:
cmds:
- |
docker-compose -f ./deploy/docker-compose.yml down \
--rmi local \
--volumes \
--remove-orphans \
--timeout 60; \
- docker-compose -f ./deploy/docker-compose.yml rm -f