forked from yewstack/yew
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.toml
195 lines (168 loc) · 4.83 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
######################
#
# public tasks:
# * pr-flow
# * lint
# * tests
# * benchmarks
#
# Run `cargo make --list-all-steps` for more details.
#
######################
[config]
min_version = "0.32.4"
default_to_workspace = false
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
CARGO_MAKE_CLIPPY_ARGS = "-- --deny=warnings"
[config.modify_core_tasks]
private = true
namespace = "core"
[tasks.pr-flow]
category = "Checks"
description = "Lint and test"
run_task = { name = ["lint", "tests"], fork = true }
[tasks.lint]
category = "Checks"
description = "Check formatting and run Clippy"
run_task = { name = ["lint-flow", "lint-stdweb"], fork = true }
[tasks.tests]
category = "Testing"
description = "Run all tests"
dependencies = ["tests-setup"]
env = { CARGO_MAKE_WORKSPACE_SKIP_MEMBERS = ["**/examples/*"] }
run_task = { name = [
"test-flow",
"tests-stdweb",
"doc-test-flow",
], fork = true, cleanup_task = "tests-cleanup" }
[tasks.benchmarks]
category = "Testing"
description = "Run benchmarks"
env = { CARGO_MAKE_WORKSPACE_SKIP_MEMBERS = ["**/examples/*"] }
run_task = { name = "bench-flow", fork = true }
[tasks.lint-flow]
private = true
workspace = true
dependencies = ["core::check-format-flow", "core::clippy-flow"]
[tasks.lint-stdweb]
private = true
cwd = "yew-stdweb"
command = "cargo"
args = [
"make",
"--loglevel",
"${CARGO_MAKE_LOG_LEVEL}",
"--profile",
"${CARGO_MAKE_PROFILE}",
"lint-flow",
]
[tasks.tests-setup]
private = true
script_runner = "@duckscript"
script = [
"""
test_flags = array --headless --firefox
yew_test_features = set wasm_test
fn set_httpbin_test_features
HTTPBIN_URL = get_env HTTPBIN_URL
echo INFO: using ${HTTPBIN_URL} for fetch service tests
yew_test_features = set "${yew_test_features},httpbin_test"
end
if is_defined HTTPBIN_URL
set_httpbin_test_features
else
# only enable docker if docker executable is available
# and --skip-httpbin cli argument not provided to cargo make
docker_path = which docker
start_docker = is_defined docker_path
args_provided = not is_empty ${CARGO_MAKE_TASK_ARGS}
if ${args_provided}
args = split ${CARGO_MAKE_TASK_ARGS} ;
for arg in ${args}
if eq ${arg} --skip-httpbin
start_docker = set false
release ${args}
end
end
end
if ${start_docker}
echo Starting httpbin docker image...
mkdir ./target
cidfile = set ./target/httpbin_container.cid
# if container already running, stop it
if is_file ${cidfile}
container_id = readfile ${cidfile}
rm ${cidfile}
set_env HTTPBIN_CONTAINER_ID ${container_id}
cm_run_task tests-cleanup
end
# get local port
docker_port = get_env YEW_HTTPBIN_PORT
if not is_defined docker_port
docker_port = set 7117
end
exec --fail-on-error docker run -d --cidfile ${cidfile} -p "${docker_port}:80" kennethreitz/httpbin
container_id = readfile ${cidfile}
container_id = trim ${container_id}
set_env HTTPBIN_CONTAINER_ID ${container_id}
set_env HTTPBIN_URL http://localhost:${docker_port}
set_httpbin_test_features
# wait for docker container to boot before running tests
if is_defined HTTPBIN_WAIT
sleep ${HTTPBIN_WAIT}
else
sleep 500
end
else
echo "INFO: HTTPBIN_URL isn't set, won't run fetch service tests"
echo " please see the CONTRIBUTING.md file for instructions"
end
end
yew_test_flags = array_join ${test_flags} " "
echo "running tests with flags: ${yew_test_flags} and features: ${yew_test_features}"
set_env YEW_TEST_FLAGS ${yew_test_flags}
set_env YEW_TEST_FEATURES ${yew_test_features}
""",
]
[tasks.tests-cleanup]
private = true
condition = { env_set = ["HTTPBIN_CONTAINER_ID"] }
ignore_errors = true
command = "docker"
args = ["rm", "--force", "${HTTPBIN_CONTAINER_ID}"]
[tasks.tests-stdweb]
private = true
extend = "core::wasm-pack-base"
cwd = "yew-stdweb"
args = [
"test",
"@@split(YEW_TEST_FLAGS, )",
"--",
"--features",
"${YEW_TEST_FEATURES}",
]
[tasks.test-flow]
private = true
workspace = true
dependencies = ["test"]
[tasks.test]
private = true
command = "cargo"
args = ["test", "--all-targets"]
[tasks.doc-test-flow]
private = true
workspace = true
dependencies = ["doc-test"]
[tasks.doc-test]
private = true
command = "cargo"
args = ["test", "--doc"]
[tasks.bench-flow]
private = true
workspace = true
dependencies = ["bench"]
[tasks.bench]
private = true
command = "cargo"
args = ["bench"]