mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
* Add doc-test to test website code snippets Heavily inspired by tokio-rs/website repo. * Fix code snippets to pass doc tests Some code snippets are explicitly ignored and some are not run to avoid having to include dependencies for one liners. * Add website code snippet tests to CI * Fix CI * Remove doc-test from workspace * Exclude doc-test from workspace * Refactor code snippets and tests Code snippets can import types from doc_test crate i.e.: ```rust use doc_test::agents::EventBus; ``` This allows for moving some boilerplate away from the example and still checks that the code compiles correctly. Also some slight changes to some of the examples and the information about `ComponentLink` which is deprecated. * Move doc-test to packages * Rename doc-test crate to website-test The new name makes it more clear the purpose of this crate. * fix ci
106 lines
2.1 KiB
TOML
106 lines
2.1 KiB
TOML
######################
|
|
#
|
|
# public tasks:
|
|
# * pr-flow
|
|
# * lint
|
|
# * tests
|
|
# * benchmarks
|
|
#
|
|
# Run `cargo make --list-all-steps` for more details.
|
|
#
|
|
######################
|
|
[config]
|
|
min_version = "0.32.4"
|
|
default_to_workspace = false
|
|
|
|
[env]
|
|
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
|
|
CARGO_MAKE_CLIPPY_ARGS = "-- --deny=warnings"
|
|
|
|
[config.modify_core_tasks]
|
|
private = true
|
|
namespace = "core"
|
|
|
|
[tasks.pr-flow]
|
|
toolchain = "stable"
|
|
category = "Checks"
|
|
description = "Lint and test"
|
|
run_task = { name = ["lint", "tests"], fork = true }
|
|
|
|
[tasks.lint]
|
|
category = "Checks"
|
|
description = "Check formatting and run Clippy"
|
|
run_task = { name = ["lint-flow"], fork = true }
|
|
|
|
[tasks.tests]
|
|
category = "Testing"
|
|
description = "Run all tests"
|
|
dependencies = ["tests-setup"]
|
|
env = { CARGO_MAKE_WORKSPACE_SKIP_MEMBERS = ["**/examples/*", "**/packages/changelog"] }
|
|
run_task = { name = ["test-flow", "doc-test-flow", "website-test"], fork = true }
|
|
|
|
[tasks.benchmarks]
|
|
category = "Testing"
|
|
description = "Run benchmarks"
|
|
env = { CARGO_MAKE_WORKSPACE_SKIP_MEMBERS = ["**/examples/*"] }
|
|
run_task = { name = "bench-flow", fork = true }
|
|
|
|
[tasks.lint-flow]
|
|
private = true
|
|
workspace = true
|
|
dependencies = ["core::check-format-flow", "core::clippy-flow"]
|
|
|
|
[tasks.tests-setup]
|
|
private = true
|
|
script_runner = "@duckscript"
|
|
script = [
|
|
"""
|
|
test_flags = array --headless --firefox
|
|
yew_test_features = set wasm_test
|
|
|
|
yew_test_flags = array_join ${test_flags} " "
|
|
echo "running tests with flags: ${yew_test_flags} and features: ${yew_test_features}"
|
|
|
|
set_env YEW_TEST_FLAGS ${yew_test_flags}
|
|
set_env YEW_TEST_FEATURES ${yew_test_features}
|
|
""",
|
|
]
|
|
|
|
[tasks.test-flow]
|
|
private = true
|
|
workspace = true
|
|
dependencies = ["test"]
|
|
|
|
[tasks.test]
|
|
private = true
|
|
command = "cargo"
|
|
args = ["test", "--all-targets"]
|
|
|
|
[tasks.doc-test-flow]
|
|
private = true
|
|
workspace = true
|
|
dependencies = ["doc-test"]
|
|
|
|
[tasks.doc-test]
|
|
private = true
|
|
command = "cargo"
|
|
args = ["test", "--doc"]
|
|
|
|
[tasks.website-test]
|
|
script = [
|
|
"""
|
|
cd packages/website-test
|
|
cargo test
|
|
"""
|
|
]
|
|
|
|
[tasks.bench-flow]
|
|
private = true
|
|
workspace = true
|
|
dependencies = ["bench"]
|
|
|
|
[tasks.bench]
|
|
private = true
|
|
command = "cargo"
|
|
args = ["bench"]
|