forked from comit-network/comit-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.toml
More file actions
251 lines (215 loc) · 5.54 KB
/
Copy pathMakefile.toml
File metadata and controls
251 lines (215 loc) · 5.54 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
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
[env]
BITCOIND_ADDITIONAL_SLEEP_PERIOD = "500"
CARGO_MAKE_CARGO_BUILD_TEST_FLAGS = { script = ["echo ${CARGO_MAKE_CARGO_BUILD_TEST_FLAGS:-'--all'}"] }
# ###########################################################
# Override defaults tasks to allow the use of default flows #
# Overridden because: default task should be quick and default task was alias for dev-test-flow.
[tasks.default]
description = "Format, build and run the Rust tests. No clippy nor end-to-end."
workspace = false
clear = true
dependencies = [
"format",
"fix-ts",
"build",
"test"
]
# Overridden because: added dependencies
[tasks.pre-build]
workspace = false
dependencies = [
"check-rs-format",
"check-ts",
"check-cargo-toml-format",
"clippy"
]
# Overridden because: specified dependencies
[tasks.post-test]
workspace = false
dependencies = [
"api",
]
# Overridden because: added workspace
[tasks.ci-flow]
workspace = false
# Overridden because: we want workspace = false
[tasks.build]
workspace = false
# Overridden because: we want workspace = false
[tasks.build-verbose]
workspace = false
# Overridden because: we want workspace = false
[tasks.test-verbose]
workspace = false
# Overridden because: add script
[tasks.init]
script = [
'''
git config core.hooksPath .githooks
'''
]
# Overridden because: workspace = false
[tasks.install-clippy-rustup]
workspace = false
# Overridden because: we want to fail if there are warnings (-D warn)
[tasks.clippy]
workspace = false
args = [
"clippy",
"--all-targets",
"--",
"-W", "clippy::cast_possible_truncation",
"-W", "clippy::cast_sign_loss",
"-W", "clippy::fallible_impl_from",
"-W", "clippy::cast_precision_loss",
"-W", "clippy::cast_possible_wrap",
"-W", "clippy::print_stdout",
"-W", "clippy::dbg_macro",
"-D", "warnings"
]
# Overridden because: workspace = false and custom toolchain
[tasks.format]
workspace = false
toolchain = "nightly-2019-07-31"
# Overridden because: workspace = false and custom toolchain
[tasks.check-format]
workspace = false
toolchain = "nightly-2019-07-31"
################
# Task aliases #
[tasks.all]
workspace = false
extend = "dev-test-flow"
[tasks.e2e]
workspace = false
extend = "e2e-tests-flow"
[tasks.dry]
workspace = false
extend = "dry-tests-flow"
[tasks.webgui]
workspace = false
extend = "webgui-tests-flow"
[tasks.api]
workspace = false
extend = "api-tests-flow"
################
# Custom tasks #
[tasks.check-rs-format]
alias = "check-format"
[tasks.fix-ts]
description = "Runs prettier & tslint to format TypeScript code."
workspace = false
install_script = ["(cd ./api_tests; yarn install;)"]
script = ["cd api_tests; yarn run fix"]
[tasks.check-ts]
description = "Runs tsc, prettier & tslint to validate TypeScript syntax & format."
workspace = false
install_script = ["(cd ./api_tests; yarn install;)"]
script = ["cd api_tests; yarn run check"]
[tasks.cargo-toml-format]
description = "Runs cargo tomlfmt to format Cargo.toml files."
workspace = false
install_crate = { crate_name = "cargo-tomlfmt", binary = "cargo-tomlfmt", test_arg = "--help" }
script = [
'''
find . -name Cargo.toml | xargs -n1 cargo tomlfmt -p
'''
]
[tasks.check-cargo-toml-format]
description = "Runs cargo tomlfmt to check appropriate Cargo.toml format."
workspace = false
install_crate = { crate_name = "cargo-tomlfmt", binary = "cargo-tomlfmt", test_arg = "--help" }
script = [
'''
find . -name Cargo.toml | xargs -n1 cargo tomlfmt -d -p
'''
]
[tasks.ci]
workspace = false
run_task = "ci-flow"
#############
# api Tests #
[tasks.pre-api-tests]
description = "Install/build dependencies for api tests"
workspace = false
private = true
script = [ "( cd ./api_tests && yarn install;)" ]
#####################
# Dry api Test flow #
[tasks.dry-tests-flow]
description = "Defines the dry tests flow."
workspace = false
dependencies = [
"build",
"pre-api-tests",
"dry-tests"
]
[tasks.dry-tests]
description = "Runs tests that don't require any external services"
workspace = false
private = true
script = ['cd api_tests; yarn run test ./dry/*']
#########################
# Web GUI api Test flow #
[tasks.webgui-tests-flow]
description = "Defines the web GUI tests flow."
workspace = false
dependencies = [
"build",
"pre-api-tests",
"webgui-tests"
]
[tasks.webgui-tests]
description = "Runs tests to ensure that cnd serves comit-i"
workspace = false
private = true
script = [
"cd ./api_tests; yarn run test ./webgui/*"]
#################
# E2E Test flow #
[tasks.e2e-tests-flow]
description = "Defines the E2E-tests flow."
workspace = false
dependencies = [
"build",
"pre-api-tests",
"e2e-tests",
]
[tasks.e2e-tests]
# Usage: `cargo make e2e <folder>` folder can be:
# - empty (run all tests)
# - btc_eth or btc_eth-erc20 or *erc20
description = "Runs RFC003 end-to-end tests specified on command line. Supports GLOB."
workspace = false
private = true
install_script = ["(cd ./api_tests; yarn install;)"]
script_runner = "bash"
script = [
'''
cd ./api_tests;
glob="${1:-*}";
for dir in e2e/rfc003/$glob; do
add_test_files=$(ls "$dir/"*.ts 2>/dev/null|| true);
if test "$add_test_files"; then
files="$files $add_test_files"
fi
done;
yarn run test $files;
'''
]
######################################
# all API Tests flow #
[tasks.api-tests-flow]
description = "Defines all API tests flow."
workspace = false
dependencies = [
"build",
"pre-api-tests",
"api-tests",
]
[tasks.api-tests]
description = "Runs all API tests."
workspace = false
private = true
install_script = ["(cd ./api_tests; yarn install;)"]
script = ["cd ./api_tests; yarn run test"]