From d6f7aedec1eaa367ea29a9dbd14cfae5b6e09e38 Mon Sep 17 00:00:00 2001 From: agilarity Date: Fri, 21 Apr 2023 10:33:12 -0400 Subject: [PATCH] CI: use cargo make to run tests for examples (#904) --- Makefile.toml | 16 ++++- examples/Makefile.toml | 60 +++++++++++++++++++ examples/counter_without_macros/Makefile.toml | 2 +- 3 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 examples/Makefile.toml diff --git a/Makefile.toml b/Makefile.toml index 2f2feb1f7a..c9a3f42589 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -75,8 +75,20 @@ command = "cargo" args = ["+nightly", "test-all-features"] install_crate = "cargo-all-features" +[tasks.test-examples] +description = "Run all unit and web tests for examples" +cwd = "examples" +command = "cargo" +args = ["make", "test-unit-and-web"] + +[tasks.verify-examples] +description = "Run all quality checks and tests for examples" +cwd = "examples" +command = "cargo" +args = ["make", "verify-flow"] + [env] -RUSTFLAGS="" +RUSTFLAGS = "" [env.github-actions] -RUSTFLAGS="-D warnings" \ No newline at end of file +RUSTFLAGS = "-D warnings" diff --git a/examples/Makefile.toml b/examples/Makefile.toml new file mode 100644 index 0000000000..8bcc7ff540 --- /dev/null +++ b/examples/Makefile.toml @@ -0,0 +1,60 @@ +[env] +CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true + +# Emulate workspace +CARGO_MAKE_WORKSPACE_EMULATION = true + +CARGO_MAKE_CRATE_WORKSPACE_MEMBERS = [ + "counter", + "counter_isomorphic", + #"counters", - FIXME: test compile errors + "counters_stable", + "counter_without_macros", + "error_boundary", + "errors_axum", + "fetch", + "hackernews", + "hackernews_axum", + "login_with_token_csr_only", + "parent_child", + "router", + "session_auth_axum", + "ssr_modes", + "ssr_modes_axum", + "tailwind", + "tailwind_csr_trunk", + "todo_app_sqlite", + "todo_app_sqlite_axum", + "todo_app_sqlite_viz", + "todomvc", +] + +[tasks.verify-flow] +description = "Provides pre and post hooks for verify" +dependencies = ["pre-verify-flow", "verify", "post-verify-flow"] + +[tasks.verify] +description = "Run all quality checks and tests" +dependencies = ["check-style", "test-unit-and-web"] + +[tasks.test-unit-and-web] +description = "Run all unit and web tests" +dependencies = ["test-flow", "web-test-flow"] + +[tasks.check-style] +description = "Check for style violations" +dependencies = ["check-format-flow", "clippy-flow"] + +[tasks.pre-verify-flow] + +[tasks.post-verify-flow] + +[tasks.web-test-flow] +description = "Provides pre and post hooks for web-test" +dependencies = ["pre-web-test-flow", "web-test", "post-web-test-flow"] + +[tasks.pre-web-test-flow] + +[tasks.web-test] + +[tasks.post-web-test-flow] diff --git a/examples/counter_without_macros/Makefile.toml b/examples/counter_without_macros/Makefile.toml index e9e43154ef..7d6c671089 100644 --- a/examples/counter_without_macros/Makefile.toml +++ b/examples/counter_without_macros/Makefile.toml @@ -1,7 +1,7 @@ [env] CARGO_MAKE_WASM_TEST_ARGS = "--headless --chrome" -[tasks.post-test] +[tasks.web-test] command = "cargo" args = ["make", "wasm-pack-test"]