Skip to content

Commit

Permalink
[ci] upload to GitHub Pages directly rather than pushing to a branch
Browse files Browse the repository at this point in the history
Jujutsu is quite slow at pulling down large force pushed commits.
  • Loading branch information
sunshowers committed Dec 22, 2024
1 parent 5a5a486 commit 9f684d0
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 12 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
45 changes: 35 additions & 10 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,56 @@ 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:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- 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/[email protected]
- 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-[email protected]
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/[email protected]
13 changes: 13 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 9f684d0

Please sign in to comment.