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

ci: build doc similar for docs.rs for all packages #3828

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
5 changes: 3 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,10 @@ jobs:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.65
toolchain: nightly
target: x86_64-unknown-linux-gnu
- run: cargo install toml-cli # toml-cli is required to run `make test-build-docs-rs`
# cargo-workspaces and toml-cli are required to run `make test-build-docs-rs`
- run: cargo install cargo-workspaces toml-cli
- name: make test-build-docs-rs
run: make test-build-docs-rs

Expand Down
26 changes: 8 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -441,24 +441,14 @@ build-docs:
$(CARGO_BINARY) doc $(CARGO_TARGET_FLAG) --release $(compiler_features) --document-private-items --no-deps --workspace --exclude wasmer-c-api

test-build-docs-rs:
@manifest_docs_rs_features_path="package.metadata.docs.rs.features"; \
for manifest_path in lib/*/Cargo.toml; do \
if [ "$$manifest_path" != "lib/wasi-web/Cargo.toml" ]; then \
toml get "$$manifest_path" "$$manifest_docs_rs_features_path" >/dev/null 2>&1; \
if [ $$? -ne 0 ]; then \
features=""; \
else \
features=$$(toml get "$$manifest_path" "$$manifest_docs_rs_features_path" | sed 's/\[//; s/\]//; s/"\([^"]*\)"/\1/g'); \
fi; \
printf "*** Building doc for package with manifest $$manifest_path ***\n\n"; \
if [ -z "$$features" ]; then \
$(CARGO_BINARY) doc $(CARGO_TARGET_FLAG) --manifest-path "$$manifest_path" || exit 1; \
else \
printf "Following features are inferred from Cargo.toml: $$features\n\n\n"; \
$(CARGO_BINARY) doc $(CARGO_TARGET_FLAG) --manifest-path "$$manifest_path" --features "$$features" || exit 1; \
fi; \
fi; \
done
cargo workspaces exec bash -c '\
printf "\n*** Building doc for package $$(pwd) ***\n"; \
features=$$(toml get Cargo.toml "package.metadata.docs.rs.features" || echo ""); \
features=$$(echo "$$features" | sed "s/\[//; s/\]//; s/\"\\([^\\\"]*\\)\"/\\1/g"); \
if [ -n "$$features" ]; then echo "Following features are inferred from Cargo.toml: $$features"; else echo "No features for docs.rs are inferred"; fi; \
printf "\n\n\n"; \
$(CARGO_BINARY) doc $(CARGO_TARGET_FLAG) --features "$$features"; \
'

build-docs-capi:
# `wasmer-c-api` lib's name is `wasmer`. To avoid a conflict
Expand Down