From 92dd5285e6837eb4f0cafcc25b7b65dc3fe623ec Mon Sep 17 00:00:00 2001 From: Gustavo Valverde Date: Fri, 18 Aug 2023 03:04:56 +0100 Subject: [PATCH] ref(docs): consolidate docs linting and publishing (#7339) * fix(docs): use specific variables to avoid using an `environment` * fix(docs): build and publish the correct paths * fix(docs): remove all environments * ref(docs): consolidate docs linting and publishing * chore: minimum lint * fix: cross-reference * fix(docs): remove preview URLs from deployments --- .cargo/config.toml | 2 +- .github/workflows/docs.yml | 20 ++++++++++---------- .github/workflows/lint.yml | 35 ----------------------------------- 3 files changed, 11 insertions(+), 46 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 6be194a0..330d8612 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -80,7 +80,7 @@ rustflags = [ [build] rustdocflags = [ # The -A and -W settings must be the same as the `RUSTDOCFLAGS` in: - # https://github.com/ZcashFoundation/zebra/blob/main/.github/workflows/lint.yml#L151 + # https://github.com/ZcashFoundation/zebra/blob/main/.github/workflows/docs.yml#L61 # Links in public docs can point to private items. "-Arustdoc::private_intra_doc_links", diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 789d5e49..9475d40d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -53,6 +53,12 @@ env: RUST_LIB_BACKTRACE: ${{ vars.RUST_LIB_BACKTRACE }} COLORBT_SHOW_HIDDEN: ${{ vars.COLORBT_SHOW_HIDDEN }} FIREBASE_CHANNEL: ${{ github.event_name == 'pull_request' && 'preview' || 'live' }} + # cargo doc doesn't support '-- -D warnings', so we have to add it here + # https://github.com/rust-lang/cargo/issues/8424#issuecomment-774662296 + # + # The -A and -W settings must be the same as the `rustdocflags` in: + # https://github.com/ZcashFoundation/zebra/blob/main/.cargo/config.toml#L87 + RUSTDOCFLAGS: --html-in-header katex-header.html -D warnings -A rustdoc::private_intra_doc_links jobs: build-docs-book: @@ -91,7 +97,8 @@ jobs: workload_identity_provider: '${{ vars.GCP_WIF }}' service_account: '${{ vars.GCP_FIREBASE_SA }}' - # TODO: remove this step after issue https://github.com/FirebaseExtended/action-hosting-deploy/issues/174 is fixed + # TODO: remove this step after issue https://github.com/FirebaseExtended/action-hosting-deploy/issues/174 is fixed + - name: Add $GCP_FIREBASE_SA_PATH to env run: | # shellcheck disable=SC2002 @@ -100,7 +107,6 @@ jobs: - name: Deploy Zebra book to firebase uses: FirebaseExtended/action-hosting-deploy@v0.7.1 with: - repoToken: ${{ secrets.GITHUB_TOKEN }} firebaseServiceAccount: ${{ env.GCP_FIREBASE_SA_PATH }} channelId: ${{ env.FIREBASE_CHANNEL }} projectId: ${{ vars.GCP_FIREBASE_PROJECT }} @@ -138,8 +144,6 @@ jobs: run: | # Exclude zebra-utils, it is not for library or app users cargo doc --no-deps --workspace --all-features --exclude zebra-utils --target-dir "$(pwd)"/target/external - env: - RUSTDOCFLAGS: '--html-in-header katex-header.html' # Setup gcloud CLI - name: Authenticate to Google Cloud @@ -150,7 +154,7 @@ jobs: workload_identity_provider: '${{ vars.GCP_WIF }}' service_account: '${{ vars.GCP_FIREBASE_SA }}' - # TODO: remove this step after issue https://github.com/FirebaseExtended/action-hosting-deploy/issues/174 is fixed + # TODO: remove this step after issue https://github.com/FirebaseExtended/action-hosting-deploy/issues/174 is fixed - name: Add $GCP_FIREBASE_SA_PATH to env run: | # shellcheck disable=SC2002 @@ -159,7 +163,6 @@ jobs: - name: Deploy external docs to firebase uses: FirebaseExtended/action-hosting-deploy@v0.7.1 with: - repoToken: ${{ secrets.GITHUB_TOKEN }} firebaseServiceAccount: ${{ env.GCP_FIREBASE_SA_PATH }} channelId: ${{ env.FIREBASE_CHANNEL }} target: docs-external @@ -196,8 +199,6 @@ jobs: - name: Build internal docs run: | cargo doc --no-deps --workspace --all-features --document-private-items --target-dir "$(pwd)"/target/internal - env: - RUSTDOCFLAGS: '--html-in-header katex-header.html' # Setup gcloud CLI - name: Authenticate to Google Cloud @@ -208,7 +209,7 @@ jobs: workload_identity_provider: '${{ vars.GCP_WIF }}' service_account: '${{ vars.GCP_FIREBASE_SA }}' - # TODO: remove this step after issue https://github.com/FirebaseExtended/action-hosting-deploy/issues/174 is fixed + # TODO: remove this step after issue https://github.com/FirebaseExtended/action-hosting-deploy/issues/174 is fixed - name: Add $GCP_FIREBASE_SA_PATH to env run: | # shellcheck disable=SC2002 @@ -217,7 +218,6 @@ jobs: - name: Deploy internal docs to firebase uses: FirebaseExtended/action-hosting-deploy@v0.7.1 with: - repoToken: ${{ secrets.GITHUB_TOKEN }} firebaseServiceAccount: ${{ env.GCP_FIREBASE_SA_PATH }} channelId: ${{ env.FIREBASE_CHANNEL }} target: docs-internal diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 68fae4c5..5b611283 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -136,41 +136,6 @@ jobs: - run: | cargo fmt --all -- --check - docs: - name: Rust doc - timeout-minutes: 30 - runs-on: ubuntu-latest - needs: changed-files - if: ${{ needs.changed-files.outputs.rust == 'true' }} - # cargo doc doesn't support '-- -D warnings', so we have to add it here - # https://github.com/rust-lang/cargo/issues/8424#issuecomment-774662296 - # - # The -A and -W settings must be the same as the `rustdocflags` in: - # https://github.com/ZcashFoundation/zebra/blob/main/.cargo/config.toml#L87 - env: - RUSTDOCFLAGS: -D warnings -A rustdoc::private_intra_doc_links - - steps: - - uses: actions/checkout@v3.5.3 - with: - persist-credentials: false - - uses: r7kamura/rust-problem-matchers@v1.4.0 - - - name: Install last version of Protoc - uses: arduino/setup-protoc@v2.0.0 - with: - # TODO: increase to latest version after https://github.com/arduino/setup-protoc/issues/33 is fixed - version: '23.x' - repo-token: ${{ secrets.GITHUB_TOKEN }} - - # Setup Rust with stable toolchain and default profile - - name: Setup Rust - run: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=stable --profile=default - - - run: | - cargo doc --no-deps --document-private-items --all-features - actionlint: runs-on: ubuntu-latest continue-on-error: true