-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile.toml
186 lines (155 loc) · 3.81 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
[tasks.conformance]
description = '''
Ensures the repository conforms to coding best practices, and only depends on libraries with
permissive licenses
'''
script = [
'''
set -e
if rustc --version | grep -qF 'nightly'; then
# Rust fmt
cargo fmt --all
# Clippy - best practices
[ "${CLIPPY_ENABLED}" = "false" ] || cargo clippy --all
fi
# Security vulnerability
# TODO: re-enable after `specs` is upgraded in Amethyst
cargo audit
# License compatibility
./scripts/conformance_license.sh
'''
]
[tasks.maintain]
description = '''
Performs the following code maintenance tasks:
* Format code: `cargo fmt --all`
* Upgrade dependencies: `cargo upgrade`
* Update dependencies: `cargo update`
* Check for outdated dependencies: `cargo outdated`
'''
dependencies = [
"workspace-format",
"workspace-dependencies-upgrade",
"workspace-dependencies-update",
"workspace-outdated"
]
# === workspace-format === #
[tasks.workspace-format]
dependencies = [
"workspace-format-pre",
"workspace-format-do",
"workspace-format-post"
]
[tasks.workspace-format-pre]
dependencies = ["ensure-repository-clean"]
[tasks.workspace-format-do]
script = [
'''
set +x
. ./scripts/log.sh
notice "Running \`cargo fmt --all\`"
cargo fmt --all
'''
]
[tasks.workspace-format-post]
script = [
'''
set +x
. ./scripts/log.sh
if [ -n "$(git status --porcelain)" ]; then
git commit -am "Format repository with Rustfmt."
notice "Formatted repository and committed changes."
fi
'''
]
# === workspace-dependencies-update === #
[tasks.workspace-dependencies-update]
dependencies = [
"workspace-dependencies-update-pre",
"workspace-dependencies-update-do",
"workspace-dependencies-update-post"
]
[tasks.workspace-dependencies-update-pre]
dependencies = ["ensure-repository-clean"]
[tasks.workspace-dependencies-update-do]
script = [
'''
set +x
. ./scripts/log.sh
notice "Running \`cargo update\`"
cargo update
'''
]
[tasks.workspace-dependencies-update-post]
script = [
'''
set +x
. ./scripts/log.sh
if [ -n "$(git status --porcelain)" ]; then
git commit -am "Updates workspace dependencies"
notice "Updated workspace dependencies and committed changes."
info "Remember to run \`cargo test\` before pushing."
fi
'''
]
# === workspace-dependencies-upgrade === #
[tasks.workspace-dependencies-upgrade]
dependencies = [
"workspace-dependencies-upgrade-pre",
"workspace-dependencies-upgrade-do",
"workspace-dependencies-upgrade-post"
]
[tasks.workspace-dependencies-upgrade-pre]
dependencies = ["ensure-repository-clean"]
[tasks.workspace-dependencies-upgrade-do]
script = [
'''
set +x
. ./scripts/log.sh
notice "Running \`cargo upgrade --all\`"
cargo upgrade --all
'''
]
[tasks.workspace-dependencies-upgrade-post]
script = [
'''
set +x
. ./scripts/log.sh
if [ -n "$(git status --porcelain)" ]; then
git commit -am "Upgrades workspace dependencies"
notice "Upgraded workspace dependencies and committed changes."
info "Remember to run \`cargo test\` before pushing."
fi
'''
]
# === workspace-outdated === #
[tasks.workspace-outdated]
dependencies = [
"workspace-outdated-pre",
"workspace-outdated-do",
"workspace-outdated-post"
]
[tasks.workspace-outdated-pre]
[tasks.workspace-outdated-do]
description = "Runs verify-outdated cargo plugin."
condition = { env = { "CARGO_MAKE_CRATE_HAS_DEPENDENCIES" = "TRUE" } }
script = [
'''
set +x
. ./scripts/log.sh
notice "Running \`cargo outdated -w --root-deps-only --exit-code 1\`"
if ! cargo outdated -w --root-deps-only --exit-code 1; then
warn "There are outdated dependencies. Please upgrade them as soon as possible."
fi
'''
]
[tasks.workspace-outdated-post]
# === common === #
[tasks.ensure-repository-clean]
script = [
'''
set +x
. ./scripts/log.sh
[ -z "$(git status --porcelain)" ] || error "Ensure the workspace is clean before running this task"
'''
]