Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run doc tests in CI on wasm target #2528

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[target.'cfg(target_arch = "wasm32")']
runner = 'wasm-bindgen-test-runner'

[unstable]
doctest-xcompile = true
42 changes: 32 additions & 10 deletions .github/workflows/main-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,32 +49,56 @@ jobs:
command: clippy
args: --all-targets --release -- -D warnings

spell_tests:
name: Spell Test with aspell
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Check spelling
run: |
sudo apt-get install aspell
ci/spellcheck.sh list

doc_tests:
name: Documentation Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
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: Test doc code snippets 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

- uses: Swatinem/rust-cache@v1

- name: Check spelling
- name: Install wasm-bindgen-cli
run: |
sudo apt-get install aspell
ci/spellcheck.sh list

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' }}
with:
command: test
args: --doc
args: --doc --workspace --exclude yew --exclude website-test

- name: Run website code snippet tests
uses: actions-rs/cargo@v1
Expand All @@ -88,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
Expand Down
2 changes: 1 addition & 1 deletion tools/website-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this commented out? Shouldn't it be used in this example? If its not used maybe just remove the line?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing purposes. I was figuring out why CI is failing.


[dev-dependencies.web-sys]
version = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion website/docs/advanced-topics/server-side-rendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ To render Yew components at the server-side, you can create a renderer
with `ServerRenderer::<App>::new()` and call `renderer.render().await`
to render `<App />` into a `String`.

```rust
```rust ,ignore
use yew::prelude::*;
use yew::ServerRenderer;

Expand Down