Skip to content

Commit 1a8a7a4

Browse files
committed
Avoid building the wheel if possible during documentation generation
1 parent faf447b commit 1a8a7a4

File tree

1 file changed

+73
-14
lines changed

1 file changed

+73
-14
lines changed

.github/workflows/docs.yaml

Lines changed: 73 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,25 @@ on:
77
pull_request:
88
branches:
99
- main
10+
# Run after build workflow completes so we can get the built artifact
11+
workflow_run:
12+
workflows: ["Python Release Build"]
13+
types:
14+
- completed
1015

1116
name: Deploy DataFusion Python site
1217

1318
jobs:
14-
debug-github-context:
19+
debug-github-context:
1520
name: Print github context
1621
runs-on: ubuntu-latest
1722
steps:
18-
- name: Dump GitHub context
19-
env:
20-
GITHUB_CONTEXT: ${{ toJson(github) }}
21-
run: |
22-
echo "$GITHUB_CONTEXT"
23+
- name: Dump GitHub context
24+
env:
25+
GITHUB_CONTEXT: ${{ toJson(github) }}
26+
run: |
27+
echo "$GITHUB_CONTEXT"
28+
2329
build-docs:
2430
name: Build docs
2531
runs-on: ubuntu-latest
@@ -37,33 +43,86 @@ jobs:
3743
echo "Unsupported input: ${{ github.ref }} / ${{ github.ref_type }}"
3844
exit 1
3945
fi
46+
4047
- name: Checkout docs sources
4148
uses: actions/checkout@v5
49+
4250
- name: Checkout docs target branch
4351
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')
4452
uses: actions/checkout@v5
4553
with:
4654
fetch-depth: 0
4755
ref: ${{ steps.target-branch.outputs.value }}
4856
path: docs-target
57+
4958
- name: Setup Python
5059
uses: actions/setup-python@v5
5160
with:
5261
python-version: "3.11"
5362

54-
- name: Install Protoc
55-
uses: arduino/setup-protoc@v3
63+
- name: Install dependencies
64+
uses: astral-sh/setup-uv@v6
5665
with:
57-
version: '27.4'
58-
repo-token: ${{ secrets.GITHUB_TOKEN }}
66+
enable-cache: true
5967

60-
- name: Install dependencies and build
61-
uses: astral-sh/setup-uv@v6
68+
# Try to download pre-built wheel from the build workflow
69+
- name: Download wheel from build workflow
70+
id: download-wheel
71+
continue-on-error: true
72+
uses: actions/download-artifact@v5
6273
with:
63-
enable-cache: true
74+
name: dist
75+
path: wheels/
76+
# For workflow_run events, get artifacts from the triggering workflow
77+
run-id: ${{ github.event.workflow_run.id || github.run_id }}
6478

65-
- name: Build repo
79+
# Check if we have a compatible wheel
80+
- name: Check for compatible wheel
81+
id: check-wheel
6682
run: |
83+
set -x
84+
if [ -d "wheels/" ] && [ "$(ls -A wheels/)" ]; then
85+
echo "Available wheels:"
86+
ls -la wheels/
87+
88+
# Find a compatible wheel for Linux x86_64 (the docs runner)
89+
WHEEL=$(find wheels/ -name "*linux_x86_64*.whl" -o -name "*manylinux*x86_64*.whl" | head -1)
90+
if [ -n "$WHEEL" ]; then
91+
echo "Found compatible wheel: $WHEEL"
92+
echo "wheel-found=true" >> "$GITHUB_OUTPUT"
93+
echo "wheel-path=$WHEEL" >> "$GITHUB_OUTPUT"
94+
else
95+
echo "No compatible wheel found for Linux x86_64"
96+
echo "wheel-found=false" >> "$GITHUB_OUTPUT"
97+
fi
98+
else
99+
echo "No wheels directory or wheels found"
100+
echo "wheel-found=false" >> "$GITHUB_OUTPUT"
101+
fi
102+
103+
# Install from pre-built wheel if available
104+
- name: Install from pre-built wheel
105+
if: steps.check-wheel.outputs.wheel-found == 'true'
106+
run: |
107+
set -x
108+
uv venv
109+
# Install documentation dependencies
110+
uv sync --dev --no-install-package datafusion --group docs
111+
# Install the pre-built wheel
112+
uv pip install "${{ steps.check-wheel.outputs.wheel-path }}"
113+
echo "Installed datafusion from pre-built wheel"
114+
115+
# Fallback: Build from source if no wheel is available
116+
- name: Build from source (fallback)
117+
if: steps.check-wheel.outputs.wheel-found != 'true'
118+
run: |
119+
set -x
120+
echo "No compatible pre-built wheel found, building from source"
121+
122+
# Install Protoc for building from source
123+
sudo apt-get update
124+
sudo apt-get install -y protobuf-compiler
125+
67126
uv venv
68127
uv sync --dev --no-install-package datafusion --group docs
69128
uv run --no-project maturin develop --uv

0 commit comments

Comments
 (0)