Skip to content

Don't run the PyPi job all the time #1363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 52 additions & 2 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
branches:
- main
- auto-release
pull_request:
branches: [main]
release:
Expand All @@ -16,10 +15,49 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

permissions: {}

jobs:
check_changes:
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.set_should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.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'
- name: Set should_run output
id: set_should_run
run: |
if [[ "${{ github.event_name == 'release' ||
(
github.ref == 'refs/heads/main' ||
github.event_name == 'pull_request'
) && steps.filter.outputs.any_changed == 'true'
}}" == "true" ]]; then
echo "should_run=true" >> $GITHUB_OUTPUT
else
echo "should_run=false" >> $GITHUB_OUTPUT
fi

# 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:
# write id-token and attestations are required to attest build provenance
Expand Down Expand Up @@ -49,6 +87,10 @@ jobs:

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
Expand All @@ -62,6 +104,10 @@ jobs:

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:
# write id-token and attestations are required to attest build provenance
Expand Down Expand Up @@ -96,6 +142,10 @@ jobs:

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:
# write id-token and attestations are required to attest build provenance
Expand Down Expand Up @@ -133,7 +183,7 @@ jobs:

check_dist:
name: Check dist
needs: [make_sdist,build_wheels]
needs: [check_changes, make_sdist, build_wheels]
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v4
Expand Down
Loading