-
Notifications
You must be signed in to change notification settings - Fork 1
770 lines (756 loc) · 30.7 KB
/
Copy pathrelease.yml
File metadata and controls
770 lines (756 loc) · 30.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
name: PyAuto Release
on:
schedule:
- cron: '0 2 * * 1-5' # 2 AM UTC weekdays
workflow_dispatch:
inputs:
minor_version:
description: 'Minor version to release'
required: true
default: '1'
skip_scripts:
description: 'Skip scripts'
required: false
default: 'false'
skip_notebooks:
description: 'Skip notebooks'
required: false
default: 'false'
skip_release:
description: 'Skip release'
required: false
default: 'false'
update_notebook_visualisations:
description: 'Update notebook visualisations'
required: false
default: 'false'
jobs:
version_number:
runs-on: ubuntu-latest
outputs:
version_number: ${{ steps.version_number.outputs.version_number }}
steps:
- name: Compute version number
run: |
export DATE_FORMATTED=`date +"%Y.%-m.%-d"`
MINOR_VERSION="${{ github.event.inputs.minor_version }}"
VERSION="${DATE_FORMATTED}.${MINOR_VERSION:-${{ github.run_number }}}"
RUN_ATTEMPT="${{ github.run_attempt }}"
if [ "$RUN_ATTEMPT" -gt "1" ]
then
VERSION="$VERSION.$RUN_ATTEMPT"
fi
export VERSION
echo "::set-output name=version_number::${VERSION}"
id: version_number
release_test_pypi:
runs-on: ubuntu-latest
needs: version_number
env:
TWINE_REPOSITORY: testpypi
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI }}
strategy:
matrix:
python-version: [3.12]
project:
- repository: PyAutoLabs/PyAutoConf
ref: main
path: PyAutoConf
- repository: PyAutoLabs/PyAutoFit
ref: main
path: PyAutoFit
- repository: PyAutoLabs/PyAutoArray
ref: main
path: PyAutoArray
- repository: PyAutoLabs/PyAutoGalaxy
ref: main
path: PyAutoGalaxy
- repository: PyAutoLabs/PyAutoLens
ref: main
path: PyAutoLens
steps:
- uses: actions/checkout@v2
with:
path: PyAutoBuild
- name: Checkout
uses: actions/checkout@v2
with:
repository: "${{ matrix.project.repository }}"
ref: "${{ matrix.project.ref }}"
path: "${{ matrix.project.path }}"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Build
run: |
pushd "${{ matrix.project.path }}"
export VERSION="${{ needs.version_number.outputs.version_number }}"
sed -i "s/__version__ = [\.\"\'0-9]*/__version__ = \"$VERSION\"/g" */__init__.py
python3 -m pip install --upgrade build
python3 -m build
popd
- name: Upload to test PyPI
run: |
python3 -m pip install twine==6.0.1
pushd "${{ matrix.project.path }}"
python3 -m twine upload --repository-url https://test.pypi.org/legacy/ --verbose dist/*
popd
- name: Wait for packages and install
run: |
export PACKAGES=("autoconf" "autoarray" "autofit" "autogalaxy" "autolens")
export VERSION="${{ needs.version_number.outputs.version_number }}"
# Wait for each package to become available on test PyPI.
# 300 attempts × 10s = 50min buffer. Each release_test_pypi matrix
# job uploads its own lib then waits for ALL 5 to be visible on the
# simple index, so the wait must absorb the slowest sibling build —
# on slow CI days the previous 100 × 10s = 17min budget timed out
# waiting for siblings that hadn't finished uploading yet, which
# then cascade-cancelled the rest of the matrix.
for PACKAGE in ${PACKAGES[@]}; do
echo "Checking for $PACKAGE==$VERSION on test PyPI..."
cnt=0
until python3 -m pip download --no-deps --dest /tmp/pyauto-check \
--index-url https://test.pypi.org/simple/ "$PACKAGE==$VERSION" 2>/dev/null; do
((cnt=cnt+1))
if [[ $cnt -ge 300 ]]; then
echo "ERROR: Timed out waiting for $PACKAGE==$VERSION after 300 attempts (50min)"
exit 1
fi
echo " Waiting for $PACKAGE==$VERSION... (attempt $cnt)"
sleep 10
done
echo " Found $PACKAGE==$VERSION"
done
echo "All packages available. Installing with pinned versions..."
# Install all 5 PyAuto packages in a single command with all versions
# pinned. This prevents pip from substituting unrelated packages with
# the same names from production PyPI (e.g. autoconf 0.7.7, autofit 0.73.1)
# during dependency resolution.
#
# Retry the install command — TestPyPI's simple index has CDN
# consistency issues. The wait loop above can succeed for a version
# that the install (which also queries real PyPI via --extra-index-url)
# then fails to resolve, because different requests hit different CDN
# edges with different views. Retry with backoff to ride out the lag.
install_cnt=0
until python3 -m pip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
"autoconf[optional]==$VERSION" \
"autoarray[optional]==$VERSION" \
"autofit[optional]==$VERSION" \
"autogalaxy[optional]==$VERSION" \
"autolens[optional]==$VERSION"; do
((install_cnt=install_cnt+1))
if [[ $install_cnt -ge 30 ]]; then
echo "ERROR: Install failed after 30 attempts (5min)"
exit 1
fi
echo " Install attempt $install_cnt failed, retrying in 10s..."
sleep 10
done
# Belt-and-braces: the [optional] → [jax] extras chain should
# pull JAX, but installs from test.pypi.org with mixed indexes
# have historically silently dropped the dep. Force the install
# so jax_likelihood_functions / jax_grad / jax_substructure
# scripts can't fail in 0.1s with ModuleNotFoundError.
pip install "jax>=0.7,<0.11" "jaxlib>=0.7,<0.11"
- name: Tests
run: |
pushd "${{ matrix.project.path }}"
export JAX_ENABLE_X64=True
pip install matplotlib==3.6.0
pip install pynufft==2025.1.1
pip install pytest
pip install numba
# PyAutoFit's NSS tests need the handley-lab blackjax fork +
# yallup/nss, which can't live in the [nss] extra because
# PyPI bans direct git+ URLs in uploaded wheels. They're tested
# separately in PyAutoFit's own unittest_nss job. Here we only
# exercise the TestPyPI-installable surface, so skip them.
if [ "${{ matrix.project.path }}" = "PyAutoFit" ]; then
python3 -m pytest --ignore=test_autofit/non_linear/search/nest/nss
else
python3 -m pytest
fi
run_smoke_tests:
runs-on: ubuntu-latest
needs:
- release_test_pypi
- version_number
if: "${{ github.event.inputs.skip_release != 'true' }}"
strategy:
fail-fast: false
matrix:
python-version: [3.12]
workspace:
- { repo: PyAutoLabs/autofit_workspace, path: autofit_workspace }
- { repo: PyAutoLabs/autogalaxy_workspace, path: autogalaxy_workspace }
- { repo: PyAutoLabs/autolens_workspace, path: autolens_workspace }
env:
PYAUTO_TEST_MODE: "1"
PYAUTO_SMALL_DATASETS: "1"
PYAUTO_FAST_PLOTS: "1"
PYAUTO_SKIP_WORKSPACE_VERSION_CHECK: "1"
NUMBA_CACHE_DIR: /tmp/numba_cache
MPLCONFIGDIR: /tmp/matplotlib
JAX_ENABLE_X64: "True"
steps:
- uses: actions/checkout@v4
with:
repository: ${{ matrix.workspace.repo }}
ref: main
path: ${{ matrix.workspace.path }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install from TestPyPI at pinned version
run: |
export VERSION="${{ needs.version_number.outputs.version_number }}"
install_cnt=0
until python3 -m pip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
"autoconf[optional]==$VERSION" \
"autoarray[optional]==$VERSION" \
"autofit[optional]==$VERSION" \
"autogalaxy[optional]==$VERSION" \
"autolens[optional]==$VERSION"; do
((install_cnt=install_cnt+1))
if [[ $install_cnt -ge 30 ]]; then
echo "ERROR: Install failed after 30 attempts"
exit 1
fi
sleep 10
done
pip install matplotlib==3.6.0 pynufft==2025.1.1 numba
# Belt-and-braces JAX install — the [optional] → [jax] chain
# occasionally silently drops jax from test.pypi resolution.
pip install "jax>=0.7,<0.11" "jaxlib>=0.7,<0.11"
- name: Run smoke tests
run: |
cd ${{ matrix.workspace.path }}
if [ ! -f smoke_tests.txt ]; then
echo "No smoke_tests.txt — skipping"
exit 0
fi
fail=0
while IFS= read -r script || [ -n "$script" ]; do
[ -z "$script" ] && continue
case "$script" in \#*) continue ;; esac
echo "::group::$script"
if python "scripts/$script"; then
echo "PASS: $script"
else
echo "FAIL: $script"
fail=$((fail + 1))
fi
echo "::endgroup::"
done < smoke_tests.txt
if [ "$fail" -gt 0 ]; then
echo "$fail smoke test(s) failed"
exit 1
fi
release:
runs-on: ubuntu-latest
env:
TWINE_REPOSITORY: pypi
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI }}
needs:
# Workspace-integration validation moved to PyAutoPulse
# (workspace-validation.yml). Build is a pure executor: it gates only on
# the TestPyPI build + version. Release readiness is enforced upstream by
# the PyAutoAgent release agent via `pyauto-pulse readiness`.
- release_test_pypi
- version_number
strategy:
matrix:
project:
- repository: PyAutoLabs/PyAutoConf
ref: main
path: PyAutoConf
pat: PAT_PYAUTOLABS
- repository: PyAutoLabs/PyAutoFit
ref: main
path: PyAutoFit
pat: PAT_PYAUTOLABS
- repository: PyAutoLabs/PyAutoArray
ref: main
path: PyAutoArray
pat: PAT_PYAUTOLABS
- repository: PyAutoLabs/PyAutoGalaxy
ref: main
path: PyAutoGalaxy
pat: PAT_PYAUTOLABS
- repository: PyAutoLabs/PyAutoLens
ref: main
path: PyAutoLens
pat: PAT_PYAUTOLABS
steps:
- uses: actions/checkout@v2
if: "${{ github.event.inputs.skip_release != 'true' }}"
with:
path: PyAutoBuild
- name: Checkout
if: "${{ github.event.inputs.skip_release != 'true' }}"
run: |
PAT="${{ secrets[matrix.project.pat] }}"
git clone -b "${{ matrix.project.ref }}" "https://$PAT@github.com/${{ matrix.project.repository }}.git" "${{ matrix.project.path }}"
- name: Set up Python 3.12
uses: actions/setup-python@v2
if: "${{ github.event.inputs.skip_release != 'true' }}"
with:
python-version: "3.12"
- name: Configure Git
if: "${{ github.event.inputs.skip_release != 'true' }}"
run: |
git config --global user.email "richard@rghsoftware.co.uk"
git config --global user.name "GitHub Actions bot"
- name: Update version
if: "${{ github.event.inputs.skip_release != 'true' }}"
run: |
pushd "${{ matrix.project.path }}"
VERSION="${{ needs.version_number.outputs.version_number }}"
sed -i "s/__version__ = [\.\"\'0-9]*/__version__ = \"$VERSION\"/g" */__init__.py
git commit "-am 'Updated version in __init__ to $VERSION"
- name: Tag
if: "${{ github.event.inputs.skip_release != 'true' }}"
run: |
pushd "${{ matrix.project.path }}"
VERSION="${{ needs.version_number.outputs.version_number }}"
git tag -m "Release $VERSION" -a "$VERSION"
PAT="${{ secrets[matrix.project.pat] }}"
git remote set-url --push origin "https://$PAT@github.com/${{ matrix.project.repository }}.git"
git push
git push --tags
- name: Build
if: "${{ github.event.inputs.skip_release != 'true' }}"
run: |
pushd "${{ matrix.project.path }}"
export VERSION="${{ needs.version_number.outputs.version_number }}"
sed -i "s/^\(\s*\"auto[a-z]*\)\(==[0-9][0-9.]*\)\{0,1\}\"/\1==$VERSION\"/g" pyproject.toml
python3 -m pip install --upgrade build
python3 -m build
- name: Upload to PyPI
if: "${{ github.event.inputs.skip_release != 'true' }}"
run: |
python3 -m pip install twine==6.0.1
pushd "${{ matrix.project.path }}"
python3 -m twine upload --verbose dist/*
publish_release_notes:
runs-on: ubuntu-latest
needs:
- release
- version_number
if: "${{ github.event.inputs.skip_release != 'true' }}"
strategy:
fail-fast: false
matrix:
project:
- repo: PyAutoLabs/PyAutoFit
pat: PAT_PYAUTOLABS
- repo: PyAutoLabs/PyAutoArray
pat: PAT_PYAUTOLABS
- repo: PyAutoLabs/PyAutoGalaxy
pat: PAT_PYAUTOLABS
- repo: PyAutoLabs/PyAutoLens
pat: PAT_PYAUTOLABS
steps:
- uses: actions/checkout@v2
with:
path: PyAutoBuild
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.12'
- name: Publish release notes
env:
GH_TOKEN: ${{ secrets[matrix.project.pat] }}
run: |
python3 PyAutoBuild/autobuild/generate_release_notes.py \
--version "${{ needs.version_number.outputs.version_number }}" \
--repo "${{ matrix.project.repo }}"
release_workspaces:
runs-on: ubuntu-latest
env:
TWINE_REPOSITORY: pypi
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI }}
PAT: ${{ secrets.PAT_PYAUTOLABS }}
needs:
# Validation moved to PyAutoPulse; this job generates notebooks inline and
# commits them — it no longer gates on the (removed) run_scripts/run_notebooks.
# Gate on `release`: workspace version pins must only be written after the
# libraries actually publish to PyPI, else a workspace could pin a version
# that never shipped (pre-existing race, hardened here).
- release
- release_test_pypi
- version_number
strategy:
fail-fast: false
matrix:
python-version: [3.12]
workspace:
- repository: PyAutoLabs/autofit_workspace
name: autofit
package: PyAutoFit
generate_notebooks: true
bump_colab_urls: true
- repository: PyAutoLabs/autogalaxy_workspace
name: autogalaxy
package: PyAutoGalaxy
generate_notebooks: true
bump_colab_urls: true
- repository: PyAutoLabs/autolens_workspace
name: autolens
package: PyAutoLens
generate_notebooks: true
bump_colab_urls: true
- repository: PyAutoLabs/HowToGalaxy
name: howtogalaxy
package: PyAutoGalaxy
generate_notebooks: true
bump_colab_urls: true
- repository: PyAutoLabs/HowToLens
name: howtolens
package: PyAutoLens
generate_notebooks: true
bump_colab_urls: true
- repository: PyAutoLabs/HowToFit
name: howtofit
package: PyAutoFit
generate_notebooks: true
bump_colab_urls: true
- repository: PyAutoLabs/euclid_strong_lens_modeling_pipeline
name: euclid_pipeline
package: PyAutoLens
generate_notebooks: false
bump_colab_urls: false
- repository: PyAutoLabs/autolens_assistant
name: autolens
package: PyAutoLens
generate_notebooks: false
bump_colab_urls: false
write_api_baseline: true
steps:
- uses: actions/checkout@v2
if: "${{ github.event.inputs.skip_release != 'true' }}"
with:
path: PyAutoBuild
- name: Checkout
if: "${{ github.event.inputs.skip_release != 'true' }}"
run: |
git clone -b main "https://$PAT@github.com/${{ matrix.workspace.repository }}.git" workspace
- name: Configure Git
if: "${{ github.event.inputs.skip_release != 'true' }}"
run: |
git config --global user.email "richard@rghsoftware.co.uk"
git config --global user.name "GitHub Actions bot"
- name: Set up Python ${{ matrix.python-version }}
if: "${{ github.event.inputs.skip_release != 'true' }}"
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Jupyter dependency
if: "${{ github.event.inputs.skip_release != 'true' }}"
run: |
pip install jupyter ipynb-py-convert PyYAML
- name: Update version in README
if: "${{ github.event.inputs.skip_release != 'true' }}"
run: |
VERSION="${{ needs.version_number.outputs.version_number }}"
PACKAGE="${{ matrix.workspace.package }}"
pushd workspace
sed -i "s/$PACKAGE v[0-9]\{4\}\.[0-9]*\.[0-9]*\.[0-9]*/$PACKAGE v$VERSION/g" README.rst README.md 2>/dev/null || true
git add README.rst README.md 2>/dev/null || true
- name: Update jupyter notebooks
if: "${{ github.event.inputs.skip_release != 'true' && matrix.workspace.generate_notebooks == true }}"
run: |
export PYTHONPATH=$PYTHONPATH:$(pwd)/PyAutoBuild
AUTOBUILD_PATH="$(pwd)/PyAutoBuild/autobuild"
pushd workspace
python3 "$AUTOBUILD_PATH/generate.py" ${{ matrix.workspace.name }}
git add *.ipynb
git commit -m "Release ${{ needs.version_number.outputs.version_number }}: update notebooks and version" || true
- name: Write workspace version
if: "${{ github.event.inputs.skip_release != 'true' }}"
run: |
VERSION="${{ needs.version_number.outputs.version_number }}"
pushd workspace
echo "$VERSION" > version.txt
python3 - "$VERSION" <<'PY'
import re, sys, pathlib
version = sys.argv[1]
path = pathlib.Path("config/general.yaml")
if not path.exists():
sys.exit(0)
text = path.read_text()
line_re = re.compile(r"^(?P<indent>\s*)workspace_version:\s*.*$", re.MULTILINE)
if line_re.search(text):
text = line_re.sub(lambda m: f"{m.group('indent')}workspace_version: {version}", text)
else:
block_re = re.compile(r"^version:\s*\n", re.MULTILINE)
if block_re.search(text):
text = block_re.sub(f"version:\n workspace_version: {version}\n", text, count=1)
else:
if not text.endswith("\n"):
text += "\n"
text += f"version:\n workspace_version: {version}\n"
path.write_text(text)
PY
git add version.txt config/general.yaml 2>/dev/null || git add version.txt
git commit -m "Release $VERSION: pin workspace version" || true
- name: Regenerate API audit baseline
if: "${{ github.event.inputs.skip_release != 'true' && matrix.workspace.write_api_baseline == true }}"
env:
NUMBA_CACHE_DIR: /tmp/numba_cache
MPLCONFIGDIR: /tmp/matplotlib
PYAUTO_SKIP_WORKSPACE_VERSION_CHECK: "1"
run: |
VERSION="${{ needs.version_number.outputs.version_number }}"
# Install the just-released wheels so the baseline hashes the published
# API surface, then let the assistant regenerate its own baseline (it
# owns the hash format — no reimplementation here).
install_cnt=0
until python3 -m pip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
"autoconf[optional]==$VERSION" \
"autoarray[optional]==$VERSION" \
"autofit[optional]==$VERSION" \
"autogalaxy[optional]==$VERSION" \
"autolens[optional]==$VERSION"; do
((install_cnt=install_cnt+1))
if [[ $install_cnt -ge 30 ]]; then
echo "ERROR: Install failed after 30 attempts"
exit 1
fi
sleep 10
done
pip install matplotlib==3.6.0 pynufft==2025.1.1 numba
# Belt-and-braces JAX install (same reason as the install steps above).
pip install "jax>=0.7,<0.11" "jaxlib>=0.7,<0.11"
pushd workspace
python3 work/audit_skill_apis.py --write-baseline
git add wiki/core/api_audit_baseline.json
git commit -m "Release $VERSION: regenerate API audit baseline" || true
popd
- name: Bump Colab URL tag refs
if: "${{ github.event.inputs.skip_release != 'true' && matrix.workspace.bump_colab_urls == true }}"
run: |
VERSION="${{ needs.version_number.outputs.version_number }}"
pushd workspace
bash "$GITHUB_WORKSPACE/PyAutoBuild/autobuild/bump_colab_urls.sh" "$VERSION"
git add -A
git commit -m "Release $VERSION: bump Colab URL tag refs" || true
- name: Tag and push to main
if: "${{ github.event.inputs.skip_release != 'true' }}"
run: |
cd workspace
VERSION="${{ needs.version_number.outputs.version_number }}"
git tag -m "Release $VERSION" -a "$VERSION"
git push origin main
git push origin --tags
bump_library_colab_urls:
runs-on: ubuntu-latest
env:
PAT: ${{ secrets.PAT_PYAUTOLABS }}
needs:
- release
- version_number
if: "${{ github.event.inputs.skip_release != 'true' }}"
strategy:
fail-fast: false
matrix:
library:
- PyAutoLabs/PyAutoFit
- PyAutoLabs/PyAutoGalaxy
- PyAutoLabs/PyAutoLens
steps:
- uses: actions/checkout@v2
with:
path: PyAutoBuild
- name: Checkout library
run: |
git clone -b main "https://$PAT@github.com/${{ matrix.library }}.git" library
- name: Configure Git
run: |
git config --global user.email "richard@rghsoftware.co.uk"
git config --global user.name "GitHub Actions bot"
- name: Bump Colab URL tag refs
run: |
VERSION="${{ needs.version_number.outputs.version_number }}"
pushd library
bash "$GITHUB_WORKSPACE/PyAutoBuild/autobuild/bump_colab_urls.sh" "$VERSION"
if ! git diff --quiet; then
git add -A
git commit -m "Release $VERSION: bump Colab URL tag refs"
git push origin main
fi
run_notebooks_and_release_workspaces:
runs-on: ubuntu-latest
env:
TWINE_REPOSITORY: pypi
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI }}
needs:
# Validation moved to PyAutoPulse; this job generates + runs notebooks
# inline (its own matrix). Gate on `release` (same reason as
# release_workspaces) so it only runs after PyPI publish succeeds.
- release
- release_test_pypi
- version_number
strategy:
fail-fast: false
matrix:
python-version: [ 3.12 ]
project:
- name: autofit
repository: PyAutoLabs/PyAutoFit
workspace_repository: PyAutoLabs/autofit_workspace
pat: PAT_PYAUTOLABS
- name: autogalaxy
repository: PyAutoLabs/PyAutoGalaxy
workspace_repository: PyAutoLabs/autogalaxy_workspace
pat: PAT_PYAUTOLABS
- name: autolens
repository: PyAutoLabs/PyAutoLens
workspace_repository: PyAutoLabs/autolens_workspace
pat: PAT_PYAUTOLABS
steps:
- name: Configure
id: configure
if: "${{ github.event.inputs.update_notebook_visualisations == 'true' }}"
run: |
echo "::set-output name=repository::${{ matrix.project.repository }}"
echo "::set-output name=workspace_repository::${{ matrix.project.workspace_repository }}"
echo "::set-output name=project::${{ matrix.project.name }}"
echo "::set-output name=pat::${{ matrix.project.pat }}"
- uses: actions/checkout@v2
if: "${{ github.event.inputs.update_notebook_visualisations == 'true' }}"
with:
path: PyAutoBuild
- name: Checkout project
if: "${{ github.event.inputs.update_notebook_visualisations == 'true' }}"
uses: actions/checkout@v2
with:
repository: "${{ steps.configure.outputs.repository }}"
path: project
- name: Checkout workspace
if: "${{ github.event.inputs.update_notebook_visualisations == 'true' }}"
run: |
PAT="${{ secrets[steps.configure.outputs.pat] }}"
git clone -b main "https://$PAT@github.com/${{ steps.configure.outputs.workspace_repository }}.git" workspace
- name: Set up Python ${{ matrix.python-version }}
if: "${{ github.event.inputs.update_notebook_visualisations == 'true' }}"
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install optional requirements
if: "${{ github.event.inputs.update_notebook_visualisations == 'true' }}"
run: |
echo "Installing optional requirements"
pip install matplotlib==3.6.0
pip install pynufft==2025.1.1
pip install numba
- name: Install project
if: "${{ github.event.inputs.update_notebook_visualisations == 'true' }}"
run: |
python3 -m pip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
"${{ steps.configure.outputs.project }}==${{ needs.version_number.outputs.version_number }}"
- name: Install Jupyter dependency
if: "${{ github.event.inputs.update_notebook_visualisations == 'true' }}"
run: |
python3 -m pip install jupyter ipynb-py-convert
- name: Generate Jupyter notebooks
if: "${{ github.event.inputs.update_notebook_visualisations == 'true' }}"
run: |
export PYTHONPATH=$PYTHONPATH:$(pwd)/PyAutoBuild
AUTOBUILD_PATH="$(pwd)/PyAutoBuild/autobuild"
pushd "workspace"
python3 "$AUTOBUILD_PATH/generate.py" ${{ matrix.project.name }}
- name: Run Jupyter notebooks
if: "${{ github.event.inputs.update_notebook_visualisations == 'true' }}"
run: |
if [[ ${{ matrix.project.name }} == *_test ]]
then
export PYAUTO_TEST_MODE=0
else
export PYAUTO_TEST_MODE=1
export PYAUTO_SMALL_DATASETS=1
export PYAUTO_FAST_PLOTS=1
fi
export PYTHONPATH=$PYTHONPATH:$(pwd)/PyAutoBuild
AUTOBUILD_PATH="$(pwd)/PyAutoBuild/autobuild"
pushd workspace
python3 "$AUTOBUILD_PATH/run.py" ${{ matrix.project.name }} "notebooks/${{ matrix.project.directory }}" --visualise
- name: Configure Git
if: "${{ github.event.inputs.update_notebook_visualisations == 'true' }}"
run: |
git config --global user.email "richard@rghsoftware.co.uk"
git config --global user.name "GitHub Actions bot"
- name: Commit visualizations
if: "${{ github.event.inputs.update_notebook_visualisations == 'true' }}"
run: |
cd workspace
git add .
git commit -m "Updated notebooks with visualizations" || true
- name: Push to main
if: "${{ github.event.inputs.update_notebook_visualisations == 'true' }}"
run: |
cd workspace
git push origin main
# ---------------------------------------------------------------------------
# Wiki-currency check (autolens_assistant).
#
# PyAutoBuild only orchestrates and reports here — it calls into the assistant's
# reusable workflow, which is the single home of the currency rules (symbol audit,
# idiom deny-list, provenance). No wiki-currency rule is reimplemented in this repo.
#
# Runs AFTER release_workspaces so the assistant's API baseline — regenerated and
# committed to autolens_assistant `main` in that job — is already in place when the
# reusable workflow's `--check-version` compares the just-released stack against it.
# ---------------------------------------------------------------------------
wiki_currency_check:
needs:
- version_number
- release_workspaces
if: "${{ github.event.inputs.skip_release != 'true' }}"
uses: PyAutoLabs/autolens_assistant/.github/workflows/wiki-currency.yml@main
with:
stack_version: ${{ needs.version_number.outputs.version_number }}
assistant_ref: main
# On drift, open a "wiki drift" issue against autolens_assistant listing the offending
# pages (the report artifact the reusable workflow uploaded). Reporting only — the
# judgement of what is stale was made by the assistant's check.
wiki_drift_issue:
needs:
- version_number
- wiki_currency_check
if: "${{ always() && needs.wiki_currency_check.result == 'failure' }}"
runs-on: ubuntu-latest
steps:
- name: Download drift report
uses: actions/download-artifact@v4
with:
name: wiki-drift-report
path: drift
- name: Open wiki-drift issue against autolens_assistant
env:
GH_TOKEN: ${{ secrets.PAT_PYAUTOLABS }}
run: |
VERSION="${{ needs.version_number.outputs.version_number }}"
BODY=drift/drift-report.md
if [ ! -f "$BODY" ]; then
printf '# Wiki-currency drift at release %s\n\nThe check failed but no drift-report artifact was found; see the run logs.\n' "$VERSION" > "$BODY"
fi
gh issue create \
--repo PyAutoLabs/autolens_assistant \
--title "wiki drift detected at release $VERSION" \
--body-file "$BODY" \
|| echo "::warning::could not open wiki-drift issue (non-fatal)"