Skip to content

Commit 568b870

Browse files
Jammy2211claude
authored andcommitted
workspace-validation: add generate_notebooks + run_notebooks (full parity)
Pulse now covers Build's full scripts+notebooks validation signal. generate_notebooks converts each of the 6 doc workspaces' scripts to .ipynb (Build's generate.py); run_notebooks executes them against the libraries' current source main (same source-shadow + nufftax install as run_scripts), gated to skip *_test workspaces (no notebooks). analyze now aggregates both results-scripts-* and results-notebooks-* into report.json. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent bf01852 commit 568b870

1 file changed

Lines changed: 139 additions & 6 deletions

File tree

.github/workflows/workspace-validation.yml

Lines changed: 139 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ name: Workspace Validation
33
# Pulse-owned workspace-integration validation (Stage 4 Phase B).
44
#
55
# This is the "heavy validation CI" that used to live in PyAutoBuild's
6-
# release.yml (find_scripts / run_scripts / analyze_results). Pulse owns it now:
7-
# Build is a pure executor. It runs every workspace's scripts against the CURRENT
8-
# source `main` of the 5 libraries (source-shadowed via PYTHONPATH), aggregates
9-
# into the same report.json contract, and uploads it as the
10-
# `workspace-validation-report` artifact. Pulse's test_run check reads that run's
6+
# release.yml (find_scripts / generate_notebooks / run_scripts / run_notebooks /
7+
# analyze_results). Pulse owns it now: Build is a pure executor. It runs every
8+
# workspace's scripts AND generated notebooks against the CURRENT source `main`
9+
# of the 5 libraries (source-shadowed via PYTHONPATH), aggregates into the same
10+
# report.json contract, and uploads it as the `workspace-validation-report`
11+
# artifact. Pulse's test_run check reads that run's
1112
# conclusion + timestamp into the authoritative `readiness` verdict (with a
1213
# staleness window).
1314
#
@@ -64,6 +65,52 @@ jobs:
6465
howtogalaxy howtolens howtofit)"
6566
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
6667
68+
generate_notebooks:
69+
runs-on: ubuntu-latest
70+
strategy:
71+
fail-fast: false
72+
matrix:
73+
# Notebooks exist only for the 6 doc workspaces (the *_test workspaces
74+
# publish none). generate.py just converts scripts → .ipynb (no lib run).
75+
project:
76+
- { name: autofit, workspace: autofit_workspace }
77+
- { name: autogalaxy, workspace: autogalaxy_workspace }
78+
- { name: autolens, workspace: autolens_workspace }
79+
- { name: howtogalaxy, workspace: HowToGalaxy }
80+
- { name: howtolens, workspace: HowToLens }
81+
- { name: howtofit, workspace: HowToFit }
82+
steps:
83+
- name: Checkout PyAutoBuild (generate.py)
84+
uses: actions/checkout@v4
85+
with:
86+
repository: PyAutoLabs/PyAutoBuild
87+
path: PyAutoBuild
88+
- name: Checkout workspace
89+
uses: actions/checkout@v4
90+
with:
91+
repository: PyAutoLabs/${{ matrix.project.workspace }}
92+
ref: main
93+
path: workspace
94+
- name: Set up Python
95+
uses: actions/setup-python@v5
96+
with:
97+
python-version: "3.12"
98+
cache: pip
99+
- name: Install notebook tooling
100+
run: pip install jupyter ipynb-py-convert PyYAML
101+
- name: Generate notebooks
102+
run: |
103+
export PYTHONPATH="$PYTHONPATH:$(pwd)/PyAutoBuild"
104+
pushd workspace
105+
python3 "$(pwd)/../PyAutoBuild/autobuild/generate.py" "${{ matrix.project.name }}"
106+
- name: Upload generated notebooks
107+
if: always()
108+
uses: actions/upload-artifact@v4
109+
with:
110+
name: notebooks-${{ matrix.project.name }}
111+
path: workspace/notebooks/
112+
retention-days: 7
113+
67114
run_scripts:
68115
runs-on: ubuntu-latest
69116
needs: find_scripts
@@ -138,9 +185,95 @@ jobs:
138185
path: workspace/test-results/
139186
retention-days: 30
140187

