From 0d36455d74848d657c9872308445bac22fb3f6d7 Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Tue, 8 Mar 2022 15:36:54 +1100 Subject: [PATCH] Build the docs with test.sh We currently build the docs as a separate CI job, we can however just do it as part of the `Tests` job using the nightly toolchain. Conditionally build the docs based on a `DO_DOCS` env var. Note, uses `--cfg docsrs` so can only be built run with nightly toolchain. --- .github/workflows/rust.yml | 15 +-------------- contrib/test.sh | 5 +++++ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 66c1a690..d1e6b0cf 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -24,6 +24,7 @@ jobs: DO_BENCH: true AS_DEPENDENCY: true DO_NO_STD: true + DO_DOCS: true - rust: 1.29.0 env: AS_DEPENDENCY: true @@ -82,20 +83,6 @@ jobs: - name: run cross test run: cross test --target s390x-unknown-linux-gnu - Docs: - name: Docs - runs-on: ubuntu-latest - steps: - - name: Checkout Crate - uses: actions/checkout@v2 - - name: Checkout Toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - name: Create Doc - run: cargo doc Embedded: runs-on: ubuntu-latest steps: diff --git a/contrib/test.sh b/contrib/test.sh index 922e3ea7..41503bc9 100755 --- a/contrib/test.sh +++ b/contrib/test.sh @@ -67,6 +67,11 @@ do cargo test --verbose --features="$feature" done +# Build the docs if told to (this only works with the nightly toolchain) +if [ "$DO_DOCS" = true ]; then + RUSTDOCFLAGS="--cfg docsrs" cargo doc --all --features="$FEATURES" +fi + # Fuzz if told to if [ "$DO_FUZZ" = true ] then