Skip to content

Commit

Permalink
Fix CI builds
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarry committed Jan 19, 2020
1 parent c85fd29 commit 8daea7d
Show file tree
Hide file tree
Showing 55 changed files with 71 additions and 41 deletions.
9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ features = [
"WorkerOptions",
]

# Changes here must be reflected in `build.rs`
[target.'cfg(all(target_arch = "wasm32", not(target_os="wasi"), not(cargo_web)))'.dependencies]
wasm-bindgen = "0.2.58"

# Changes here must be reflected in `build.rs`
[target.'cfg(all(target_arch = "wasm32", not(target_os="wasi"), not(cargo_web)))'.dev-dependencies]
wasm-bindgen-test = "0.3.4"
Expand All @@ -104,15 +108,12 @@ ryu = "1.0.2" # 1.0.1 breaks emscripten

[dev-dependencies]
serde_derive = "1"
trybuild = "1.0"
rustversion = "1.0"

[features]
default = ["services", "agent"]
default = []
std_web = ["stdweb"]
web_sys = ["console_error_panic_hook", "gloo", "js-sys", "web-sys", "wasm-bindgen"]
doc_test = []
web_test = []
wasm_test = []
services = []
agent = ["bincode"]
Expand Down
4 changes: 1 addition & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ pub fn main() {

let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default();
let using_wasm_bindgen = target_arch == "wasm32" && !using_cargo_web && !using_wasi;
if using_wasm_bindgen {
println!("cargo:rustc-cfg=feature=\"wasm_bindgen_test\"");
} else if cfg!(all(feature = "web_sys", not(feature = "doc_test"))) {
if !using_wasm_bindgen && cfg!(all(feature = "web_sys", not(feature = "doc_test"))) {
let target = env::var("TARGET").unwrap_or_default();
panic!(
"Selected target `{}` is not compatible with web-sys",
Expand Down
3 changes: 2 additions & 1 deletion ci/run_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ fi

set -euxo pipefail
cargo fmt --all -- --check
cargo clippy -- --deny=warnings
cargo clippy --features std_web -- --deny=warnings
cargo clippy --target wasm32-unknown-unknown --features web_sys -- --deny=warnings
18 changes: 11 additions & 7 deletions ci/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ set -euxo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_

if [ "$emscripten_supported" == "0" ]; then
# TODO - Emscripten builds are broken on rustc > 1.39.0
cargo web test --features web_test --target asmjs-unknown-emscripten
cargo web test --features web_test --target wasm32-unknown-emscripten
cargo web test --target asmjs-unknown-emscripten --features std_web
cargo web test --target wasm32-unknown-emscripten --features std_web
fi

cargo test --features wasm_test --target wasm32-unknown-unknown
cargo test --test macro_test
cargo test --test derive_props_test
cargo test --doc --all-features
(cd crates/macro && cargo test --doc)
cargo test --target wasm32-unknown-unknown --features wasm_test,std_web
cargo test --target wasm32-unknown-unknown --features wasm_test,web_sys
cargo test --doc --features doc_test,wasm_test,yaml,msgpack,cbor,std_web
cargo test --doc --features doc_test,wasm_test,yaml,msgpack,cbor,web_sys

(cd crates/macro \
&& cargo test --test macro_test \
&& cargo test --test derive_props_test \
&& cargo test --doc)
5 changes: 4 additions & 1 deletion crates/macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ proc-macro2 = "1.0"
quote = "1.0"
syn = { version = "1.0", features = ["full", "extra-traits"] }

# testing
[dev-dependencies]
yew = { path = "../.." }
rustversion = "1.0"
trybuild = "1.0"
yew = { path = "../..", features = ["std_web"] }

[build-dependencies]
autocfg = "1.0.0"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[allow(dead_code)]
#[rustversion::attr(stable(1.40.0), cfg_attr(not(feature = "web_test"), test))]
#[rustversion::attr(stable(1.40.0), test)]
fn tests() {
let t = trybuild::TestCases::new();
t.pass("tests/derive_props/pass.rs");
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ error[E0599]: no method named `string` found for type `ChildPropertiesBuilder<Ch
...
72 | html! { <Child string="abc" /> };
| ^^^^^^ method not found in `ChildPropertiesBuilder<ChildPropertiesBuilderStep_missing_required_prop_int>`
|
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `string`, perhaps you need to implement it:
candidate #1: `proc_macro::bridge::server::Literal`

error[E0599]: no method named `children` found for type `ChildPropertiesBuilder<ChildPropertiesBuilderStep_missing_required_prop_int>` in the current scope
--> $DIR/html-component-fail.rs:76:5
Expand All @@ -209,6 +213,9 @@ error[E0599]: no method named `build` found for type `ChildContainerPropertiesBu
78 | html! { <ChildContainer /> };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ method not found in `ChildContainerPropertiesBuilder<ChildContainerPropertiesBuilderStep_missing_required_prop_children>`
|
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `build`, perhaps you need to implement it:
candidate #1: `proc_macro::bridge::server::TokenStreamBuilder`
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error[E0599]: no method named `build` found for type `ChildContainerPropertiesBuilder<ChildContainerPropertiesBuilderStep_missing_required_prop_children>` in the current scope
Expand All @@ -220,6 +227,9 @@ error[E0599]: no method named `build` found for type `ChildContainerPropertiesBu
79 | html! { <ChildContainer></ChildContainer> };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ method not found in `ChildContainerPropertiesBuilder<ChildContainerPropertiesBuilderStep_missing_required_prop_children>`
|
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `build`, perhaps you need to implement it:
candidate #1: `proc_macro::bridge::server::TokenStreamBuilder`
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error[E0277]: the trait bound `yew::virtual_dom::vcomp::VChild<Child>: std::convert::From<&str>` is not satisfied
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/macro_test.rs → crates/macro/tests/macro_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[allow(dead_code)]
#[rustversion::attr(stable(1.40.0), cfg_attr(not(feature = "web_test"), test))]
#[rustversion::attr(stable(1.40.0), test)]
fn tests() {
let t = trybuild::TestCases::new();

Expand Down
2 changes: 1 addition & 1 deletion examples/counter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ edition = "2018"

[dependencies]
stdweb = "0.4.20"
yew = { path = "../.." }
yew = { path = "../..", features = ["std_web", "services"] }
2 changes: 1 addition & 1 deletion examples/crm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ edition = "2018"
[dependencies]
serde = "1"
serde_derive = "1"
yew = { path = "../.." }
yew = { path = "../..", features = ["std_web", "services"] }
pulldown-cmark = "0.1.2"
2 changes: 1 addition & 1 deletion examples/custom_components/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ authors = ["Denis Kolodin <deniskolodin@gmail.com>"]
edition = "2018"

[dependencies]
yew = { path = "../.." }
yew = { path = "../..", features = ["std_web"] }
2 changes: 1 addition & 1 deletion examples/dashboard/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ edition = "2018"
anyhow = "1"
serde = "1"
serde_derive = "1"
yew = { path = "../..", features = ["toml"] }
yew = { path = "../..", features = ["std_web", "services", "toml"] }
2 changes: 1 addition & 1 deletion examples/file_upload/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ authors = ["Denis Kolodin <deniskolodin@gmail.com>"]
edition = "2018"

[dependencies]
yew = { path = "../.." }
yew = { path = "../..", features = ["std_web", "services"] }
2 changes: 1 addition & 1 deletion examples/fragments/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ authors = ["Denis Kolodin <deniskolodin@gmail.com>"]
edition = "2018"

[dependencies]
yew = { path = "../.." }
yew = { path = "../..", features = ["std_web"] }
2 changes: 1 addition & 1 deletion examples/futures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repository = "https://github.com/yewstack/yew"
crate-type = ["cdylib", "rlib"]

[dependencies]
yew = { path = "../.." }
yew = { path = "../..", features = ["std_web"] }
wasm-bindgen-futures = "0.4.3"

[dependencies.web-sys]
Expand Down
2 changes: 1 addition & 1 deletion examples/game_of_life/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ edition = "2018"
rand = { version = "0.6.5", features = ["stdweb"] }
log = "0.4"
web_logger = "0.1"
yew = { path = "../.." }
yew = { path = "../..", features = ["std_web", "services"] }
2 changes: 1 addition & 1 deletion examples/inner_html/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ edition = "2018"

[dependencies]
stdweb = "0.4.20"
yew = { path = "../.." }
yew = { path = "../..", features = ["std_web"] }
2 changes: 1 addition & 1 deletion examples/js_callback/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Scott Steele <scottlsteele@gmail.com>"]
edition = "2018"

[dependencies]
yew = { path = "../.." }
yew = { path = "../..", features = ["std_web"] }
stdweb = "^0.4.20"

[target.'cfg(all(target_arch = "wasm32", not(cargo_web)))'.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion examples/large_table/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ authors = ["qthree <qthree3@gmail.com>"]
edition = "2018"

[dependencies]
yew = { path = "../.." }
yew = { path = "../..", features = ["std_web"] }
2 changes: 1 addition & 1 deletion examples/minimal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ authors = ["Denis Kolodin <deniskolodin@gmail.com>"]
edition = "2018"

[dependencies]
yew = { path = "../.." }
yew = { path = "../..", features = ["std_web"] }
2 changes: 1 addition & 1 deletion examples/mount_point/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ edition = "2018"

[dependencies]
stdweb = "0.4.20"
yew = { path = "../.." }
yew = { path = "../..", features = ["std_web"] }
2 changes: 1 addition & 1 deletion examples/multi_thread/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ log = "0.4"
web_logger = "0.1"
serde = "1.0"
serde_derive = "1.0"
yew = { path = "../.." }
yew = { path = "../..", features = ["std_web", "services"] }
2 changes: 1 addition & 1 deletion examples/nested_list/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ edition = "2018"
[dependencies]
log = "0.4"
web_logger = "0.2"
yew = { path = "../.." }
yew = { path = "../..", features = ["std_web"] }
2 changes: 1 addition & 1 deletion examples/node_refs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ authors = ["Justin Starry <justin.starry@icloud.com>"]
edition = "2018"

[dependencies]
yew = { path = "../.." }
yew = { path = "../..", features = ["std_web"] }
stdweb = "0.4.20"
2 changes: 1 addition & 1 deletion examples/npm_and_rest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ anyhow = "1"
serde = "1"
serde_derive = "1"
stdweb = "0.4.20"
yew = { path = "../.." }
yew = { path = "../..", features = ["std_web", "services"] }
2 changes: 2 additions & 0 deletions examples/showcase/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ web_logger = "0.1"
strum = "0.13"
strum_macros = "0.13"
yew = { path = "../.." }

# examples
counter = { path = "../counter" }
crm = { path = "../crm" }
custom_components = { path = "../custom_components" }
Expand Down
2 changes: 1 addition & 1 deletion examples/textarea/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ authors = ["Andrew Straw <strawman@astraw.com>"]
edition = "2018"

[dependencies]
yew = { path = "../.." }
yew = { path = "../..", features = ["std_web"] }
2 changes: 1 addition & 1 deletion examples/timer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ authors = ["Denis Kolodin <deniskolodin@gmail.com>"]
edition = "2018"

[dependencies]
yew = { path = "../.." }
yew = { path = "../..", features = ["std_web", "services"] }
2 changes: 1 addition & 1 deletion examples/todomvc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ strum = "0.13"
strum_macros = "0.13"
serde = "1"
serde_derive = "1"
yew = { path = "../.." }
yew = { path = "../..", features = ["std_web", "services"] }
2 changes: 1 addition & 1 deletion examples/two_apps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ edition = "2018"

[dependencies]
stdweb = "0.4.20"
yew = { path = "../.." }
yew = { path = "../..", features = ["std_web"] }
1 change: 1 addition & 0 deletions src/format/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ macro_rules! binary_format {
};
}

#[cfg(any(feature = "bincode", feature = "cbor", feature = "msgpack"))]
macro_rules! text_format_is_an_error {
($type:ident) => {
use $crate::format::FormatError;
Expand Down
14 changes: 12 additions & 2 deletions tests/vtag_test.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#![recursion_limit = "128"]

#[cfg(feature = "std_web")]
use stdweb::web::{document, IElement};
#[cfg(feature = "wasm_test")]
use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure};
Expand Down Expand Up @@ -270,8 +272,16 @@ fn assert_namespace(vtag: &VTag, namespace: &'static str) {

#[test]
fn supports_svg() {
let div_el = document().create_element("div").unwrap();
let svg_el = document().create_element_ns(SVG_NAMESPACE, "svg").unwrap();
#[cfg(feature = "std_web")]
let document = document();
#[cfg(feature = "web_sys")]
let document = web_sys::window().unwrap().document().unwrap();

let div_el = document.create_element("div").unwrap();
let namespace = SVG_NAMESPACE;
#[cfg(feature = "web_sys")]
let namespace = Some(namespace);
let svg_el = document.create_element_ns(namespace, "svg").unwrap();

let mut g_node = html! { <g></g> };
let path_node = html! { <path></path> };
Expand Down

0 comments on commit 8daea7d

Please sign in to comment.