Skip to content

Commit 9773c46

Browse files
docs: document full API on docs.rs and guard the build in CI
1 parent 70cb6a6 commit 9773c46

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

.github/workflows/docs.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: docs.rs build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
docs:
7+
name: docs.rs build
8+
runs-on: ubuntu-latest
9+
# Same image docs.rs uses, so missing system libraries surface here first.
10+
container:
11+
image: ghcr.io/rust-lang/crates-build-env/linux:latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Install nightly toolchain
15+
run: |
16+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly --profile minimal
17+
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
18+
- name: Install cargo-docs-rs
19+
run: cargo install --locked cargo-docs-rs
20+
- name: Build docs the way docs.rs does
21+
run: cargo +nightly docs-rs -p libwebauthn

libwebauthn/Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ resolver = "2"
1919
name = "libwebauthn"
2020
path = "src/lib.rs"
2121

22+
# docs.rs builds with default features only, which omits the NFC transport and
23+
# the virtual-device test surface. Document those too. libnfc is not available
24+
# in the docs.rs build environment, so the libnfc backend is left out and NFC is
25+
# documented through the pcsc backend instead.
26+
[package.metadata.docs.rs]
27+
features = ["nfc-backend-pcsc", "virt"]
28+
rustdoc-args = ["--cfg", "docsrs"]
29+
2230
[features]
2331
default = []
2432
nfc = ["apdu-core", "apdu"]

0 commit comments

Comments
 (0)