188+
run_notebooks:
189+
runs-on: ubuntu-latest
190+
needs: [find_scripts, generate_notebooks]
191+
strategy:
192+
fail-fast: false
193+
matrix:
194+
python-version: ["3.12"]
195+
project: ${{ fromJSON(needs.find_scripts.outputs.matrix) }}
196+
steps:
197+
- name: Gate (*_test workspaces have no notebooks)
198+
id: gate
199+
run: |
200+
if [[ "${{ matrix.project.name }}" == *_test ]]; then
201+
echo "run=false" >> "$GITHUB_OUTPUT"
202+
else
203+
echo "run=true" >> "$GITHUB_OUTPUT"
204+
fi
205+
- name: Checkout PyAutoBuild (run primitives)
206+
if: steps.gate.outputs.run == 'true'
207+
uses: actions/checkout@v4
208+
with:
209+
repository: PyAutoLabs/PyAutoBuild
210+
path: PyAutoBuild
211+
- name: Resolve workspace repo
212+
if: steps.gate.outputs.run == 'true'
213+
id: ws
214+
run: |
215+
case "${{ matrix.project.name }}" in
216+
autofit) echo "repo=autofit_workspace" >> "$GITHUB_OUTPUT" ;;
217+
autogalaxy) echo "repo=autogalaxy_workspace" >> "$GITHUB_OUTPUT" ;;
218+
autolens) echo "repo=autolens_workspace" >> "$GITHUB_OUTPUT" ;;
219+
howtogalaxy) echo "repo=HowToGalaxy" >> "$GITHUB_OUTPUT" ;;
220+
howtolens) echo "repo=HowToLens" >> "$GITHUB_OUTPUT" ;;
221+
howtofit) echo "repo=HowToFit" >> "$GITHUB_OUTPUT" ;;
222+
*) echo "repo=autolens_workspace" >> "$GITHUB_OUTPUT" ;;
223+
esac
224+
- name: Checkout workspace
225+
if: steps.gate.outputs.run == 'true'
226+
uses: actions/checkout@v4
227+
with:
228+
repository: PyAutoLabs/${{ steps.ws.outputs.repo }}
229+
ref: main
230+
path: workspace
231+
- name: Checkout libraries (source-shadowed via PYTHONPATH)
232+
if: steps.gate.outputs.run == 'true'
233+
run: |
234+
set -e
235+
for lib in PyAutoConf PyAutoArray PyAutoFit PyAutoGalaxy PyAutoLens; do
236+
git clone --depth 1 "https://github.com/PyAutoLabs/$lib" "libs/$lib"
237+
done
238+
- name: Download generated notebooks
239+
if: steps.gate.outputs.run == 'true'
240+
uses: actions/download-artifact@v4
241+
with:
242+
name: notebooks-${{ matrix.project.name }}
243+
path: workspace/notebooks/
244+
- name: Set up Python ${{ matrix.python-version }}
245+
if: steps.gate.outputs.run == 'true'
246+
uses: actions/setup-python@v5
247+
with:
248+
python-version: ${{ matrix.python-version }}
249+
cache: pip
250+
- name: Install deps (libs from source) + jupyter
251+
if: steps.gate.outputs.run == 'true'
252+
run: |
253+
pip install "autolens[optional]"
254+
pip install "jax>=0.7,<0.11" "jaxlib>=0.7,<0.11"
255+
pip install "nufftax>=0.4.0,<0.5.0"
256+
pip install jupyter ipynb-py-convert
257+
- name: Run notebooks
258+
if: steps.gate.outputs.run == 'true'
259+
run: |
260+
LIBS="$(pwd)/libs"
261+
export PYTHONPATH="$LIBS/PyAutoConf:$LIBS/PyAutoArray:$LIBS/PyAutoFit:$LIBS/PyAutoGalaxy:$LIBS/PyAutoLens:$(pwd)/PyAutoBuild:$PYTHONPATH"
262+
pushd workspace
263+
python3 "$(pwd)/../PyAutoBuild/autobuild/run.py" \
264+
"${{ matrix.project.name }}" "notebooks/${{ matrix.project.directory }}" \
265+
--report-dir test-results
266+
- name: Upload notebook results
267+
if: always() && steps.gate.outputs.run == 'true'
268+
uses: actions/upload-artifact@v4
269+
with:
270+
name: results-notebooks-${{ matrix.project.name }}-${{ matrix.project.directory }}
271+
path: workspace/test-results/
272+
retention-days: 30
273+
141274
analyze:
142275
runs-on: ubuntu-latest
143-
needs: run_scripts
276+
needs: [run_scripts, run_notebooks]
144277
if: always()
145278
steps:
146279
- name: Checkout PyAutoBuild (aggregate_results)

0 commit comments

Comments
 (0)