Skip to content

Commit

Permalink
CI: use cargo make to run tests for examples (#904)
Browse files Browse the repository at this point in the history
  • Loading branch information
agilarity authored Apr 21, 2023
1 parent 7a5a776 commit d6f7aed
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 3 deletions.
16 changes: 14 additions & 2 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
RUSTFLAGS = "-D warnings"
60 changes: 60 additions & 0 deletions examples/Makefile.toml
Original file line number Diff line number Diff line change
@@ -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]
2 changes: 1 addition & 1 deletion examples/counter_without_macros/Makefile.toml
Original file line number Diff line number Diff line change
@@ -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"]

Expand Down

0 comments on commit d6f7aed

Please sign in to comment.