-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile.toml
173 lines (153 loc) · 4.66 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
[config]
default_to_workspace = false
skip_core_tasks = true
[env]
# If you bump this version, verify RUST_VERSION correctness
RUST_OPTIMIZER_VERSION = "0.15.0"
# Use rust version from rust-optimizer Dockerfile (see https://github.com/CosmWasm/rust-optimizer/blob/main/Dockerfile#L1)
# to be sure that we compile / test against the same version
RUST_VERSION = "1.75.0"
NIGHTLY_VERSION = "nightly-2023-08-29"
[tasks.install-stable]
script = '''
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain ${RUST_VERSION}
rustup target add wasm32-unknown-unknown --toolchain ${RUST_VERSION}
rustup component add rustfmt --toolchain ${RUST_VERSION}
rustup component add clippy --toolchain ${RUST_VERSION}
rustup component add llvm-tools-preview --toolchain ${RUST_VERSION}
'''
[tasks.install-nightly]
script = '''
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain ${NIGHTLY_VERSION}
rustup target add wasm32-unknown-unknown --toolchain ${NIGHTLY_VERSION}
rustup component add rustfmt --toolchain ${NIGHTLY_VERSION}
rustup component add clippy --toolchain ${NIGHTLY_VERSION}
'''
[tasks.rust-optimizer]
cwd = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}"
script = """
if [[ $(arch) == "arm64" ]]; then
image="cosmwasm/workspace-optimizer-arm64:${RUST_OPTIMIZER_VERSION}"
else
image="cosmwasm/workspace-optimizer:${RUST_OPTIMIZER_VERSION}"
fi
docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
${image}
"""
[tasks.format]
toolchain = "${NIGHTLY_VERSION}"
install_crate = { crate_name = "rustfmt-nightly", rustup_component_name = "rustfmt-preview", binary = "rustfmt", test_arg = "--help" }
command = "cargo"
args = ["fmt", "--all", "--", "--emit=files","--verbose"]
[tasks.format-check]
toolchain = "${NIGHTLY_VERSION}"
install_crate = { crate_name = "rustfmt-nightly", rustup_component_name = "rustfmt-preview", binary = "rustfmt", test_arg = "--help" }
command = "cargo"
args = ["fmt", "--all", "--","--verbose", "--check"]
[tasks.deny]
command = "cargo"
args = ["deny", "--all-features", "check"]
[tasks.check]
toolchain = "${RUST_VERSION}"
command = "cargo"
args = ["check"]
[tasks.clippy-check]
toolchain = "${RUST_VERSION}"
command = "cargo"
args = ["clippy","--all-features","--","-D","warnings"]
[tasks.clippy-fix]
toolchain = "${RUST_VERSION}"
command = "cargo"
args = ["clippy","--all-features", "--fix","--allow-staged", "--allow-dirty", "--","-D","warnings"]
[tasks.todo-check]
script = { file = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/todo-lint.sh", absolute_path = true }
# This task requires the `cargo-tarpaulin` package: https://crates.io/crates/cargo-tarpaulin
[tasks.cov]
toolchain = "${RUST_VERSION}"
command = "cargo"
args = [
"tarpaulin",
"--ignore-tests",
"-o",
"Lcov",
"--output-dir",
"target/tarpaulin",
]
[tasks.docs]
toolchain = "${RUST_VERSION}"
command = "cargo"
args = [
"doc",
"--target-dir",
"docs",
"--color",
"never",
"--no-deps",
"--workspace",
"--exclude",
"'cosmwasm*'",
"--exclude",
"'cw*'",
"--release",
]
# This task requires the `cargo-machete` package: https://crates.io/crates/cargo-machete
[tasks.machete-check]
toolchain = "${RUST_VERSION}"
command = "cargo"
args = ["machete"]
[tasks.machete-fix]
command = "cargo"
args = ["machete", "--fix"]
# Unoptimized Wasm build of contract for testing
[tasks.wasm]
toolchain = "${RUST_VERSION}"
command = "cargo"
args = [
"build",
"--target",
"wasm32-unknown-unknown",
"--lib",
"--release",
"--package",
"osmosis-test-contract",
"--package",
"astroport-test-contract"
]
# Run all tests
[tasks.test]
toolchain = "${RUST_VERSION}"
command = "cargo"
args = ["test", "--locked"]
# Run unit tests
[tasks.unit-test]
toolchain = "${RUST_VERSION}"
command = "cargo"
args = [
"test",
"--all-features",
"--lib"
]
# Run integration tests
[tasks.integration-test]
env = { TEST_RUNNER = "osmosis-test-tube" }
cwd = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}"
dependencies = ["wasm"]
toolchain = "${RUST_VERSION}"
command = "cargo"
args = [
"test",
"--all-features",
"--test",
"*",
]
# Run automatically on "cargo make". This is the default task.
[tasks.default]
alias = "custom-default"
# Custom tasks to run on "cargo make"
[tasks.custom-default]
dependencies = ["format", "clippy-fix", "deny", "machete-fix", "unit-test", "integration-test"]
# Docs and Test coverage are not run by default. Can run all with "cargo make all".
[tasks.all]
dependencies = ["custom-default", "cov"]