Skip to content

Commit 7f11f7c

Browse files
authored
Merge pull request #5 from CSSFrancis/add-interactive-fitting-example
Add interactive fitting example
2 parents 3198c31 + e26f566 commit 7f11f7c

File tree

9 files changed

+1466
-71
lines changed

9 files changed

+1466
-71
lines changed

.github/workflows/docs.yml

Lines changed: 57 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
branches: [main]
77
# … and to a versioned directory on every release tag.
88
tags: ["v*.*.*"]
9+
pull_request:
10+
branches: [main]
911
# Allow manual re-builds from the Actions tab.
1012
workflow_dispatch:
1113

@@ -19,25 +21,27 @@ permissions:
1921
contents: write # needed to push to gh-pages
2022

2123
jobs:
22-
build-and-deploy:
23-
name: Build & deploy docs
24+
# ── Build ──────────────────────────────────────────────────────────────────
25+
# Runs on every push and every pull request. Treats warnings as errors so
26+
# broken cross-references and bad docstrings are caught before merge.
27+
build:
28+
name: Build docs
2429
runs-on: ubuntu-latest
2530

2631
steps:
2732
- name: Checkout repository
2833
uses: actions/checkout@v4
2934
with:
30-
# Full history lets sphinx-gallery / git tools see tags correctly.
3135
fetch-depth: 0
3236

33-
# ── uv + Python ────────────────────────────────────────────────────────
37+
# ── uv + Python ──────────────────────────────────────────────────────
3438
- name: Set up uv
3539
uses: astral-sh/setup-uv@v5
3640
with:
3741
python-version: "3.13"
3842
enable-cache: true
3943

40-
# ── Dependencies ───────────────────────────────────────────────────────
44+
# ── Dependencies ─────────────────────────────────────────────────────
4145
# Install the package itself plus the [docs] optional-dependency group
4246
# (sphinx, pydata-sphinx-theme, sphinx-gallery, pillow, playwright).
4347
- name: Install dependencies (with docs extras)
@@ -49,7 +53,51 @@ jobs:
4953
- name: Install Playwright browser
5054
run: uv run playwright install chromium --with-deps
5155

52-
# ── Determine deployment target ─────────────────────────────────────────
56+
# ── Sphinx build ─────────────────────────────────────────────────────
57+
# -W turns warnings into errors; --keep-going collects all of them.
58+
- name: Build HTML documentation
59+
run: |
60+
uv run sphinx-build -b html docs build/html -W --keep-going
61+
62+
# ── Upload built HTML as an artifact so it can be inspected on PRs ──
63+
- name: Upload HTML artifact
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: docs-html
67+
path: build/html
68+
retention-days: 7
69+
70+
# ── Deploy ─────────────────────────────────────────────────────────────────
71+
# Only runs after a successful build on pushes to main or release tags.
72+
# Pull requests skip this job entirely.
73+
deploy:
74+
name: Deploy docs
75+
needs: build
76+
runs-on: ubuntu-latest
77+
# Skip deployment for pull requests.
78+
if: github.event_name != 'pull_request'
79+
80+
steps:
81+
- name: Checkout repository
82+
uses: actions/checkout@v4
83+
with:
84+
fetch-depth: 0
85+
86+
# ── uv + Python ──────────────────────────────────────────────────────
87+
- name: Set up uv
88+
uses: astral-sh/setup-uv@v5
89+
with:
90+
python-version: "3.13"
91+
enable-cache: true
92+
93+
# ── Dependencies ─────────────────────────────────────────────────────
94+
- name: Install dependencies (with docs extras)
95+
run: uv sync --extra docs
96+
97+
- name: Install Playwright browser
98+
run: uv run playwright install chromium --with-deps
99+
100+
# ── Determine deployment target ──────────────────────────────────────
53101
# Release tag (refs/tags/v1.2.3) → destination = "v1.2.3"
54102
# Everything else (push to main, manual dispatch) → destination = "dev"
55103
- name: Determine deployment directory
@@ -62,31 +110,27 @@ jobs:
62110
echo "dest_dir=dev" >> "$GITHUB_OUTPUT"
63111
fi
64112
65-
# ── Sphinx build ───────────────────────────────────────────────────────
66-
# -W turns warnings into errors so broken cross-references are caught.
67-
# Remove -W if the gallery examples produce unavoidable warnings.
113+
# ── Sphinx build ─────────────────────────────────────────────────────
68114
- name: Build HTML documentation
69115
env:
70116
DOCS_VERSION: ${{ steps.target.outputs.dest_dir }}
71117
run: |
72118
uv run sphinx-build -b html docs build/html -W --keep-going
73119
74-
# ── Deploy to gh-pages ───────────────────────────────────────────────
120+
# ── Deploy to gh-pages ───────────────────────────────────────────────
75121
# keep_files: true preserves all existing directories on the branch so
76122
# versioned releases accumulate rather than overwriting each other.
77-
# Only the target destination_dir is replaced on each run.
78123
- name: Deploy to GitHub Pages
79124
uses: peaceiris/actions-gh-pages@v4
80125
with:
81126
github_token: ${{ secrets.GITHUB_TOKEN }}
82127
publish_dir: ./build/html
83128
destination_dir: ${{ steps.target.outputs.dest_dir }}
84129
keep_files: true
85-
# Commit message makes the deployment easy to identify in the branch log.
86130
commit_message: |
87131
docs: deploy ${{ steps.target.outputs.dest_dir }} @ ${{ github.sha }}
88132
89-
# ── Deploy root files (redirect + switcher) ────────────────────────────
133+
# ── Deploy root files (redirect + switcher) ──────────────────────────
90134
# Places index.html and switcher.json at the root of gh-pages so the
91135
# bare URL redirects to dev/ and the version switcher is always reachable.
92136
- name: Deploy root redirect and switcher

0 commit comments

Comments
 (0)