Skip to content

Commit f0bbad7

Browse files
authored
Set fail on warning for documentation generation (#1218)
* Set fail on warning for documentation generation * Avoid building the wheel if possible during documentation generation * Revert "Avoid building the wheel if possible during documentation generation" This reverts commit 1a8a7a4. * Move documentation into build workflow so that it is guaranteed to run after wheel build * Remove redundant documentatino build * Move parameters into init method to fix documentation error * Whitespace correction * Documentation test will occur in the build docs section and will fail now that the setting is correct to turn warnings into errors
1 parent 200a249 commit f0bbad7

File tree

5 files changed

+189
-191
lines changed

5 files changed

+189
-191
lines changed

.github/workflows/build.yml

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,100 @@ jobs:
275275
with:
276276
name: dist
277277
pattern: dist-*
278-
278+
279+
# Documentation build job that runs after wheels are built
280+
build-docs:
281+
name: Build docs
282+
runs-on: ubuntu-latest
283+
needs: [build-manylinux-x86_64] # Only need the Linux wheel for docs
284+
# Only run docs on main branch pushes, tags, or PRs
285+
if: github.event_name == 'push' || github.event_name == 'pull_request'
286+
steps:
287+
- name: Set target branch
288+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')
289+
id: target-branch
290+
run: |
291+
set -x
292+
if test '${{ github.ref }}' = 'refs/heads/main'; then
293+
echo "value=asf-staging" >> "$GITHUB_OUTPUT"
294+
elif test '${{ github.ref_type }}' = 'tag'; then
295+
echo "value=asf-site" >> "$GITHUB_OUTPUT"
296+
else
297+
echo "Unsupported input: ${{ github.ref }} / ${{ github.ref_type }}"
298+
exit 1
299+
fi
300+
301+
- name: Checkout docs sources
302+
uses: actions/checkout@v5
303+
304+
- name: Checkout docs target branch
305+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')
306+
uses: actions/checkout@v5
307+
with:
308+
fetch-depth: 0
309+
ref: ${{ steps.target-branch.outputs.value }}
310+
path: docs-target
311+
312+
- name: Setup Python
313+
uses: actions/setup-python@v5
314+
with:
315+
python-version: "3.11"
316+
317+
- name: Install dependencies
318+
uses: astral-sh/setup-uv@v6
319+
with:
320+
enable-cache: true
321+
322+
# Download the Linux wheel built in the previous job
323+
- name: Download pre-built Linux wheel
324+
uses: actions/download-artifact@v5
325+
with:
326+
name: dist-manylinux-x86_64
327+
path: wheels/
328+
329+
# Install from the pre-built wheel
330+
- name: Install from pre-built wheel
331+
run: |
332+
set -x
333+
uv venv
334+
# Install documentation dependencies
335+
uv sync --dev --no-install-package datafusion --group docs
336+
# Install the pre-built wheel
337+
WHEEL=$(find wheels/ -name "*.whl" | head -1)
338+
if [ -n "$WHEEL" ]; then
339+
echo "Installing wheel: $WHEEL"
340+
uv pip install "$WHEEL"
341+
else
342+
echo "ERROR: No wheel found!"
343+
exit 1
344+
fi
345+
346+
- name: Build docs
347+
run: |
348+
set -x
349+
cd docs
350+
curl -O https://gist.githubusercontent.com/ritchie46/cac6b337ea52281aa23c049250a4ff03/raw/89a957ff3919d90e6ef2d34235e6bf22304f3366/pokemon.csv
351+
curl -O https://d37ci6vzurychx.cloudfront.net/trip-data/yellow_tripdata_2021-01.parquet
352+
uv run --no-project make html
353+
354+
- name: Copy & push the generated HTML
355+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')
356+
run: |
357+
set -x
358+
cd docs-target
359+
# delete anything but: 1) '.'; 2) '..'; 3) .git/
360+
find ./ | grep -vE "^./$|^../$|^./.git" | xargs rm -rf
361+
cp ../.asf.yaml .
362+
cp -r ../docs/build/html/* .
363+
git status --porcelain
364+
if [ "$(git status --porcelain)" != "" ]; then
365+
git config user.name "github-actions[bot]"
366+
git config user.email "github-actions[bot]@users.noreply.github.com"
367+
git add --all
368+
git commit -m 'Publish built docs triggered by ${{ github.sha }}'
369+
git push || git push --force
370+
fi
371+
279372
# NOTE: PyPI publish needs to be done manually for now after release passed the vote
280373
# release:
281374
# name: Publish in PyPI

.github/workflows/docs.yaml

Lines changed: 0 additions & 95 deletions
This file was deleted.

.github/workflows/test.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,6 @@ jobs:
8080
with:
8181
enable-cache: true
8282

83-
- name: Check documentation
84-
if: ${{ matrix.python-version == '3.10' && matrix.toolchain == 'stable' }}
85-
run: |
86-
uv sync --dev --group docs --no-install-package datafusion
87-
uv run --no-project maturin develop --uv
88-
uv run --no-project docs/build.sh
89-
9083
- name: Run tests
9184
env:
9285
RUST_BACKTRACE: 1

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ help:
3535
# Catch-all target: route all unknown targets to Sphinx using the new
3636
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
3737
%: Makefile
38-
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
38+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) --fail-on-warning

0 commit comments

Comments
 (0)