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
This commit is contained in:
Gustavo Valverde 2023-08-18 03:04:56 +01:00 committed by GitHub
parent 6b7eafd8f1
commit 92dd5285e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 46 deletions

View File

@ -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",

View File

@ -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

View File

@ -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