Improve HF instructions #40
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docs preview | |
| # Two fixed previews for reviewing the public-website work, kept under | |
| # `gh-pages:pr-preview/`. Replaces the old per-PR `pr-preview/pr-<N>/` previews, | |
| # which accumulated one directory per PR and ate gh-pages space: | |
| # - before the WIP integration branch `dev/aidanf/flashdreams-site` as-is. | |
| # - after that branch with every `dev/aidanf/flashdreams_site/*` topic | |
| # branch merged in (the consolidated site). | |
| # Neither publishes production docs — `doc.yml` owns that. | |
| # | |
| # Triggers (no noise, no double-fire): | |
| # - pull_request to `dev/aidanf/flashdreams-site` → a topic-branch PR updated | |
| # the merge set → rebuild `after`. | |
| # - push to `dev/aidanf/flashdreams-site` → the integration line itself moved | |
| # (direct push or a topic PR landing) → rebuild `before` and `after`. | |
| # - workflow_dispatch → rebuild both on demand. | |
| # A topic branch with no open PR matches neither trigger, so nothing runs. | |
| on: | |
| pull_request: | |
| branches: [dev/aidanf/flashdreams-site] | |
| push: | |
| branches: [dev/aidanf/flashdreams-site] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| # "before": the integration branch exactly as it is. Only rebuilt when `-site` | |
| # itself moves (push) or on manual dispatch — a topic-branch PR doesn't change | |
| # `-site`, so it leaves this preview alone. | |
| before: | |
| if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| # Shared with `after` so the two never push to gh-pages at the same instant. | |
| concurrency: | |
| group: docs-site-preview | |
| cancel-in-progress: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: dev/aidanf/flashdreams-site | |
| submodules: recursive | |
| - uses: astral-sh/setup-uv@v4 | |
| # The doc build only needs `flashdreams` importable; the heavy GPU stack is | |
| # mocked via `autodoc_mock_imports` in `docs/source/conf.py`, so install | |
| # only the Sphinx toolchain + a minimal CPU-only dep set. | |
| - name: Install dependencies | |
| env: | |
| UV_EXTRA_INDEX_URL: https://download.pytorch.org/whl/cpu | |
| UV_INDEX_STRATEGY: unsafe-best-match | |
| run: | | |
| uv sync --only-group docs --only-group docs-ci --python 3.12 | |
| uv pip install --no-deps ./flashdreams | |
| # --no-project: the banner override writes a non-PEP-440 version string, so | |
| # uv must not try to parse the workspace pyproject.toml. | |
| - name: Sphinx build | |
| run: | | |
| sed -i 's/^__version__ = ".*"/__version__ = "site-before"/' flashdreams/flashdreams/_version.py | |
| # `-d` keeps Sphinx's doctree cache out of `_build/` so it isn't | |
| # deployed (it's ~half the output size and never served). | |
| uv run --no-project sphinx-build -W -d /tmp/doctrees-before -b html docs/source _build | |
| # `keep_files: false` is scoped to destination_dir, so this only ever | |
| # rewrites `pr-preview/before/` — never `after/`, `main/`, or `versions/`. | |
| - name: Deploy "before" preview | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: _build | |
| destination_dir: pr-preview/before | |
| keep_files: false | |
| # "after": every `dev/aidanf/flashdreams_site/*` topic branch merged on top of | |
| # `-site`. Conflicting branches are skipped (not fatal) and reported in the job | |
| # summary, which also lists both preview URLs. | |
| after: | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: docs-site-preview | |
| cancel-in-progress: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: dev/aidanf/flashdreams-site | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - name: Merge all flashdreams_site/* topic branches | |
| run: | | |
| set -euo pipefail | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git config user.name "github-actions[bot]" | |
| # Refresh the topic-branch remote refs (checkout fetched only -site). | |
| git fetch origin --no-tags \ | |
| "+refs/heads/dev/aidanf/flashdreams_site/*:refs/remotes/origin/dev/aidanf/flashdreams_site/*" | |
| merged=() | |
| skipped=() | |
| for ref in $(git for-each-ref --format='%(refname)' \ | |
| 'refs/remotes/origin/dev/aidanf/flashdreams_site/*'); do | |
| branch=${ref#refs/remotes/} | |
| if git merge --no-edit "$ref"; then | |
| merged+=("$branch") | |
| else | |
| git merge --abort | |
| skipped+=("$branch") | |
| fi | |
| done | |
| # Render a markdown bullet list, or "_(none)_" for an empty set. Kept | |
| # as a function so empty arrays don't trip `set -e` (a bare | |
| # `[ -n "$b" ] && echo` returns nonzero on the empty-string case). | |
| render_list() { | |
| if [ "$#" -eq 0 ]; then | |
| echo "- _(none)_" | |
| else | |
| for b in "$@"; do echo "- \`$b\`"; done | |
| fi | |
| } | |
| { | |
| echo "## Site preview" | |
| echo "" | |
| echo "- **before** — \`dev/aidanf/flashdreams-site\` as-is: \`pr-preview/before/\`" | |
| echo "- **after** — with topic branches merged: \`pr-preview/after/\`" | |
| echo "" | |
| echo "### Merged into \"after\" (${#merged[@]})" | |
| render_list "${merged[@]}" | |
| echo "" | |
| echo "### Skipped — merge conflict (${#skipped[@]})" | |
| render_list "${skipped[@]}" | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| - uses: astral-sh/setup-uv@v4 | |
| # Mirrors the `before` job's minimal CPU-only install. | |
| - name: Install dependencies | |
| env: | |
| UV_EXTRA_INDEX_URL: https://download.pytorch.org/whl/cpu | |
| UV_INDEX_STRATEGY: unsafe-best-match | |
| run: | | |
| uv sync --only-group docs --only-group docs-ci --python 3.12 | |
| uv pip install --no-deps ./flashdreams | |
| - name: Sphinx build | |
| run: | | |
| sed -i 's/^__version__ = ".*"/__version__ = "site-after"/' flashdreams/flashdreams/_version.py | |
| # `-d` keeps Sphinx's doctree cache out of `_build/` so it isn't | |
| # deployed (it's ~half the output size and never served). | |
| uv run --no-project sphinx-build -W -d /tmp/doctrees-after -b html docs/source _build | |
| - name: Deploy "after" preview | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: _build | |
| destination_dir: pr-preview/after | |
| keep_files: false |