From 21c82f66bf74847e4ab8a73ae42183f34a22c068 Mon Sep 17 00:00:00 2001 From: Jeremy Kaplan Date: Mon, 20 May 2024 16:29:00 -0400 Subject: [PATCH] dev: Use cargo-make for common tasks --- .cargo/config.toml | 2 ++ .gitignore | 1 + Cargo.toml | 4 +++- Makefile.toml | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 Makefile.toml diff --git a/.cargo/config.toml b/.cargo/config.toml index 4b22de7..a2b78dc 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,4 +1,6 @@ [alias] deny = ["bin", "cargo-deny"] +insta = ["bin", "cargo-insta"] +make = ["bin", "cargo-make"] nextest = ["bin", "cargo-nextest"] tarpaulin = ["bin", "cargo-tarpaulin"] diff --git a/.gitignore b/.gitignore index b2ce0de..0a3bce9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /.bin +/coverage /target diff --git a/Cargo.toml b/Cargo.toml index 8f61680..e89071d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,5 +43,7 @@ opt-level = 3 [package.metadata.bin] cargo-deny = { version = "0.14.23" } -cargo-tarpaulin = { version = "0.30.0" } +cargo-insta = { version = "1.39.0" } +cargo-make = { version = '0.37.12' } cargo-nextest = { version = "0.9.70" } +cargo-tarpaulin = { version = "0.30.0" } diff --git a/Makefile.toml b/Makefile.toml new file mode 100644 index 0000000..f6cad09 --- /dev/null +++ b/Makefile.toml @@ -0,0 +1,35 @@ +[config] +default_to_workspace = false +skip_core_tasks = true + +[tasks.test] +description = "Run tests and review snapshots" +command = "cargo" +args = [ + "insta", "test", + "--review", + "--unreferenced=delete", + "--test-runner=nextest", + # Run tests with `gc_tombstone` on so that object IDs don't get reused in + # snapshot test output. + "--features=gc_tombstone", +] + +[tasks.coverage] +description = "Run tests to show a coverage report" +command = "cargo" +args = [ + "tarpaulin", + "--skip-clean", + "--target-dir", "target/coverage", + "--out", "html", + "--output-dir", "coverage", + # Run tests with `gc_tombstone` on so that object IDs don't get reused in + # snapshot test output. + "--features=gc_tombstone", +] + +[tasks.deny] +description = "Run cargo-deny checks" +command = "cargo" +args = ["deny", "check"]