# https://crates.io/crates/grcov [env] COVERAGE_TARGET_DIRECTORY = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/coverage" COVERAGE_BINARIES = "${COVERAGE_TARGET_DIRECTORY}/debug/deps" COVERAGE_PROF_OUTPUT = "${COVERAGE_TARGET_DIRECTORY}/profraw" [tasks.coverage-grcov-prepare-outdir] private = true script=''' #!/usr/bin/env bash set -eux rm -rf ${COVERAGE_PROF_OUTPUT} mkdir -p ${COVERAGE_PROF_OUTPUT} ''' [tasks.coverage-grcov-run-test] toolchain = "${RUST_VERSION}" command = "cargo" args = ["test", "--locked", "--", "--skip", "osmosis_tests"] [tasks.coverage-grcov-run-test.env] CARGO_BUILD_TARGET_DIR = "${COVERAGE_TARGET_DIRECTORY}" RUSTFLAGS = "-Cinstrument-coverage" LLVM_PROFILE_FILE = "${COVERAGE_PROF_OUTPUT}/coverage-%p-%m.profraw" [tasks.install-grcov] condition = { env_not_set = ["SKIP_INSTALL_GRCOV"] } private = true command = "cargo" args = ["install", "grcov", "--locked"] [tasks.coverage-grcov] condition = { rust_version = { min = "1.60.0" } } private = true script = ''' #!/usr/bin/env bash set -eux grcov ${COVERAGE_PROF_OUTPUT} \ -b ${COVERAGE_BINARIES} -s ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY} \ -t ${GRCOV_OUTPUT_TYPE} --llvm --branch --ignore-not-existing --ignore "tests/osmosis_tests.rs" -o ${GRCOV_OUTPUT_PATH} ''' dependencies = ["install-grcov", "coverage-grcov-prepare-outdir", "coverage-grcov-run-test"] [tasks.coverage-grcov-html] env = { GRCOV_OUTPUT_TYPE = "html", GRCOV_OUTPUT_PATH = "${COVERAGE_TARGET_DIRECTORY}/html", TEST_RUNNER = "multi-test" } run_task = "coverage-grcov" [tasks.coverage-grcov-lcov] env = { GRCOV_OUTPUT_TYPE = "lcov", GRCOV_OUTPUT_PATH = "${COVERAGE_TARGET_DIRECTORY}/lcov.info", TEST_RUNNER = "multi-test" } run_task = "coverage-grcov"