Skip to content

rel-3.2.4

rel-3.2.4 #7898

Workflow file for this run

name: PyPI
on:
push:
branches:
- main
- v2
pull_request:
branches:
- main
- v2
release:
types: [published]
# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
permissions: {}
jobs:
check_changes:
name: Check for changes
runs-on: ubuntu-latest
outputs:
should_run: ${{ github.event_name == 'release' || github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && steps.filter.outputs.any_changed == 'true') }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2
id: filter
with:
filters: |
any_changed:
- '.github/workflows/pypi.yml'
- 'pyproject.toml'
- 'setup.py'
- 'pytensor/_version.py'
- 'pytensor/scan_perform.pyx'
- 'pytensor/scan_perform_ext.py'
# The job to build precompiled pypi wheels.
make_sdist:
name: Make SDist
needs: check_changes
# Run if it's a release or if relevant files changed on main
if: |
needs.check_changes.outputs.should_run == 'true'
runs-on: ubuntu-latest
permissions:
id-token: write # required to attest build provenance
attestations: write # required to attest build provenance
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
submodules: true
persist-credentials: false
- name: Build SDist
run: pipx run build --sdist
- name: Attest GitHub build provenance
uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1
# Don't attest from forks
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
with:
subject-path: dist/*.tar.gz
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: sdist
path: dist/*.tar.gz
run_checks:
name: Build & inspect our package.
needs: check_changes
# Run if it's a release or if relevant files changed on main
if: |
needs.check_changes.outputs.should_run == 'true'
# Note: the resulting builds are not actually published.
# This is purely for additional testing and diagnostic purposes.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- uses: hynek/build-and-inspect-python-package@d44ca7d91762de7a7d5436ddae667c6da6d1c3df # v2.18.0
build_wheels:
name: Build wheels for ${{ matrix.platform }}
needs: check_changes
# Run if it's a release or if relevant files changed on main
if: |
needs.check_changes.outputs.should_run == 'true'
runs-on: ${{ matrix.platform }}
permissions:
id-token: write # required to attest build provenance
attestations: write # required to attest build provenance
strategy:
matrix:
platform:
- macos-latest
- windows-latest
- ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- name: Build wheels
uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
- name: Attest GitHub build provenance
uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1
# Don't attest from forks
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
with:
subject-path: ./wheelhouse/*.whl
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wheels-${{ matrix.platform }}
path: ./wheelhouse/*.whl
build_universal_wheel:
name: Build universal wheel for Pyodide
needs: check_changes
# Run if it's a release or if relevant files changed on main
if: |
needs.check_changes.outputs.should_run == 'true'
runs-on: ubuntu-latest
permissions:
id-token: write # required to attest build provenance
attestations: write # required to attest build provenance
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.12'
- name: Install dependencies
run: pip install --upgrade setuptools numpy versioneer wheel
- name: Build universal wheel
run: |
PYODIDE=1 python setup.py bdist_wheel --universal
- name: Attest GitHub build provenance
uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1
# Don't attest from forks
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
with:
subject-path: dist/*.whl
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: universal_wheel
path: dist/*.whl
check_dist:
name: Check dist
needs: [check_changes, make_sdist, build_wheels]
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: sdist
path: dist
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: wheels-*
path: dist
merge-multiple: true
- name: Set up Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.12'
- name: Check SDist
run: |
mkdir -p test-sdist
cd test-sdist
python -m venv venv-sdist
venv-sdist/bin/python -m pip install ../dist/pytensor-*.tar.gz
# check import
venv-sdist/bin/python -c "import pytensor;print(pytensor.__version__)"
# check import cython module
venv-sdist/bin/python -c 'from pytensor.scan import scan_perform; print(scan_perform.get_version())'
- run: pipx run twine check --strict dist/*
upload_pypi:
name: Upload to PyPI on release
# Use the `release` GitHub environment to protect the Trusted Publishing (OIDC)
# workflow by requiring signoff from a maintainer.
environment: release
permissions:
id-token: write # required for trusted publishing (OIDC)
needs: [check_dist]
runs-on: ubuntu-latest
# Don't publish from forks
if: github.repository_owner == 'pymc-devs' && github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: sdist
path: dist
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: wheels-*
path: dist
merge-multiple: true
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: universal_wheel
path: dist
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
# Implicitly attests that the packages were uploaded in the context of this workflow.