-
Notifications
You must be signed in to change notification settings - Fork 1
817 lines (798 loc) · 30.3 KB
/
release.yml
File metadata and controls
817 lines (798 loc) · 30.3 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
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
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
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 100 ]]; then
echo "ERROR: Timed out waiting for $PACKAGE==$VERSION after 100 attempts"
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.
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"
- 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
python3 -m pytest
find_scripts:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.script_matrix.outputs.matrix }}
steps:
- name: Checkout AutoFit
uses: actions/checkout@v2
with:
repository: PyAutoLabs/autofit_workspace
path: autofit
- name: Checkout AutoGalaxy
uses: actions/checkout@v2
with:
repository: PyAutoLabs/autogalaxy_workspace
path: autogalaxy
- name: Checkout AutoLens
uses: actions/checkout@v2
with:
repository: PyAutoLabs/autolens_workspace
path: autolens
- name: Checkout AutoFit Test
uses: actions/checkout@v2
with:
repository: PyAutoLabs/autofit_workspace_test
path: autofit_test
- name: Checkout AutoLens Test
uses: actions/checkout@v2
with:
repository: PyAutoLabs/autolens_workspace_test
path: autolens_test
- uses: actions/checkout@v2
with:
path: PyAutoBuild
- name: Make script matrix
id: script_matrix
run: |
matrix="$(./PyAutoBuild/autobuild/script_matrix.py autofit autogalaxy autolens autofit_test autolens_test)"
echo "::set-output name=matrix::$matrix"
generate_notebooks:
runs-on: ubuntu-latest
needs:
- release_test_pypi
- version_number
- find_scripts
strategy:
fail-fast: false
matrix:
python-version: [3.12]
project:
- name: autofit
repository: PyAutoLabs/PyAutoFit
workspace_repository: PyAutoLabs/autofit_workspace
- name: autogalaxy
repository: PyAutoLabs/PyAutoGalaxy
workspace_repository: PyAutoLabs/autogalaxy_workspace
- name: autolens
repository: PyAutoLabs/PyAutoLens
workspace_repository: PyAutoLabs/autolens_workspace
steps:
- name: Skip check
if: "${{ github.event.inputs.skip_notebooks != 'true' }}"
id: should_run
run: echo "run=true" >> $GITHUB_OUTPUT
- uses: actions/checkout@v2
if: steps.should_run.outputs.run == 'true'
with:
path: PyAutoBuild
- name: Checkout workspace
if: steps.should_run.outputs.run == 'true'
uses: actions/checkout@v2
with:
repository: ${{ matrix.project.workspace_repository }}
ref: main
path: workspace
- name: Set up Python ${{ matrix.python-version }}
if: steps.should_run.outputs.run == 'true'
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
if: steps.should_run.outputs.run == 'true'
run: |
python3 -m pip install jupyter ipynb-py-convert PyYAML
- name: Generate notebooks
if: steps.should_run.outputs.run == 'true'
run: |
export PYTHONPATH=$PYTHONPATH:$(pwd)/PyAutoBuild
AUTOBUILD_PATH="$(pwd)/PyAutoBuild/autobuild"
pushd workspace
python3 "$AUTOBUILD_PATH/generate.py" ${{ matrix.project.name }} --report-dir generate-results
- name: Upload generated notebooks
if: always() && steps.should_run.outputs.run == 'true'
uses: actions/upload-artifact@v4
with:
name: notebooks-${{ matrix.project.name }}
path: workspace/notebooks/
retention-days: 7
- name: Upload generation results
if: always() && steps.should_run.outputs.run == 'true'
uses: actions/upload-artifact@v4
with:
name: results-generate-${{ matrix.project.name }}
path: workspace/generate-results/
retention-days: 30
run_scripts:
runs-on: ubuntu-latest
needs:
- release_test_pypi
- version_number
- find_scripts
strategy:
fail-fast: false
matrix:
python-version: [3.12]
project:
${{ fromJSON(needs.find_scripts.outputs.matrix) }}
steps:
- name: Configure
if: "${{ github.event.inputs.skip_scripts != 'true' }}"
id: configure
run: |
if [ ${{ matrix.project.name }} == "autofit" ]
then
echo "::set-output name=repository::PyAutoLabs/PyAutoFit"
echo "::set-output name=workspace_repository::PyAutoLabs/autofit_workspace"
echo "::set-output name=project::autofit"
elif [ ${{ matrix.project.name }} == "autogalaxy" ]
then
echo "::set-output name=repository::PyAutoLabs/PyAutoGalaxy"
echo "::set-output name=workspace_repository::PyAutoLabs/autogalaxy_workspace"
echo "::set-output name=project::autogalaxy"
elif [ ${{ matrix.project.name }} == "autolens" ]
then
echo "::set-output name=repository::PyAutoLabs/PyAutoLens"
echo "::set-output name=workspace_repository::PyAutoLabs/autolens_workspace"
echo "::set-output name=project::autolens"
elif [ ${{ matrix.project.name }} == "autofit_test" ]
then
echo "::set-output name=repository::PyAutoLabs/PyAutoFit"
echo "::set-output name=workspace_repository::PyAutoLabs/autofit_workspace_test"
echo "::set-output name=project::autofit"
else
echo "::set-output name=repository::PyAutoLabs/PyAutoLens"
echo "::set-output name=workspace_repository::PyAutoLabs/autolens_workspace_test"
echo "::set-output name=project::autolens"
fi
- uses: actions/checkout@v2
if: "${{ github.event.inputs.skip_scripts != 'true' }}"
with:
path: PyAutoBuild
- name: Checkout project
if: "${{ github.event.inputs.skip_scripts != 'true' }}"
uses: actions/checkout@v2
with:
repository: "${{ steps.configure.outputs.repository }}"
path: project
- name: Checkout workspace
if: "${{ github.event.inputs.skip_scripts != 'true' }}"
uses: actions/checkout@v2
with:
repository: ${{ steps.configure.outputs.workspace_repository }}
ref: main
path: workspace
- name: Set up Python ${{ matrix.python-version }}
if: "${{ github.event.inputs.skip_scripts != 'true' }}"
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install optional requirements
if: "${{ github.event.inputs.skip_scripts != '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.skip_scripts != 'true' }}"
run: |
python3 -m pip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
"autoconf==${{ needs.version_number.outputs.version_number }}" \
"${{ steps.configure.outputs.project }}==${{ needs.version_number.outputs.version_number }}"
- name: Run Python scripts
if: "${{ github.event.inputs.skip_scripts != 'true' }}"
run: |
export PYTHONPATH=$PYTHONPATH:$(pwd)/PyAutoBuild
export PATH=$PATH:$(pwd)/PyAutoBuild/autobuild
AUTOBUILD_PATH="$(pwd)/PyAutoBuild/autobuild"
pushd workspace
python3 "$AUTOBUILD_PATH/run_python.py" ${{ matrix.project.name }} "scripts/${{ matrix.project.directory }}" --report-dir test-results
- name: Upload script results
if: always()
uses: actions/upload-artifact@v4
with:
name: results-scripts-${{ matrix.project.name }}-${{ matrix.project.directory }}
path: workspace/test-results/
retention-days: 30
run_notebooks:
runs-on: ubuntu-latest
needs:
- release_test_pypi
- version_number
- find_scripts
- generate_notebooks
strategy:
fail-fast: false
matrix:
python-version: [3.12]
project:
${{ fromJSON(needs.find_scripts.outputs.matrix) }}
steps:
- name: Configure
if: "${{ github.event.inputs.skip_notebooks != 'true' }}"
id: configure
run: |
if [ ${{ matrix.project.name }} == "autofit" ]
then
echo "::set-output name=repository::PyAutoLabs/PyAutoGalaxy"
echo "::set-output name=workspace_repository::PyAutoLabs/autofit_workspace"
echo "::set-output name=project::autofit"
elif [ ${{ matrix.project.name }} == "autogalaxy" ]
then
echo "::set-output name=repository::PyAutoLabs/PyAutoGalaxy"
echo "::set-output name=workspace_repository::PyAutoLabs/autogalaxy_workspace"
echo "::set-output name=project::autogalaxy"
elif [ ${{ matrix.project.name }} == "autolens" ]
then
echo "::set-output name=repository::PyAutoLabs/PyAutoLens"
echo "::set-output name=workspace_repository::PyAutoLabs/autolens_workspace"
echo "::set-output name=project::autolens"
fi
- uses: actions/checkout@v2
if: "${{ github.event.inputs.skip_notebooks != 'true' }}"
with:
path: PyAutoBuild
- name: Checkout project
if: "${{ github.event.inputs.skip_notebooks != 'true' }}"
uses: actions/checkout@v2
with:
repository: "${{ steps.configure.outputs.repository }}"
path: project
- name: Checkout workspace
if: "${{ github.event.inputs.skip_notebooks != 'true' }}"
uses: actions/checkout@v2
with:
repository: ${{ steps.configure.outputs.workspace_repository }}
ref: main
path: workspace
- name: Download pre-built notebooks
if: "${{ github.event.inputs.skip_notebooks != 'true' }}"
uses: actions/download-artifact@v4
with:
name: notebooks-${{ matrix.project.name }}
path: workspace/notebooks/
- name: Set up Python ${{ matrix.python-version }}
if: "${{ github.event.inputs.skip_notebooks != 'true' }}"
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install optional requirements
if: "${{ github.event.inputs.skip_notebooks != '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.skip_notebooks != 'true' }}"
run: |
python3 -m pip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
"autoconf==${{ needs.version_number.outputs.version_number }}" \
"${{ steps.configure.outputs.project }}==${{ needs.version_number.outputs.version_number }}"
- name: Install Jupyter dependency
if: "${{ github.event.inputs.skip_notebooks != 'true' }}"
run: |
python3 -m pip install jupyter ipynb-py-convert
- name: Run jupyter notebooks
if: "${{ github.event.inputs.skip_notebooks != 'true' }}"
run: |
export PYTHONPATH=$PYTHONPATH:$(pwd)/PyAutoBuild
AUTOBUILD_PATH="$(pwd)/PyAutoBuild/autobuild"
pushd workspace
python3 "$AUTOBUILD_PATH/run.py" ${{ matrix.project.name }} "notebooks/${{ matrix.project.directory }}" --report-dir test-results
- name: Upload notebook results
if: always()
uses: actions/upload-artifact@v4
with:
name: results-notebooks-${{ matrix.project.name }}-${{ matrix.project.directory }}
path: workspace/test-results/
retention-days: 30
analyze_results:
runs-on: ubuntu-latest
needs:
- run_scripts
- run_notebooks
- generate_notebooks
- version_number
if: always()
steps:
- uses: actions/checkout@v2
with:
path: PyAutoBuild
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.12'
- name: Download all result artifacts
uses: actions/download-artifact@v4
with:
path: all-results
pattern: results-*
merge-multiple: true
- name: Generate release readiness report
run: |
export PYTHONPATH=$PYTHONPATH:$(pwd)/PyAutoBuild
python3 PyAutoBuild/autobuild/aggregate_results.py all-results/ \
--output release-report.json \
--markdown release-report.md
- name: Post workflow summary
if: always()
run: |
cat release-report.md >> $GITHUB_STEP_SUMMARY
- name: Upload consolidated report
if: always()
uses: actions/upload-artifact@v4
with:
name: release-report
path: |
release-report.json
release-report.md
retention-days: 90
- name: Create analysis issue on failure
if: always() && (needs.run_scripts.result == 'failure' || needs.run_notebooks.result == 'failure' || needs.generate_notebooks.result == 'failure')
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python3 PyAutoBuild/autobuild/create_analysis_issue.py release-report.json \
--run-id ${{ github.run_id }} \
--repo ${{ github.repository }}
release:
runs-on: ubuntu-latest
env:
TWINE_REPOSITORY: pypi
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI }}
needs:
- run_scripts
- run_notebooks
- release_test_pypi
- version_number
- analyze_results
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
run: |
git clone -b "${{ matrix.project.ref }}" "https://$PAT@github.com/${{ matrix.project.repository }}.git" "${{ matrix.project.path }}"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
if: "${{ github.event.inputs.skip_release != 'true' }}"
with:
python-version: ${{ matrix.python-version }}
- 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:
- run_scripts
- run_notebooks
- release_test_pypi
- version_number
strategy:
matrix:
python-version: [3.12]
workspace:
- repository: PyAutoLabs/autofit_workspace
name: autofit
package: PyAutoFit
- repository: PyAutoLabs/autogalaxy_workspace
name: autogalaxy
package: PyAutoGalaxy
- repository: PyAutoLabs/autolens_workspace
name: autolens
package: PyAutoLens
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' }}"
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: Release
if: "${{ github.event.inputs.skip_release != 'true' }}"
run: |
cd workspace
git checkout release
git merge main
VERSION="${{ needs.version_number.outputs.version_number }}"
git tag -m "Release $VERSION" -a "$VERSION"
git push
git push --tags
run_notebooks_and_release_workspaces:
runs-on: ubuntu-latest
env:
TWINE_REPOSITORY: pypi
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI }}
needs:
- run_scripts
- release_test_pypi
- version_number
- find_scripts
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 PYAUTOFIT_TEST_MODE=0
else
export PYAUTOFIT_TEST_MODE=1
export PYAUTO_WORKSPACE_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: Switch to release branch
if: "${{ github.event.inputs.update_notebook_visualisations == 'true' }}"
run: |
cd workspace
git checkout release
- name: Merge main into release
if: "${{ github.event.inputs.update_notebook_visualisations == 'true' }}"
run: |
cd workspace
git merge main
- 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 release branch
if: "${{ github.event.inputs.update_notebook_visualisations == 'true' }}"
run: |
cd workspace
git push origin release