From 1cca396ebe62d301fa0128ab4541ad51d26f3c49 Mon Sep 17 00:00:00 2001 From: Muhammad Hamza Date: Fri, 18 Mar 2022 19:40:15 +0500 Subject: [PATCH 01/13] wasm doc tests in CI --- .cargo/config | 3 +++ .github/workflows/main-checks.yml | 19 +++++++++++++++---- tools/website-test/Cargo.toml | 2 +- .../advanced-topics/server-side-rendering.md | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.cargo/config b/.cargo/config index bba9c7fbd5b..c730d179d49 100644 --- a/.cargo/config +++ b/.cargo/config @@ -1,2 +1,5 @@ [target.'cfg(target_arch = "wasm32")'] runner = 'wasm-bindgen-test-runner' + +[unstable] +doctest-xcompile = true diff --git a/.github/workflows/main-checks.yml b/.github/workflows/main-checks.yml index db27c709143..b6e975baa88 100644 --- a/.github/workflows/main-checks.yml +++ b/.github/workflows/main-checks.yml @@ -51,14 +51,26 @@ jobs: doc_tests: - name: Documentation Tests runs-on: ubuntu-latest + strategy: + matrix: + include: + - toolchain: stable + target: "x86_64-unknown-linux-gnu" + - toolchain: nightly + target: "x86_64-unknown-linux-gnu" + - toolchain: nightly + target: "wasm32-unknown-unknown" + + name: Documentation Tests on ${{ matrix.toolchain }} with ${{ matrix.target }} + env: + CARGO_BUILD_TARGET: ${{ matrix.target }} steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: - toolchain: stable - target: wasm32-unknown-unknown + toolchain: ${{ matrix.toolchain }} + target: ${{ matrix.target }} override: true profile: minimal @@ -69,7 +81,6 @@ jobs: sudo apt-get install aspell ci/spellcheck.sh list - - name: Run doctest uses: actions-rs/cargo@v1 with: diff --git a/tools/website-test/Cargo.toml b/tools/website-test/Cargo.toml index 43d17d80a25..4684025ad4c 100644 --- a/tools/website-test/Cargo.toml +++ b/tools/website-test/Cargo.toml @@ -18,7 +18,7 @@ wasm-bindgen-futures = "0.4" weblog = "0.3.0" yew = { path = "../../packages/yew/", features = ["ssr"] } yew-router = { path = "../../packages/yew-router/" } -tokio = { version = "1.15.0", features = ["full"] } +#tokio = { version = "1.15.0", features = ["full"] } [dev-dependencies.web-sys] version = "0.3" diff --git a/website/docs/advanced-topics/server-side-rendering.md b/website/docs/advanced-topics/server-side-rendering.md index d69dda3cbdc..436a391b508 100644 --- a/website/docs/advanced-topics/server-side-rendering.md +++ b/website/docs/advanced-topics/server-side-rendering.md @@ -30,7 +30,7 @@ To render Yew components at the server-side, you can create a renderer with `ServerRenderer::::new()` and call `renderer.render().await` to render `` into a `String`. -```rust +```rust ,ignore use yew::prelude::*; use yew::ServerRenderer; From e6e167319c49787fef7709caa81e570b9d3c4ea3 Mon Sep 17 00:00:00 2001 From: Muhammad Hamza Date: Fri, 18 Mar 2022 19:59:29 +0500 Subject: [PATCH 02/13] wasm doc tests in CI: take 2 --- .github/workflows/main-checks.yml | 33 ++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main-checks.yml b/.github/workflows/main-checks.yml index b6e975baa88..11dc22ad518 100644 --- a/.github/workflows/main-checks.yml +++ b/.github/workflows/main-checks.yml @@ -49,10 +49,29 @@ jobs: command: clippy args: --all-targets --release -- -D warnings + spell_tests: + name: Documentation Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: wasm32-unknown-unknown + override: true + profile: minimal + + - uses: Swatinem/rust-cache@v1 + + - name: Check spelling + run: | + sudo apt-get install aspell + ci/spellcheck.sh list doc_tests: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: include: - toolchain: stable @@ -62,7 +81,7 @@ jobs: - toolchain: nightly target: "wasm32-unknown-unknown" - name: Documentation Tests on ${{ matrix.toolchain }} with ${{ matrix.target }} + name: Test doc code snippets on ${{ matrix.toolchain }} with ${{ matrix.target }} env: CARGO_BUILD_TARGET: ${{ matrix.target }} steps: @@ -74,18 +93,12 @@ jobs: override: true profile: minimal - - uses: Swatinem/rust-cache@v1 - - - name: Check spelling - run: | - sudo apt-get install aspell - ci/spellcheck.sh list - - name: Run doctest uses: actions-rs/cargo@v1 + if: ${{ matrix.toolchain == 'x86_64-unknown-linux-gnu' }} with: command: test - args: --doc + args: --doc --workspace --exclude yew --exclude website-test - name: Run website code snippet tests uses: actions-rs/cargo@v1 @@ -99,8 +112,6 @@ jobs: command: test args: --doc --features doc_test --features wasm_test - - integration_tests: name: Integration Tests on ${{ matrix.toolchain }} runs-on: ubuntu-latest From c7cf55d4ed46dba4982f5f57f70fa715bcefa49c Mon Sep 17 00:00:00 2001 From: Muhammad Hamza Date: Fri, 18 Mar 2022 20:04:32 +0500 Subject: [PATCH 03/13] install wasm-bindgen-cli --- .github/workflows/main-checks.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main-checks.yml b/.github/workflows/main-checks.yml index 11dc22ad518..2e25f47eef0 100644 --- a/.github/workflows/main-checks.yml +++ b/.github/workflows/main-checks.yml @@ -50,18 +50,10 @@ jobs: args: --all-targets --release -- -D warnings spell_tests: - name: Documentation Tests + name: Spell Test with aspell runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: wasm32-unknown-unknown - override: true - profile: minimal - - - uses: Swatinem/rust-cache@v1 - name: Check spelling run: | @@ -100,6 +92,14 @@ jobs: command: test args: --doc --workspace --exclude yew --exclude website-test + - name: Install wasm-bindgen-cli + if: ${{ matrix.toolchain == 'wasm32-unknown-unknown' }} + uses: actions-rs/install@v0.1 + with: + crate: wasm-bindgen-cli + version: 0.2.78 # update this when changing wasm-bindgen version in yew + + - name: Run website code snippet tests uses: actions-rs/cargo@v1 with: From fffcd1d37960be7433679b313f670af74c7825b4 Mon Sep 17 00:00:00 2001 From: Muhammad Hamza Date: Fri, 18 Mar 2022 20:06:44 +0500 Subject: [PATCH 04/13] target, not toolchain --- .github/workflows/main-checks.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main-checks.yml b/.github/workflows/main-checks.yml index 2e25f47eef0..66b72aee6e5 100644 --- a/.github/workflows/main-checks.yml +++ b/.github/workflows/main-checks.yml @@ -87,13 +87,13 @@ jobs: - name: Run doctest uses: actions-rs/cargo@v1 - if: ${{ matrix.toolchain == 'x86_64-unknown-linux-gnu' }} + if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} with: command: test args: --doc --workspace --exclude yew --exclude website-test - name: Install wasm-bindgen-cli - if: ${{ matrix.toolchain == 'wasm32-unknown-unknown' }} + if: ${{ matrix.target == 'wasm32-unknown-unknown' }} uses: actions-rs/install@v0.1 with: crate: wasm-bindgen-cli From 0f940ebaffeaf436218e38ad92b93f1c087d162b Mon Sep 17 00:00:00 2001 From: Muhammad Hamza Date: Fri, 18 Mar 2022 20:11:02 +0500 Subject: [PATCH 05/13] install wasm-bindgen-cli --- .github/workflows/main-checks.yml | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main-checks.yml b/.github/workflows/main-checks.yml index 66b72aee6e5..2fe24444cda 100644 --- a/.github/workflows/main-checks.yml +++ b/.github/workflows/main-checks.yml @@ -78,20 +78,17 @@ jobs: CARGO_BUILD_TARGET: ${{ matrix.target }} steps: - uses: actions/checkout@v2 + + - uses: Swatinem/rust-cache@v1 + + # we need this target to install wasm-bindgen-cli - uses: actions-rs/toolchain@v1 + if: ${{ matrix.target == 'wasm32-unknown-unknown' }} with: toolchain: ${{ matrix.toolchain }} - target: ${{ matrix.target }} override: true profile: minimal - - name: Run doctest - uses: actions-rs/cargo@v1 - if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} - with: - command: test - args: --doc --workspace --exclude yew --exclude website-test - - name: Install wasm-bindgen-cli if: ${{ matrix.target == 'wasm32-unknown-unknown' }} uses: actions-rs/install@v0.1 @@ -99,6 +96,19 @@ jobs: crate: wasm-bindgen-cli version: 0.2.78 # update this when changing wasm-bindgen version in yew + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + target: ${{ matrix.target }} + override: true + profile: minimal + + - name: Run doctest + uses: actions-rs/cargo@v1 + if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} + with: + command: test + args: --doc --workspace --exclude yew --exclude website-test - name: Run website code snippet tests uses: actions-rs/cargo@v1 From a81a1f10abe7fb48e934c12ddef6ee8c23ac5bd8 Mon Sep 17 00:00:00 2001 From: Muhammad Hamza Date: Fri, 18 Mar 2022 20:20:00 +0500 Subject: [PATCH 06/13] will this fix? --- .github/workflows/main-checks.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/main-checks.yml b/.github/workflows/main-checks.yml index 2fe24444cda..315410744ca 100644 --- a/.github/workflows/main-checks.yml +++ b/.github/workflows/main-checks.yml @@ -91,10 +91,7 @@ jobs: - name: Install wasm-bindgen-cli if: ${{ matrix.target == 'wasm32-unknown-unknown' }} - uses: actions-rs/install@v0.1 - with: - crate: wasm-bindgen-cli - version: 0.2.78 # update this when changing wasm-bindgen version in yew + run: cargo install wasm-bindgen-cli --vers "0.2.78" - uses: actions-rs/toolchain@v1 with: From e4aa0d42bc57a22f4516b233d1cea0d4f46b3230 Mon Sep 17 00:00:00 2001 From: Muhammad Hamza Date: Fri, 18 Mar 2022 20:22:09 +0500 Subject: [PATCH 07/13] no cache --- .github/workflows/main-checks.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main-checks.yml b/.github/workflows/main-checks.yml index 315410744ca..7b0934356e3 100644 --- a/.github/workflows/main-checks.yml +++ b/.github/workflows/main-checks.yml @@ -79,8 +79,6 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: Swatinem/rust-cache@v1 - # we need this target to install wasm-bindgen-cli - uses: actions-rs/toolchain@v1 if: ${{ matrix.target == 'wasm32-unknown-unknown' }} @@ -100,6 +98,8 @@ jobs: override: true profile: minimal + - uses: Swatinem/rust-cache@v1 + - name: Run doctest uses: actions-rs/cargo@v1 if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} From d87984194d2aa05dba535430ad3fa88121597fe8 Mon Sep 17 00:00:00 2001 From: Muhammad Hamza Date: Fri, 18 Mar 2022 20:24:28 +0500 Subject: [PATCH 08/13] stable? --- .github/workflows/main-checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main-checks.yml b/.github/workflows/main-checks.yml index 7b0934356e3..ff85ebef184 100644 --- a/.github/workflows/main-checks.yml +++ b/.github/workflows/main-checks.yml @@ -83,7 +83,7 @@ jobs: - uses: actions-rs/toolchain@v1 if: ${{ matrix.target == 'wasm32-unknown-unknown' }} with: - toolchain: ${{ matrix.toolchain }} + toolchain: stable override: true profile: minimal From 7c235641845b3fe73368b6d193ea15e031116e07 Mon Sep 17 00:00:00 2001 From: Muhammad Hamza Date: Fri, 18 Mar 2022 20:27:39 +0500 Subject: [PATCH 09/13] don't bother with cargo install --- .github/workflows/main-checks.yml | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main-checks.yml b/.github/workflows/main-checks.yml index ff85ebef184..ac2b7a10506 100644 --- a/.github/workflows/main-checks.yml +++ b/.github/workflows/main-checks.yml @@ -79,18 +79,6 @@ jobs: steps: - uses: actions/checkout@v2 - # we need this target to install wasm-bindgen-cli - - uses: actions-rs/toolchain@v1 - if: ${{ matrix.target == 'wasm32-unknown-unknown' }} - with: - toolchain: stable - override: true - profile: minimal - - - name: Install wasm-bindgen-cli - if: ${{ matrix.target == 'wasm32-unknown-unknown' }} - run: cargo install wasm-bindgen-cli --vers "0.2.78" - - uses: actions-rs/toolchain@v1 with: toolchain: ${{ matrix.toolchain }} @@ -100,6 +88,11 @@ jobs: - uses: Swatinem/rust-cache@v1 + - name: Install wasm-bindgen-cli + run: | + wget -qO- https://github.com/rustwasm/wasm-bindgen/releases/download/0.2.69/wasm-bindgen-0.2.78-x86_64-unknown-linux-musl.tar.gz | tar -xzf- && \ + mv wasm-bindgen-0.2.78-x86_64-unknown-linux-musl/wasm-bindgen ~/.cargo/bin/ + - name: Run doctest uses: actions-rs/cargo@v1 if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} From 32e749bc044be0892458e60a1366415c7332f9f9 Mon Sep 17 00:00:00 2001 From: Muhammad Hamza Date: Fri, 18 Mar 2022 20:29:11 +0500 Subject: [PATCH 10/13] syntax error --- .github/workflows/main-checks.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main-checks.yml b/.github/workflows/main-checks.yml index ac2b7a10506..45f56e2b1a9 100644 --- a/.github/workflows/main-checks.yml +++ b/.github/workflows/main-checks.yml @@ -90,8 +90,8 @@ jobs: - name: Install wasm-bindgen-cli run: | - wget -qO- https://github.com/rustwasm/wasm-bindgen/releases/download/0.2.69/wasm-bindgen-0.2.78-x86_64-unknown-linux-musl.tar.gz | tar -xzf- && \ - mv wasm-bindgen-0.2.78-x86_64-unknown-linux-musl/wasm-bindgen ~/.cargo/bin/ + wget -qO- https://github.com/rustwasm/wasm-bindgen/releases/download/0.2.69/wasm-bindgen-0.2.78-x86_64-unknown-linux-musl.tar.gz | tar -xzf- && \ + mv wasm-bindgen-0.2.78-x86_64-unknown-linux-musl/wasm-bindgen ~/.cargo/bin/ - name: Run doctest uses: actions-rs/cargo@v1 From a27c2ea21da4c543d63c33cb80dfcd0b6eda135d Mon Sep 17 00:00:00 2001 From: Muhammad Hamza Date: Fri, 18 Mar 2022 20:32:40 +0500 Subject: [PATCH 11/13] bruh --- .github/workflows/main-checks.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main-checks.yml b/.github/workflows/main-checks.yml index 45f56e2b1a9..b6a19160cb6 100644 --- a/.github/workflows/main-checks.yml +++ b/.github/workflows/main-checks.yml @@ -90,7 +90,8 @@ jobs: - name: Install wasm-bindgen-cli run: | - wget -qO- https://github.com/rustwasm/wasm-bindgen/releases/download/0.2.69/wasm-bindgen-0.2.78-x86_64-unknown-linux-musl.tar.gz | tar -xzf- && \ + wget https://github.com/rustwasm/wasm-bindgen/releases/download/0.2.78/wasm-bindgen-0.2.78-x86_64-unknown-linux-musl.tar.gz + tar -xzf wasm-bindgen-0.2.78-x86_64-unknown-linux-musl.tar.gz mv wasm-bindgen-0.2.78-x86_64-unknown-linux-musl/wasm-bindgen ~/.cargo/bin/ - name: Run doctest From 60145dc12ac4e79308f12c2b3fc1192cdfe86e41 Mon Sep 17 00:00:00 2001 From: Muhammad Hamza Date: Fri, 18 Mar 2022 20:40:43 +0500 Subject: [PATCH 12/13] geckodriver --- .github/workflows/main-checks.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main-checks.yml b/.github/workflows/main-checks.yml index b6a19160cb6..a1d7239a095 100644 --- a/.github/workflows/main-checks.yml +++ b/.github/workflows/main-checks.yml @@ -79,6 +79,8 @@ jobs: steps: - uses: actions/checkout@v2 + - uses: Swatinem/rust-cache@v1 + - uses: actions-rs/toolchain@v1 with: toolchain: ${{ matrix.toolchain }} @@ -86,14 +88,15 @@ jobs: override: true profile: minimal - - uses: Swatinem/rust-cache@v1 - - name: Install wasm-bindgen-cli run: | wget https://github.com/rustwasm/wasm-bindgen/releases/download/0.2.78/wasm-bindgen-0.2.78-x86_64-unknown-linux-musl.tar.gz tar -xzf wasm-bindgen-0.2.78-x86_64-unknown-linux-musl.tar.gz mv wasm-bindgen-0.2.78-x86_64-unknown-linux-musl/wasm-bindgen ~/.cargo/bin/ + - name: Setup geckodriver + uses: browser-actions/setup-geckodriver@latest + - name: Run doctest uses: actions-rs/cargo@v1 if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} From 8a3c4e3c96c1f6f67041fe2d7ca842829c04e18c Mon Sep 17 00:00:00 2001 From: Muhammad Hamza Date: Fri, 18 Mar 2022 20:56:29 +0500 Subject: [PATCH 13/13] last try i'm out of ideas --- .github/workflows/main-checks.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main-checks.yml b/.github/workflows/main-checks.yml index a1d7239a095..9e412e4f3f8 100644 --- a/.github/workflows/main-checks.yml +++ b/.github/workflows/main-checks.yml @@ -107,6 +107,7 @@ jobs: - name: Run website code snippet tests uses: actions-rs/cargo@v1 with: + toolchain: ${{ matrix.toolchain }} command: test args: -p website-test