-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.toml
193 lines (167 loc) · 4.29 KB
/
Makefile.toml
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
[config]
default_to_workspace = false
[tasks.setup]
dependencies = ["install-hooks"]
script = '''
# DB cli
cargo install sqlx-cli --no-default-features --features sqlite,rustls
# dependency injection for cli
go install github.com/google/wire/cmd/wire@latest
# mocking for cli
go install github.com/golang/mock/mockgen@latest
# cli grpc generation
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
# go linting
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$(go env GOPATH)/bin"
'''
script_runner = "@shell"
[tasks.install-hooks]
script = '''
echo "Installing git hooks..."
cp .githooks/pre-commit .git/hooks/pre-commit
'''
script_runner = "@shell"
[tasks.build]
clear = true
script = '''
cargo build ${@}
cd ./platune-cli
go build
'''
script_runner = "@shell"
[tasks.test]
clear = true
script = '''
cargo install cargo-nextest
cargo nextest run --no-fail-fast --locked -- ${@}
cd ./platune-cli
go test ./...
'''
script_runner = "@shell"
[tasks.lint]
script = '''
cargo clippy
cd ./platune-cli
golangci-lint run
'''
# autogenerated package from mockgen is slightly wrong, need to remove v2 at the end
[tasks.regen-grpc]
script = '''
cargo clean -p platuned-client -p platuned
cargo build
echo "regenerated rust client/server"
cd platuned/client/go
protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative --proto_path "./../../proto" --go_opt=Mplayer_rpc.proto=github.com/aschey/platune/protos/player_rpc "./../../proto/player_rpc.proto" --go_opt=Mplayer_rpc.proto=github.com/aschey/platune/protos/management_rpc "./../../proto/management_rpc.proto"
echo "regenerated go client"
cd ../../../platune-cli
mockgen -package=test -source="./../platuned/client/go/player_rpc_grpc.pb.go" > "./test/player_mock.go"
mockgen -package=test -source="./../platuned/client/go/management_rpc_grpc.pb.go" > "./test/management_mock.go"
echo "regenerated mocks"
'''
[tasks.cli]
script = '''
cd ./platune-cli
go run . ${@}
'''
script_runner = "@shell"
[tasks.server]
script = '''
cd ./platuned/server
cargo run ${@}
'''
script_runner = "@shell"
[tasks.win-srv]
condition = { platforms = ["windows"] }
script = '''
cd ./platuned/server
cargo run --release -- -i
'''
[tasks.systemd]
condition = { platforms = ["linux"] }
script = '''
cp ./platuned/linux/platuned.service /etc/systemd/system/platuned.service
systemctl daemon-reload
systemctl restart platuned
'''
[tasks.verify-features]
args = [
"hack",
"--feature-powerset",
"--exclude-no-default-features",
"clippy",
"--locked",
"--",
"-D",
"warnings",
]
command = "cargo"
install_crate = "cargo-hack"
[tasks.fuzz]
condition = { platforms = ["linux"] }
script = '''
cd libplatune/player/fuzz
makers fuzz
'''
[tasks.build-release]
args = [
"+nightly",
"build",
"-Z",
"build-std=std,panic_abort",
"-Z",
"build-std-features=panic_immediate_abort",
"--target",
"x86_64-unknown-linux-gnu",
"--release",
]
command = "cargo"
[tasks.pre-coverage]
install_crate = "cargo-nextest"
[tasks.coverage]
script = '''
cargo llvm-cov nextest --all-features --lcov --ignore-filename-regex ".cargo|.*_test\.rs" > ./target/debug/lcov.info
genhtml -o ./target/debug/coverage/ --show-details --highlight --ignore-errors source --legend ./target/debug/lcov.info
'''
clear = true
install_crate = "cargo-llvm-cov"
dependencies = ["pre-coverage"]
[tasks.view-coverage]
script = '''
xdg-open ./target/debug/coverage/index.html
'''
dependencies = ["coverage"]
[tasks.view-coverage.windows]
script = '''
./target/debug/coverage/index.html
'''
dependencies = ["coverage"]
script_runner = "@shell"
[tasks.unused]
args = ["+nightly", "udeps"]
command = "cargo"
install_crate = "cargo-udeps"
[tasks.update]
args = ["update"]
command = "cargo"
install_crate = "cargo-edit"
[tasks.upgrade]
args = ["upgrade", "--incompatible"]
command = "cargo"
install_crate = "cargo-edit"
[tasks.update-all]
dependencies = ["update", "upgrade"]
script = '''
cd libplatune/player/fuzz
makers update-all
'''
[tasks.cleanup]
args = ["sweep", "-t", "30"]
command = "cargo"
install_crate = "cargo-sweep"
[tasks.maintenance]
dependencies = ["unused", "cleanup", "update-all"]
[tasks.deny]
args = ["deny", "--workspace", "check"]
command = "cargo"
install_crate = "cargo-deny"