-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.toml
197 lines (176 loc) · 5.99 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
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
__FIELDX_DEFAULT_TOOLCHAIN__ = { value = "nightly", condition = { env_not_set = ["__FIELDX_DEFAULT_TOOLCHAIN__"] } }
__FIELDX_TASK__ = { value = "test", condition = { env_not_set = ["__FIELDX_TASK__"] } }
__FIELDX_TOOLCHAINS__ = "1.77 stable nightly"
__PREV_RELEASE_TESTING__ = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/.release-tested"
[config]
default_to_workspace = true
[tasks.init]
args = ["-f", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/Cargo.lock"]
command = "rm"
[tasks.end]
args = ["-f", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/Cargo.lock"]
command = "rm"
[tasks.test]
category = "Test"
clear = true
dependencies = ["test-default", "test-feature-sets"]
description = "Extensive testing"
workspace = true
[tasks.test-versions]
description = "TESTING SUPPORTED Rust VERSIONS"
script = '''
toolchain_list = array %{__FIELDX_TOOLCHAINS__}
for toolchain in ${toolchain_list}
echo "Testing toolchain '${toolchain}'"
set_env __FIELDX_DEFAULT_TOOLCHAIN__ ${toolchain}
echo Removing ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/Cargo.lock
rm -f ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/Cargo.lock
cm_run_task ${__FIELDX_TASK__}
end
# When successfully done then record last commit
commit = exec git describe HEAD
writefile ${__PREV_RELEASE_TESTING__} ${commit.stdout}
'''
script_runner = "@duckscript"
[tasks.update-versions]
description = "Updating .stderr for all versions"
env = { TRYBUILD = "overwrite", __FIELDX_TASK__ = "test-compilation" }
run_task = { name = ["test-versions"] }
[tasks.test-default]
args = ["test", "--workspace"]
category = "Test"
command = "cargo"
description = "Test with only the default features"
toolchain = "${__FIELDX_DEFAULT_TOOLCHAIN__}"
[tasks.test-diagnostics]
args = ["test", "--workspace", "--features", "diagnostics"]
category = "Test"
command = "cargo"
condition_script = ["""
#!@duckscript
if eq ${__FIELDX_DEFAULT_TOOLCHAIN__} "nightly"
exit 0
end
echo Skipping diagnostics test on a non-nightly toolchain
exit 1
"""]
description = "Test with 'diagnostics' feature"
toolchain = "${__FIELDX_DEFAULT_TOOLCHAIN__}"
[tasks.test-compilation]
description = "Run only the compilation test"
script = '''
echo Skipping compilation test for ${__FIELDX_DEFAULT_TOOLCHAIN__} in ${CARGO_MAKE_WORKING_DIRECTORY}
'''
script_runner = "@duckscript"
workspace = true
[tasks.test-feature-sets]
description = "Test different feature sets"
script = '''
echo Skipping test of feature sets for ${__FIELDX_DEFAULT_TOOLCHAIN__} in ${CARGO_MAKE_WORKING_DIRECTORY}
'''
script_runner = "@duckscript"
workspace = true
[tasks.depends]
description = "Install necessary dependencies and tools"
script = '''
echo "Installing dependencies"
exec cargo install cargo-readme
'''
script_runner = "@duckscript"
[tasks.doc]
description = "Build documentation"
script = '''
readme_content = exec --fail-on-error cargo readme -r fieldx --template ../README.tpl
writefile ./README.md ${readme_content.stdout}
'''
script_runner = "@duckscript"
[tasks.changelog]
clear = true
description = "Produce CHANGELOG.md"
script = """
cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}
exec --fail-on-error git cliff -o CHANGELOG.md --tag ${CARGO_RELEASE_VERSION}
"""
script_runner = "@duckscript"
[tasks.is-clean]
category = "Check"
description = "Repository is clean"
script = '''
is_clean = exec git diff-index --exit-code --stat HEAD
if not eq ${is_clean.code} 0
print -bgc red -c yellow "!!!"
println -c bright_red " Repository is not clean."
echo ${is_clean.stdout}
exit 1
end
'''
script_runner = "@duckscript"
[tasks.release-testing]
clear = true
condition = { fail_message = "No release testing is needed, has been done for this commit already" }
condition_script = ['''
if is_path_exists ${__PREV_RELEASE_TESTING__}
prev = readfile ${__PREV_RELEASE_TESTING__}
prev = trim ${prev}
out = exec git describe HEAD
now = trim ${out.stdout}
if eq ${prev} ${now}
exit 1
end
end
''']
run_task = "test-versions"
script_runner = "@duckscript"
[tasks.version-patch-bump]
clear = true
description = "Bump release version"
script = '''
!include_files ./makefile.ds
reply = ask_user "Do you want to bump release version patch?"
reply = lowercase ${reply}
if eq ${reply} "y"
exec --fail-on-error cargo release version patch
reply = ask_user "Does this look good for you?"
reply = lowercase ${reply}
if eq ${reply} "y"
echo "Bumping the patch."
exec --fail-on-error cargo release version patch --execute --no-confirm
exec --fail-on-error git add Cargo.toml fieldx/Cargo.toml fieldx_aux/Cargo.toml fieldx_derive/Cargo.toml fieldx_derive_support/Cargo.toml
exec --fail-on-error git commit -m "minor: version bump"
end
end
'''
script_runner = "@duckscript"
[tasks.post-doc]
description = "Post-doc commit"
script = '''
exec --fail-on-error git add README.md CHANGELOG.md
diffed = exec git diff-index --exit-code --cached HEAD
if not eq ${diffed.code} 0
echo "Docs need committing."
exec --fail-on-error git commit -m "minor: Pre-release docs update"
exec --fail-on-error git push
end
'''
script_runner = "@duckscript"
[tasks.pre-release]
clear = true
dependencies = ["is-clean", "release-testing", "version-patch-bump", "doc", "changelog", "post-doc"]
description = "Pre-release tasks"
[tasks.publish]
clear = true
dependencies = ["pre-release"]
description = "Publish on crates.io"
script = '''
!include_files makefile.ds
reply = ask_user "Do you want to publish the crates?"
reply = lowercase ${reply}
if eq ${reply} "y"
exec --fail-on-error cargo release -x --no-confirm
else
echo "Won't publish."
end
'''
script_runner = "@duckscript"