From 9f684d01eab951157feb24fdf96416a8c2b9ee36 Mon Sep 17 00:00:00 2001 From: Rain Date: Sun, 22 Dec 2024 07:48:32 +0000 Subject: [PATCH] [ci] upload to GitHub Pages directly rather than pushing to a branch Jujutsu is quite slow at pulling down large force pushed commits. --- .github/workflows/ci.yml | 2 -- .github/workflows/docs.yml | 45 +++++++++++++++++++++++++++++--------- Justfile | 13 +++++++++++ 3 files changed, 48 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bfb15f71bf4..5ffd91a9ce1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,8 +24,6 @@ jobs: uses: taiki-e/install-action@just - name: Lint (clippy) run: just bootstrap clippy - env: - RUSTC_BOOTSTRAP: 1 - name: Install cargo-hack uses: taiki-e/install-action@cargo-hack - name: Lint (rustfmt) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 1164fb44ded..c82c4b06317 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -2,12 +2,25 @@ on: push: branches: - main + workflow_dispatch: name: Docs +# Sets permissions to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + jobs: - docs: - name: Build and deploy documentation + build-docs: + name: Build documentation concurrency: ci-${{ github.ref }} runs-on: ubuntu-latest steps: @@ -15,18 +28,30 @@ jobs: - uses: dtolnay/rust-toolchain@nightly # Note: caching doesn't appear to work for rustdoc as of 2022-12-04, and we're exceeding cache # sizes anyway + + - uses: taiki-e/install-action@just + - name: Setup Pages + id: pages + uses: actions/configure-pages@v5.0.0 - name: Build rustdoc - # cargo-compare currently pulls in cargo which bloats build times massively - run: | - RUSTDOCFLAGS='--cfg=doc_cfg' cargo doc --all-features --workspace --exclude cargo-compare + run: just rustdoc - name: Organize run: | rm -rf target/gh-pages mkdir target/gh-pages mv target/doc target/gh-pages/rustdoc - - name: Deploy - uses: JamesIves/github-pages-deploy-action@releases/v4 + - name: Upload to GitHub Pages + uses: actions/upload-pages-artifact@v3.0.1 with: - branch: gh-pages - folder: target/gh-pages - single-commit: true + path: target/gh-pages + + deploy-docs: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4.0.5 diff --git a/Justfile b/Justfile index 546c3ff81df..8357e05fea5 100644 --- a/Justfile +++ b/Justfile @@ -11,3 +11,16 @@ nightly arg1 *args: # Run with nightly features enabled: `just bootstrap check`, `just bootstrap +beta clippy` bootstrap arg1 *args: RUSTC_BOOTSTRAP=1 cargo {{arg1}} {{args}} --all-features --all-targets --config .cargo/nightly-config.toml + +# Build docs for crates and direct dependencies +rustdoc: + @# Ignore clap since we currently depend on both clap 2, 3, and 4 -- we + @# should really fix this at some point. + @ + @# Also, cargo-compare currently pulls in cargo which bloats build times massively. + @RUSTC_BOOTSTRAP=1 RUSTDOCFLAGS='--cfg=doc_cfg' \ + cargo tree --depth 1 -e normal --prefix none \ + | grep -v '^clap v[23].' \ + | gawk '{ gsub(" v", "@", $0); printf("%s\n", $1); }' \ + | xargs printf -- '-p %s\n' \ + | xargs cargo doc --no-deps --lib --all-features --workspace --exclude cargo-compare