Skip to content

Commit e3a72ed

Browse files
committed
Fix mdBook tests on Windows (rust-lang/rust#99466)
1 parent e7cfa20 commit e3a72ed

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

.github/workflows/ci.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,7 @@ jobs:
263263
os:
264264
- ubuntu
265265
- macOS
266-
# TODO: Re-enable once rust-lang/rust#99466 is fixed:
267-
# https://github.com/rust-lang/rust/issues/99466
268-
#- windows
266+
- windows
269267
toolchain:
270268
- stable
271269
- beta
@@ -277,8 +275,7 @@ jobs:
277275
with:
278276
toolchain: ${{ matrix.toolchain }}
279277
- run: rustup default ${{ matrix.toolchain }}
280-
281-
- run: cargo install mdbook
278+
- uses: peaceiris/actions-mdbook@v1
282279

283280
- run: make test.book
284281

Makefile

+6-1
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,13 @@ test.book:
9393
ifeq ($(clean),yes)
9494
cargo clean
9595
endif
96+
$(eval target := $(strip $(shell cargo -vV | sed -n 's/host: //p')))
9697
cargo build
97-
mdbook test book -L target/debug/deps
98+
mdbook test book -L target/debug/deps $(strip \
99+
$(if $(call eq,$(findstring windows,$(target)),),,\
100+
$(shell cargo metadata -q \
101+
| jq -r '.packages[] | select(.name == "windows_$(word 1,$(subst -, ,$(target)))_$(word 4,$(subst -, ,$(target)))") | .manifest_path' \
102+
| sed -e "s/^/-L '/" -e 's/Cargo.toml/lib/' -e "s/$$/'/" )))
98103

99104

100105
# Run Rust tests of project crates.

book/README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@ The output will be in the `_rendered/` directory.
4545

4646
### Testing
4747

48-
To run the tests validating all code examples in the book, run:
48+
To run the tests validating all code examples in the book, run (from project root dir):
4949
```bash
50-
mdbook test -L ../target/debug/deps
50+
cargo build
51+
mdbook test -L target/debug/deps
5152

52-
# or via shortcut from project root dir:
53+
# or via shortcut:
5354
make test.book
5455
```

0 commit comments

Comments
 (0)