extend = [{ path = "coverage_grcov.Makefile.toml" }]
[config]
default_to_workspace = false
skip_core_tasks = true
[env]
RUST_OPTIMIZER_VERSION = "0.15.0"
RUST_VERSION = "1.79.0"
NIGHTLY_VERSION = "nightly-2024-06-25"
[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 = "${RUST_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 = "${RUST_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", "--all-features"]
[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 }
[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",
]
[tasks.machete-check]
toolchain = "${RUST_VERSION}"
command = "cargo"
args = ["machete"]
[tasks.machete-fix]
command = "cargo"
args = ["machete", "--fix"]
[tasks.test]
toolchain = "${RUST_VERSION}"
command = "cargo"
args = ["test", "--locked", "--all-features"]
[tasks.unit-test]
toolchain = "${RUST_VERSION}"
command = "cargo"
args = [
"test",
"--all-features",
"--lib"
]
[tasks.coverage-html]
alias = "coverage-grcov-html"
[tasks.coverage-lcov]
alias = "coverage-grcov-lcov"
[tasks.default]
alias = "custom-default"
[tasks.custom-default]
dependencies = ["format", "clippy-fix", "deny", "machete-fix", "unit-test"]
[tasks.all]
dependencies = ["custom-default", "coverage-html"]