diff --git a/ci/check_examples.sh b/ci/check_examples.sh index 686788cdc3f..ece4bfef172 100755 --- a/ci/check_examples.sh +++ b/ci/check_examples.sh @@ -3,19 +3,36 @@ echo "$(rustup default)" | grep -q "1.39.0" emscripten_supported=$? set -euxo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/ -# Showcase includes all other examples -cd examples/showcase +# Some examples are known not to work with some builds, i.e. futures with the +# std_web feature. Other items in the examples/ directory are helpers, i.e. +# pub_sub and server. These block lists allow us to exempt some examples but +# default opt-in any new examples to CI testing. +COMMON_SKIP_EXAMPLES="examples/static examples/pub_sub examples/server \ + examples/target examples/web_sys examples/std_web" +STD_WEB_SKIP_EXAMPLES="${COMMON_SKIP_EXAMPLES:?} examples/futures" +WEB_SYS_SKIP_EXAMPLES="${COMMON_SKIP_EXAMPLES:?}" -# TODO Can't build some demos with release, need fix +# Make sure all examples are buildable with stdweb and web-sys. +for ex in $(find examples -maxdepth 1 -mindepth 1 -type d); do + pushd $ex -if [ "$emscripten_supported" == "0" ]; then - # TODO - Emscripten builds are broken on rustc > 1.39.0 - cargo web build --target asmjs-unknown-emscripten --features std_web - cargo web build --target wasm32-unknown-emscripten --features std_web -fi + # TODO Can't build some demos with release, need fix -cargo web build --target wasm32-unknown-unknown --features std_web -cargo build --target wasm32-unknown-unknown --features web_sys + if [ "$emscripten_supported" == "0" ]; then + if [[ ! " ${STD_WEB_SKIP_EXAMPLES[@]} " =~ " ${ex} " ]]; then + # TODO - Emscripten builds are broken on rustc > 1.39.0 + cargo web build --target asmjs-unknown-emscripten --features std_web + cargo web build --target wasm32-unknown-emscripten --features std_web + fi + fi -# Reset cwd -cd ../.. + if [[ ! " ${STD_WEB_SKIP_EXAMPLES[@]} " =~ " ${ex} " ]]; then + cargo web build --target wasm32-unknown-unknown --features std_web + fi + if [[ ! " ${WEB_SYS_SKIP_EXAMPLES[@]} " =~ " ${ex} " ]]; then + cargo build --target wasm32-unknown-unknown --features web_sys + fi + + # Reset cwd + popd +done diff --git a/examples/futures/src/lib.rs b/examples/futures/src/lib.rs index a7d25723703..fd769305d2a 100644 --- a/examples/futures/src/lib.rs +++ b/examples/futures/src/lib.rs @@ -101,6 +101,10 @@ impl Component for Model { } } + fn change(&mut self, _: Self::Properties) -> bool { + false + } + fn update(&mut self, msg: Self::Message) -> ShouldRender { match msg { Msg::SetMarkdownFetchState(fetch_state) => { diff --git a/examples/minimal/src/lib.rs b/examples/minimal/src/lib.rs index 535fa75cf52..808df8ded4d 100644 --- a/examples/minimal/src/lib.rs +++ b/examples/minimal/src/lib.rs @@ -16,6 +16,10 @@ impl Component for Model { Model { link } } + fn change(&mut self, _: Self::Properties) -> bool { + false + } + fn update(&mut self, msg: Self::Message) -> ShouldRender { match msg { Msg::Click => {} diff --git a/examples/nested_list/src/app.rs b/examples/nested_list/src/app.rs index 8e1d022a39c..3bb40b32cfe 100644 --- a/examples/nested_list/src/app.rs +++ b/examples/nested_list/src/app.rs @@ -24,6 +24,10 @@ impl Component for App { } } + fn change(&mut self, _: Self::Properties) -> bool { + false + } + fn update(&mut self, msg: Self::Message) -> ShouldRender { match msg { Msg::Hover(hovered) => self.hovered = hovered, diff --git a/examples/nested_list/src/header.rs b/examples/nested_list/src/header.rs index 392cbb1be59..540488af8ec 100644 --- a/examples/nested_list/src/header.rs +++ b/examples/nested_list/src/header.rs @@ -21,6 +21,10 @@ impl Component for ListHeader { ListHeader { props } } + fn change(&mut self, _: Self::Properties) -> bool { + false + } + fn update(&mut self, _: Self::Message) -> ShouldRender { false } diff --git a/examples/nested_list/src/item.rs b/examples/nested_list/src/item.rs index 7ee0d2864f7..4830f52eb09 100644 --- a/examples/nested_list/src/item.rs +++ b/examples/nested_list/src/item.rs @@ -24,6 +24,10 @@ impl Component for ListItem { ListItem { props } } + fn change(&mut self, _: Self::Properties) -> bool { + false + } + fn update(&mut self, _msg: Self::Message) -> ShouldRender { false } diff --git a/examples/nested_list/src/list.rs b/examples/nested_list/src/list.rs index daa8e5f4511..57730c6fb49 100644 --- a/examples/nested_list/src/list.rs +++ b/examples/nested_list/src/list.rs @@ -56,6 +56,10 @@ impl Component for List { } } + fn change(&mut self, _: Self::Properties) -> bool { + false + } + fn update(&mut self, msg: Self::Message) -> ShouldRender { match msg { Msg::HeaderClick => { @@ -122,8 +126,10 @@ where impl Into for ListVariant { fn into(self) -> VNode { match self.props { - Variants::Header(props) => VComp::new::(props, NodeRef::default()).into(), - Variants::Item(props) => VComp::new::(props, NodeRef::default()).into(), + Variants::Header(props) => { + VComp::new::(props, NodeRef::default(), None).into() + } + Variants::Item(props) => VComp::new::(props, NodeRef::default(), None).into(), } } }