-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.toml
205 lines (169 loc) · 5.21 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
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = 1
CARGO_MAKE_WORKSPACE_SKIP_MEMBERS = "canaries/*"
RUSTDOCFLAGS = { value = "", condition = { env_not_set = ["RUSTDOCFLAGS"] } }
NIGHTLY = { script = ["cat rust-nightly.txt"], condition = { env_not_set = ["NIGHTLY"] } }
RUSTFLAGS = { value = "-Dwarnings", condition = { env_true = ["CARGO_MAKE_CI"] } }
[config]
default_to_workspace = false
skip_core_tasks = true
skip_git_env_info = true
skip_rust_env_info = true
[tasks.default]
description = "List tasks"
script = "cargo make --quiet --list-all-steps --hide-uninteresting"
# Build
[tasks.build-code]
category = "build"
description = "Build Code"
command = "cargo"
args = ["build", "--verbose", "--release", "${@}"]
# Test
[tasks.unit-tests]
category = "test"
description = "Run Unit Tests"
workspace = true
command = "cargo"
args = ["--verbose", "test-all-features", "${@}"]
dependencies = ["install-cargo-all-features"]
# Security
[tasks.security]
category = "security"
description = "Run security checks"
run_task = { name = [
"cargo-audit",
"cargo-deny",
"cargo-vet",
] }
[tasks.cargo-audit]
category = "security"
install_crate = { crate_name = "cargo-audit", version = "0.21.0", binary = "cargo-audit", test_arg = "-V" }
command = "cargo"
args = ["audit"]
[tasks.cargo-deny]
category = "security"
install_crate = { crate_name = "cargo-deny", version = "0.16.3", binary = "cargo-deny", test_arg = "-V" }
command = "cargo"
args = ["deny", "check"]
[tasks.cargo-vet]
category = "security"
install_crate = { crate_name = "cargo-vet", version = "0.10.0", binary = "cargo-vet", test_arg = "-V" }
command = "cargo"
args = ["vet", "check"]
# Correctness
[tasks.correctness]
category = "correctness"
description = "Run correctness checks"
run_task = { name = [
"fmt",
"check-features",
"clippy",
"check-canaries",
"machete",
] }
[tasks.check-fmt]
dependencies = ["check-fmt-rust", "check-fmt-toml"]
description = "Check file formatting"
[tasks.fmt]
dependencies = ["fmt-rust", "fmt-toml"]
description = "Format files"
[tasks.check-fmt-rust]
category = "correctness"
description = "Check rust code formatting"
toolchain = "${NIGHTLY}"
command = "cargo"
args = ["fmt", "--all", "--", "--check"]
dependencies = ["install-nightly"]
[tasks.fmt-rust]
category = "correctness"
description = "Format rust code"
toolchain = "${NIGHTLY}"
command = "cargo"
args = ["fmt", "--all"]
dependencies = ["install-nightly"]
[tasks.check-fmt-toml]
category = "correctness"
description = "Check toml formatting"
script = "git ls-files -z '*.toml' | xargs -0 -- taplo fmt --check --diff"
dependencies = ["install-taplo"]
[tasks.fmt-toml]
category = "correctness"
description = "Format toml"
script = "git ls-files -z '*.toml' | xargs -0 taplo fmt"
dependencies = ["install-taplo"]
[tasks.install-taplo]
private = true
install_crate = { crate_name = "taplo-cli", version = "0.9.0", binary = "taplo", test_arg = ["-V"] }
[tasks.check-features]
category = "correctness"
description = "Check features"
workspace = true
command = "cargo"
args = ["--verbose", "check-all-features"]
dependencies = ["install-cargo-all-features"]
[tasks.clippy]
category = "correctness"
description = "Run clippy to lint code"
workspace = true
script = '''
cargo clippy
cargo clippy --all-targets
cargo clippy --no-default-features
cargo clippy --all-targets --all-features
'''
install_crate = { rustup_component_name = "clippy" }
[tasks.check-canary-std]
category = "correctness"
description = "Check no-std support"
command = "cargo"
args = ["check", "--target=aarch64-unknown-none", "-p=canary-std"]
dependencies = ["install-no-std-target"]
[tasks.check-canary-alloc]
category = "correctness"
description = "Check no-alloc support"
command = "cargo"
args = ["check", "--target=aarch64-unknown-none", "-p=canary-alloc"]
dependencies = ["install-no-std-target"]
[tasks.check-canaries]
category = "correctness"
description = "Check no-std/no-alloc support"
dependencies = ["check-canary-alloc", "check-canary-std"]
[tasks.install-no-std-target]
private = true
script = "rustup target add aarch64-unknown-none"
[tasks.machete]
command = "cargo"
args = ["machete"]
install_crate = { crate_name = "cargo-machete", version = "0.6.2", binary = "cargo-machete", test_arg = "--version" }
# Docs
[tasks.gen-docs-nightly]
category = "docs"
description = "Generate docs with rust nightly"
toolchain = "${NIGHTLY}"
env = { RUSTDOCFLAGS = "--cfg docs ${RUSTDOCFLAGS}" }
command = "cargo"
args = ["doc", "--all-features"]
dependencies = ["install-nightly"]
[tasks.zip-docs]
category = "docs"
description = "Zip docs"
script = "zip -qr docs.zip target/doc"
# Misc
[tasks.install-nightly]
description = "Install nightly rust"
# First check if the toolchain is installed, because that is much faster.
# Don't do this if you want to keep a rolling channel up-to-date.
script = "rustup run ${NIGHTLY} true 2>/dev/null || rustup toolchain install ${NIGHTLY} --profile minimal -c rustfmt"
[tasks.git-unchanged]
description = "Verify files are unchanged"
script = '''
git diff
status=$(git status -s)
if [ -n "$status" ]; then
echo "$status"
exit 1
fi
'''
[tasks.install-cargo-all-features]
private = true
install_crate = { crate_name = "cargo-all-features", version = "1.10.0", binary = "cargo-check-all-features", test_arg = ["-V"] }