[config]
init_task = "init"
end_task = "end"
[env]
RUST_BACKTRACE = "full"
KCOV_VERSION = "33"
[tasks.default]
description = "Default task points to the development testing flow"
dependencies = [
"dev-test-flow"
]
[tasks.ci-flow]
description = "CI task will run cargo build and cargo test with verbose output"
dependencies = [
"pre-ci-flow",
"pre-build",
"build-verbose",
"post-build",
"pre-test",
"test-verbose",
"post-test",
"ci-coverage-flow",
"post-ci-flow"
]
[tasks.workspace-ci-flow]
description = "CI task will run CI flow for each member and merge coverage reports"
dependencies = [
"pre-workspace-ci-flow",
"workspace-members-ci",
"workspace-coverage",
"post-workspace-ci-flow"
]
[tasks.dev-test-flow]
description = "Development testing flow will first format the code, and than run cargo build and test"
dependencies = [
"format-flow",
"pre-build",
"build",
"post-build",
"pre-test",
"test",
"post-test"
]
[tasks.pre-publish-clean-flow]
description = "Clears old artifactes before publishing"
dependencies = [
"pre-clean",
"clean",
"post-clean"
]
[tasks.pre-publish-conditioned-clean-flow]
description = "Clears old artifactes before publishing"
condition = { env_not_set = [ "CARGO_MAKE_SKIP_PREPUBLISH_CLEAN" ] }
run_task = "pre-publish-clean-flow"
[tasks.publish-flow]
description = "Publish flow - First clean the target directory of any old leftovers, package and publish"
dependencies = [
"pre-publish-conditioned-clean-flow",
"pre-publish",
"publish",
"post-publish"
]
[tasks.build-flow]
description = "Full sanity testing flow."
dependencies = [
"init-build-flow",
"pre-clean",
"clean-apidocs",
"clean",
"post-clean",
"format-flow",
"pre-build",
"build",
"post-build",
"pre-test",
"test",
"post-test",
"pre-verify-project",
"verify-project",
"post-verify-project",
"pre-audit",
"audit",
"post-audit",
"pre-outdated",
"outdated",
"post-outdated",
"pre-docs",
"docs",
"post-docs",
"copy-apidocs",
"end-build-flow"
]
[tasks.empty]
description = "Empty Task"
[tasks.init]
description = "By default this task is invoked at the start of every cargo-make run."
[tasks.end]
description = "By default this task is invoked at the end of every cargo-make run."
[tasks.init-build-flow]
[tasks.pre-clean]
[tasks.clean-apidocs]
description = "Delete API docs."
command = "rm"
args = ["-Rf", "./docs/api"]
[tasks.clean]
description = "Runs the cargo clean command."
command = "cargo"
args = ["clean"]
[tasks.post-clean]
[tasks.delete-lock]
description = "Deletes the Cargo.lock file."
script = [
"rm -f ./Cargo.lock"
]
[tasks.pre-format]
[tasks.format]
description = "Runs the cargo rustfmt plugin."
install_crate = "rustfmt"
command = "cargo"
args = ["fmt", "--", "--write-mode=overwrite"]
[tasks.post-format]
[tasks.format-flow]
description = "Runs the cargo rustfmt plugin as part of a flow."
dependencies = [
"pre-format",
"format",
"post-format"
]
[tasks.pre-docs]
[tasks.docs]
description = "Generate rust documentation."
command = "cargo"
args = ["doc", "--no-deps"]
[tasks.post-docs]
[tasks.pre-build]
[tasks.build]
description = "Runs the rust compiler."
command = "cargo"
args = ["build", "--all-features"]
[tasks.build-verbose]
description = "Runs the rust compiler with verbose output."
command = "cargo"
args = ["build", "--verbose", "--all-features"]
[tasks.post-build]
[tasks.pre-test]
[tasks.test]
description = "Runs all available tests."
command = "cargo"
args = ["test", "--all-features"]
[tasks.test-verbose]
description = "Runs all available tests with verbose output."
command = "cargo"
args = ["test", "--verbose", "--all-features"]
[tasks.post-test]
[tasks.pre-bench]
[tasks.bench]
description = "Runs all available bench files."
command = "cargo"
args = ["bench"]
[tasks.post-bench]
[tasks.bench-flow]
description = "Runs a bench flow."
dependencies = [
"pre-bench",
"bench",
"post-bench"
]
[tasks.pre-verify-project]
[tasks.verify-project]
description = "Runs verify-project cargo plugin."
command = "cargo"
args = ["verify-project"]
[tasks.post-verify-project]
[tasks.pre-audit]
[tasks.audit]
description = "Runs verify-audit cargo plugin."
install_crate = "cargo-audit"
command = "cargo"
args = ["audit"]
[tasks.post-audit]
[tasks.pre-outdated]
[tasks.outdated]
description = "Runs verify-outdated cargo plugin."
install_crate = "cargo-outdated"
command = "cargo"
args = ["outdated", "--root-deps-only", "--exit-code", "1"]
[tasks.post-outdated]
[tasks.clippy]
description = "Runs clippy code linter."
install_crate = "clippy"
command = "cargo"
args = ["clippy"]
[tasks.copy-apidocs]
description = "Copies the generated documentation to the docs/api directory."
script = [
"mkdir -p ./docs/api",
"mv ./target/doc/* ./docs/api"
]
[tasks.end-build-flow]
[tasks.pre-package]
[tasks.package]
description = "Runs the cargo package command."
command = "cargo"
args = ["package"]
[tasks.post-package]
[tasks.pre-publish]
[tasks.publish]
description = "Runs the cargo publish command."
command = "cargo"
args = ["publish"]
[tasks.post-publish]
[tasks.pre-git-add]
[tasks.git-add]
description = "Runs the cargo add command."
command = "git"
args = ["add", "."]
[tasks.post-git-add]
[tasks.pre-git-status]
[tasks.git-status]
description = "Runs git status command."
command = "git"
args = ["status"]
[tasks.post-git-status]
[tasks.pre-git-commit]
[tasks.git-commit]
description = "Runs git commit command."
command = "git"
args = ["commit"]
[tasks.git-commit-message]
description = "Runs git commit command with the message defined in the COMMIT_MSG environment variable."
script = [
"git commit -m \"$COMMIT_MSG\""
]
[tasks.post-git-commit]
[tasks.pre-git-push]
[tasks.git-push]
description = "Runs git push command."
command = "git"
args = ["push"]
[tasks.post-git-push]
[tasks.git-pull]
description = "Runs git pull command."
command = "git"
args = ["pull"]
[tasks.pre-ci-flow]
[tasks.post-ci-flow]
[tasks.pre-workspace-ci-flow]
[tasks.post-workspace-ci-flow]
[tasks.workspace-members-ci]
description = "Runs the ci-flow for every workspace member."
script = [
'''
#prevent codecov publish in member builds
export CARGO_MAKE_SKIP_CODECOV="true"
export CARGO_MAKE_WORKSPACE_TARGET_DIRECTORY="${CARGO_MAKE_WORKING_DIRECTORY}/target"
#output coverage data goes into workspace level
export CARGO_MAKE_COVERAGE_REPORT_DIRECTORY="${CARGO_MAKE_WORKSPACE_TARGET_DIRECTORY}/coverage"
cargo make --loglevel=${CARGO_MAKE_LOG_LEVEL} ci-flow
unset CARGO_MAKE_COVERAGE_REPORT_DIRECTORY
unset CARGO_MAKE_WORKSPACE_TARGET_DIRECTORY
unset CARGO_MAKE_SKIP_CODECOV
'''
]
[tasks.workspace-members-ci.windows]
run_task = "ci-flow"
[tasks.workspace-coverage]
description = "Runs coverage task (by default the codecov flow)."
linux_alias = "codecov"
[tasks.pre-coverage]
[tasks.coverage]
description = "Runs coverage (by default using kcov)."
alias = "coverage-kcov"
[tasks.coverage-kcov]
description = "Installs (if missing) and runs coverage using kcov (not supported on windows)"
windows_alias = "empty"
condition = { env_set = [ "KCOV_VERSION" ] }
install_script = [
'''
command -v kcov >/dev/null 2>&1 || {
if [ "$(grep -Ei 'debian|buntu|mint' /etc/*release)" ]; then
sudo apt-get update || true
sudo apt-get install -y libcurl4-openssl-dev libelf-dev libdw-dev cmake gcc binutils-dev
wget https://github.com/SimonKagstrom/kcov/archive/v$KCOV_VERSION.zip
unzip v$KCOV_VERSION.zip
cd kcov-$KCOV_VERSION
mkdir build
cd ./build
cmake ..
make
sudo make install
cd ../..
rm -rf kcov-$KCOV_VERSION
fi
}
'''
]
script = [
'''
echo "Working Directory: ${CARGO_MAKE_WORKING_DIRECTORY}"
TARGET_DIRECTORY="target/coverage"
if [ -n "$CARGO_MAKE_COVERAGE_REPORT_DIRECTORY" ]; then
TARGET_DIRECTORY="$CARGO_MAKE_COVERAGE_REPORT_DIRECTORY"
mkdir -p ${TARGET_DIRECTORY}
else
mkdir -p ./target/coverage
fi
BINARY_DIRECTORY=target/debug/deps
if [ -n "$CARGO_MAKE_WORKSPACE_TARGET_DIRECTORY" ]; then
BINARY_DIRECTORY="${CARGO_MAKE_WORKSPACE_TARGET_DIRECTORY}/debug/deps"
fi
echo "Running unit tests from directory: ${BINARY_DIRECTORY}"
for file in ${BINARY_DIRECTORY}/${CARGO_MAKE_CRATE_FS_NAME}*
do
if "$file" ; then
echo "Running file: $file"
kcov --include-pattern=${CARGO_MAKE_WORKING_DIRECTORY}/src/ "$TARGET_DIRECTORY" "$file" || true
fi
done
echo "Running integration tests from directory: ${BINARY_DIRECTORY}"
for file in ${BINARY_DIRECTORY}/test_*
do
if "$file" ; then
echo "Running file: $file"
kcov --include-pattern=${CARGO_MAKE_WORKING_DIRECTORY}/src/ "$TARGET_DIRECTORY" "$file" || true
fi
done
'''
]
[tasks.coverage-tarpaulin]
description = "Runs coverage using tarpaulin rust crate (linux only)"
[tasks.coverage-tarpaulin.linux]
install_crate = "cargo-tarpaulin"
command = "cargo"
args = ["tarpaulin"]
[tasks.post-coverage]
[tasks.coverage-flow]
description = "Runs the full coverage flow."
dependencies = [
"pre-coverage",
"coverage",
"post-coverage"
]
[tasks.codecov]
description = "Runs codecov script to upload coverage results to codecov."
windows_alias = "empty"
script_runner = "bash"
condition = { env_not_set = [ "CARGO_MAKE_SKIP_CODECOV" ] }
script = [
"#!/usr/bin/env bash",
"bash <(curl -s https://codecov.io/bash)"
]
[tasks.codecov-flow]
description = "Runs the full coverage flow and uploads the results to codecov."
windows_alias = "empty"
dependencies = [
"coverage-flow",
"codecov"
]
[tasks.ci-coverage-flow]
description = "Runs the coverage flow and uploads the results to codecov."
windows_alias = "empty"
condition = { env = { "TRAVIS" = "true", "CARGO_MAKE_RUN_CODECOV" = "true" } }
run_task = "codecov-flow"
[tasks.upload-artifacts]
description = "Uploads the binary artifact from the cargo package/publish output."
alias = "bintray-upload"
[tasks.bintray-upload]
description = "Uploads the binary artifact from the cargo package/publish output to bintray."
[tasks.bintray-upload.linux]
condition = { env_set = [ "BINTRAY_API_KEY", "BINTRAY_OWNER_NAME", "BINTRAY_PACKAGE_NAME" ] }
script = [
"curl -T \"./target/package/${CARGO_MAKE_CRATE_NAME}-${CARGO_MAKE_CRATE_VERSION}/target/debug/${CARGO_MAKE_CRATE_NAME}\" -u${BINTRAY_OWNER_NAME}:${BINTRAY_API_KEY} -H \"X-Bintray-Package:${BINTRAY_PACKAGE_NAME}\" -H \"X-Bintray-Version:v${CARGO_MAKE_CRATE_VERSION}\" https://api.bintray.com/content/${BINTRAY_OWNER_NAME}/${CARGO_MAKE_CRATE_NAME}/${CARGO_MAKE_CRATE_NAME}_v${CARGO_MAKE_CRATE_VERSION}?override=1",
"curl -X POST -u${BINTRAY_OWNER_NAME}:${BINTRAY_API_KEY} https://api.bintray.com/content/${BINTRAY_OWNER_NAME}/${CARGO_MAKE_CRATE_NAME}/${BINTRAY_PACKAGE_NAME}/v${CARGO_MAKE_CRATE_VERSION}/publish"
]
[tasks.github-publish]
description = "Creates a new github release."
install_crate = "cargo-hublish"
command = "cargo"
args = ["hublish"]
[tasks.github-publish-custom-name]
description = "Creates a new github release."
install_crate = "cargo-hublish"
args = ["hublish"]
script = [
"cargo hublish --url \"https://api.github.com/repos/$GITHUB_REPO_NAME/releases\""
]
[tasks.build-publish-flow]
description = "Runs full sanity, generates github release and publishes the crate."
condition = { env_set = [ "COMMIT_MSG", "GITHUB_API_TOKEN", "GITHUB_REPO_NAME" ] }
env = { "CARGO_MAKE_SKIP_PREPUBLISH_CLEAN" = "true" }
run_task = "build-publish-flow-no-validation"
[tasks.build-publish-flow-no-validation]
dependencies = [
"delete-lock",
"build-flow",
"git-add",
"git-status",
"git-commit-message",
"git-push",
"github-publish-custom-name",
"publish-flow",
"upload-artifacts",
"git-pull"
]