PyAuto Release #560
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: rhayes777/PyAutoConf | |
| ref: main | |
| path: PyAutoConf | |
| - repository: rhayes777/PyAutoFit | |
| ref: main | |
| path: PyAutoFit | |
| - repository: Jammy2211/PyAutoArray | |
| ref: main | |
| path: PyAutoArray | |
| - repository: Jammy2211/PyAutoGalaxy | |
| ref: main | |
| path: PyAutoGalaxy | |
| - repository: Jammy2211/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: Jammy2211/autofit_workspace | |
| path: autofit | |
| - name: Checkout AutoGalaxy | |
| uses: actions/checkout@v2 | |
| with: | |
| repository: Jammy2211/autogalaxy_workspace | |
| path: autogalaxy | |
| - name: Checkout AutoLens | |
| uses: actions/checkout@v2 | |
| with: | |
| repository: Jammy2211/autolens_workspace | |
| path: autolens | |
| - name: Checkout AutoFit Test | |
| uses: actions/checkout@v2 | |
| with: | |
| repository: Jammy2211/autofit_workspace_test | |
| path: autofit_test | |
| - name: Checkout AutoLens Test | |
| uses: actions/checkout@v2 | |
| with: | |
| repository: Jammy2211/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: rhayes777/PyAutoFit | |
| workspace_repository: Jammy2211/autofit_workspace | |
| - name: autogalaxy | |
| repository: Jammy2211/PyAutoGalaxy | |
| workspace_repository: Jammy2211/autogalaxy_workspace | |
| - name: autolens | |
| repository: Jammy2211/PyAutoLens | |
| workspace_repository: Jammy2211/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::rhayes777/PyAutoFit" | |
| echo "::set-output name=workspace_repository::Jammy2211/autofit_workspace" | |
| echo "::set-output name=project::autofit" | |
| elif [ ${{ matrix.project.name }} == "autogalaxy" ] | |
| then | |
| echo "::set-output name=repository::Jammy2211/PyAutoGalaxy" | |
| echo "::set-output name=workspace_repository::Jammy2211/autogalaxy_workspace" | |
| echo "::set-output name=project::autogalaxy" | |
| elif [ ${{ matrix.project.name }} == "autolens" ] | |
| then | |
| echo "::set-output name=repository::Jammy2211/PyAutoLens" | |
| echo "::set-output name=workspace_repository::Jammy2211/autolens_workspace" | |
| echo "::set-output name=project::autolens" | |
| elif [ ${{ matrix.project.name }} == "autofit_test" ] | |
| then | |
| echo "::set-output name=repository::rhayes777/PyAutoFit" | |
| echo "::set-output name=workspace_repository::Jammy2211/autofit_workspace_test" | |
| echo "::set-output name=project::autofit" | |
| else | |
| echo "::set-output name=repository::Jammy2211/PyAutoLens" | |
| echo "::set-output name=workspace_repository::Jammy2211/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::Jammy2211/PyAutoGalaxy" | |
| echo "::set-output name=workspace_repository::Jammy2211/autofit_workspace" | |
| echo "::set-output name=project::autofit" | |
| elif [ ${{ matrix.project.name }} == "autogalaxy" ] | |
| then | |
| echo "::set-output name=repository::Jammy2211/PyAutoGalaxy" | |
| echo "::set-output name=workspace_repository::Jammy2211/autogalaxy_workspace" | |
| echo "::set-output name=project::autogalaxy" | |
| elif [ ${{ matrix.project.name }} == "autolens" ] | |
| then | |
| echo "::set-output name=repository::Jammy2211/PyAutoLens" | |
| echo "::set-output name=workspace_repository::Jammy2211/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: rhayes777/PyAutoConf | |
| ref: main | |
| path: PyAutoConf | |
| pat: PAT_RICH | |
| - repository: rhayes777/PyAutoFit | |
| ref: main | |
| path: PyAutoFit | |
| pat: PAT_RICH | |
| - repository: Jammy2211/PyAutoArray | |
| ref: main | |
| path: PyAutoArray | |
| pat: PAT_JAMES | |
| - repository: Jammy2211/PyAutoGalaxy | |
| ref: main | |
| path: PyAutoGalaxy | |
| pat: PAT_JAMES | |
| - repository: Jammy2211/PyAutoLens | |
| ref: main | |
| path: PyAutoLens | |
| pat: PAT_JAMES | |
| 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 }}" | |
| 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: rhayes777/PyAutoFit | |
| pat: PAT_RICH | |
| - repo: Jammy2211/PyAutoArray | |
| pat: PAT_JAMES | |
| - repo: Jammy2211/PyAutoGalaxy | |
| pat: PAT_JAMES | |
| - repo: Jammy2211/PyAutoLens | |
| pat: PAT_JAMES | |
| 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_JAMES }} | |
| needs: | |
| - run_scripts | |
| - run_notebooks | |
| - release_test_pypi | |
| - version_number | |
| strategy: | |
| matrix: | |
| python-version: [3.12] | |
| workspace: | |
| - repository: Jammy2211/autofit_workspace | |
| name: autofit | |
| package: PyAutoFit | |
| - repository: Jammy2211/autogalaxy_workspace | |
| name: autogalaxy | |
| package: PyAutoGalaxy | |
| - repository: Jammy2211/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: rhayes777/PyAutoFit | |
| workspace_repository: Jammy2211/autofit_workspace | |
| pat: PAT_RICH | |
| - name: autogalaxy | |
| repository: Jammy2211/PyAutoGalaxy | |
| workspace_repository: Jammy2211/autogalaxy_workspace | |
| pat: PAT_JAMES | |
| - name: autolens | |
| repository: Jammy2211/PyAutoLens | |
| workspace_repository: Jammy2211/autolens_workspace | |
| pat: PAT_JAMES | |
| 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 |