-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile.toml
332 lines (290 loc) · 7.91 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
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# # cargo-make config for CI.
#
# ## Variables to maintain
# * `MSRV`
# + Minimal supported rust version.
# + This should be consistent with `package.rust-version` field of `Cargo.toml`.
#
# ## Controllable variables
# * `VERBOSE`
# + If set to non-`false` or non-`0`, `--verbose` options are added for build and test.
#
# ## Profiles
# Profiles are mainly used to change features and dependencies.
#
# * `default`
# + Default features.
# + Up-to-date deps.
# * `feat-none`
# + No features.
# + Up-to-date deps.
# * `feat-alloc`
# + `alloc` feature.
# + Up-to-date deps.
# * `feat-std`
# + `std` feature.
# + Up-to-date deps.
# * `feat-memchr`
# + `memchr` feature.
# + Up-to-date deps.
# * `feat-serde`
# + `serde` feature.
# + Up-to-date deps.
# * `feat-serde-alloc`
# + `serde` and `alloc` features.
# + Up-to-date deps.
# * `feat-serde-std`
# + `serde` and `std` features.
# + Up-to-date deps.
# * `feat-all`
# + All features.
# + Up-to-date deps.
# * `minimal-deps-feat-none`
# + No features.
# + Minimal versions deps.
# * `minimal-deps-default`
# + Default features.
# + Minimal versions deps.
# * `minimal-deps-feat-all`
# + All features.
# + Minimal versions deps.
#
# ## Tasks
#
# ### For CLI
# * `manual-ci-all`
# + Invokes all required CI tasks, with required rust versions.
# * `ci-all-profiles`
# + Invokes required CI tasks for all profiles.
# * `ci-all-profiles`
# + Invokes required CI tasks for all profiles.
#
# ### For automated CI
# * `ci-once`
# + CI task that should be run at least once for one commit.
# + This does not need to be run with multiple tasks, or
# with multiple rust versions.
# * `ci`
# + CI task that should (or recommended to) be run for each profiles and/or
# for each toolchain.
################################################################
[env]
# Minimal supported rust version.
MSRV = "1.60.0"
FEATURES = ""
ALL_FEATURES = false
# `FEATURES = "default,..."` is recommended to enable default features.
# `ALL_FEATURES = true` does NOT require this to be `false`.
NO_DEFAULT_FEATURES = true
USE_MINIMAL_DEPENDENCIES = false
[env.default]
FEATURES = "default"
[env.feat-none]
FEATURES = ""
[env.feat-alloc]
FEATURES = "alloc"
[env.feat-std]
FEATURES = "std"
[env.feat-memchr]
FEATURES = "memchr"
[env.feat-serde]
FEATURES = "serde"
[env.feat-serde-alloc]
FEATURES = "serde,alloc"
[env.feat-serde-std]
FEATURES = "serde,std"
[env.feat-all]
ALL_FEATURES = true
[env.minimal-deps-feat-none]
FEATURES = ""
USE_MINIMAL_DEPENDENCIES = true
[env.minimal-deps-feat-default]
FEATURES = "default"
USE_MINIMAL_DEPENDENCIES = true
[env.minimal-deps-feat-all]
ALL_FEATURES = true
USE_MINIMAL_DEPENDENCIES = true
################################################################
# For manual invocation from CLI.
[tasks.manual-ci-all]
VERBOSE = { value = "false", condition = { env_not_set = ["VERBOSE"] } }
script = [
'''
cargo +${MSRV} make ci-once
cargo +${MSRV} make ci-all-profiles
cargo +stable make --profile default ci
cargo +stable make --profile feat-all ci
cargo +stable make --profile minimal-deps-feat-all ci
cargo +beta make --profile feat-all ci
cargo +nightly make --profile feat-all ci
cargo +nightly make --profile default check-miri
cargo +nightly make --profile feat-none check-miri
'''
]
# For manual invocation from CLI.
[tasks.ci-all-profiles]
VERBOSE = { value = "false", condition = { env_not_set = ["VERBOSE"] } }
script = [
'''
cargo make --profile default ci
cargo make --profile feat-none ci
cargo make --profile feat-alloc ci
cargo make --profile feat-std ci
cargo make --profile feat-memchr ci
cargo make --profile feat-serde ci
cargo make --profile feat-serde-alloc ci
cargo make --profile feat-serde-std ci
cargo make --profile feat-all ci
cargo make --profile minimal-deps-feat-none ci
cargo make --profile minimal-deps-feat-default ci
cargo make --profile minimal-deps-feat-all ci
'''
]
# CI tasks to run only once per commit.
# Recommended to be run before `ci` task.
[tasks.ci-once]
dependencies = [
"print-makers-env",
"ci-once-check",
]
# CI tasks to run per profile.
[tasks.ci]
dependencies = [
"print-makers-env",
"print-rust-version",
"prepare-dependencies",
"ci-check",
"ci-build",
"ci-test",
{ name = "check-miri", condition = { channels = ["nightly"] } },
]
[tasks.ci-once-check]
dependencies = [
"check-rustfmt",
]
[tasks.ci-check]
dependencies = [
"check-clippy",
]
[tasks.ci-build]
dependencies = [
"build",
]
[tasks.ci-test]
dependencies = [
"test",
]
[tasks.print-makers-env]
script = [
'''
echo "Environment:"
echo " PROFILE_NAME: ${CARGO_MAKE_PROFILE}"
echo " ALL_FEATURES: ${ALL_FEATURES}"
echo " NO_DEFAULT_FEATURES: ${NO_DEFAULT_FEATURES}"
echo " FEATURES: ${FEATURES}"
echo " VERBOSE: ${VERBOSE:-}"
echo " Rust version: ${CARGO_MAKE_RUST_VERSION}"
echo " Rust channel: ${CARGO_MAKE_RUST_CHANNEL}"
'''
]
[tasks.prepare-dependencies]
run_task = [
{ name = "prepare-minimal-dependencies", condition = { env_true = ["USE_MINIMAL_DEPENDENCIES"] } },
{ name = "prepare-latest-dependencies" },
]
[tasks.prepare-minimal-dependencies]
condition = { env_true = ["USE_MINIMAL_DEPENDENCIES"] }
toolchain = "nightly"
command = "cargo"
args = ["update", "-Z", "minimal-versions"]
[tasks.prepare-latest-dependencies]
command = "cargo"
args = ["update"]
[tasks.cargo-clean]
command = "cargo"
args = ["clean"]
[tasks.check-rustfmt]
run_task = [
{ name = "check-rustfmt-strict", condition = { rust_version = { equal = "$MSRV" } } },
{ name = "check-rustfmt-ignore-errors" },
]
[tasks.check-rustfmt-strict]
dependencies = ["print-rustfmt-version"]
command = "cargo"
args = ["fmt", "--all", "--", "--check"]
[tasks.check-rustfmt-ignore-errors]
dependencies = ["print-rustfmt-version"]
command = "cargo"
args = ["fmt", "--all", "--", "--check"]
[tasks.print-rustfmt-version]
install_crate = { rustup_component_name = "rustfmt" }
command = "cargo"
args = ["fmt", "--version"]
[tasks.check-miri]
dependencies = ["print-miri-version", "cargo-clean"]
toolchain = "nightly"
command = "cargo"
args = [
"miri",
"test",
"@@decode(NO_DEFAULT_FEATURES,true,--no-default-features,)",
"@@decode(ALL_FEATURES,true,--all-features,)",
"@@decode(FEATURES,,,--features=${FEATURES})",
]
[tasks.print-miri-version]
install_crate = { rustup_component_name = "miri" }
toolchain = "nightly"
command = "cargo"
args = ["miri", "--version"]
[tasks.check-clippy]
run_task = [
{ name = "check-clippy-strict", condition = { rust_version = { equal = "$MSRV" } } },
{ name = "check-clippy-ignore-errors" },
]
[tasks.check-clippy-strict]
dependencies = ["print-clippy-version"]
command = "cargo"
args = [
"clippy",
"@@decode(NO_DEFAULT_FEATURES,true,--no-default-features,)",
"@@decode(ALL_FEATURES,true,--all-features,)",
"@@decode(FEATURES,,,--features=${FEATURES})",
"--",
"--deny",
"warnings",
]
[tasks.check-clippy-ignore-errors]
dependencies = ["print-clippy-version"]
command = "cargo"
args = [
"clippy",
"@@decode(NO_DEFAULT_FEATURES,true,--no-default-features,)",
"@@decode(ALL_FEATURES,true,--all-features,)",
"@@decode(FEATURES,,,--features=${FEATURES})",
]
ignore_errors = true
[tasks.print-clippy-version]
install_crate = { rustup_component_name = "clippy" }
command = "cargo"
args = ["clippy", "--version"]
[tasks.print-rust-version]
command = "rustc"
args = ["--version"]
[tasks.build]
command = "cargo"
args = [
"build",
"@@decode(NO_DEFAULT_FEATURES,true,--no-default-features,)",
"@@decode(ALL_FEATURES,true,--all-features,)",
"@@decode(FEATURES,,,--features=${FEATURES})",
"@@decode(VERBOSE,false,,0,,--verbose)",
]
[tasks.test]
command = "cargo"
args = [
"test",
"@@decode(NO_DEFAULT_FEATURES,true,--no-default-features,)",
"@@decode(ALL_FEATURES,true,--all-features,)",
"@@decode(FEATURES,,,--features=${FEATURES})",
"@@decode(VERBOSE,false,,0,,--verbose)",
]