diff --git a/.github/workflows/intel-ci.yml b/.github/workflows/intel-ci.yml index 2bf9e62..bfb1cd3 100644 --- a/.github/workflows/intel-ci.yml +++ b/.github/workflows/intel-ci.yml @@ -34,9 +34,11 @@ jobs: - name: Read the declared platforms and Python versions id: declared + env: + EVENT: ${{ startsWith(github.ref, 'refs/tags/') && 'tag' || github.event_name == 'pull_request' && 'pr' || 'push' }} run: | - python ci/matrix.py --event "$GITHUB_EVENT_NAME" --github-output matrix - python ci/matrix.py --system wheel --event "$GITHUB_EVENT_NAME" --github-output wheel + python ci/matrix.py --event "$EVENT" --github-output matrix + python ci/matrix.py --system wheel --event "$EVENT" --github-output wheel # macOS runs on Intel runners, as MKL has no Apple silicon build. build: @@ -82,9 +84,7 @@ jobs: test: name: Test ${{ matrix.name }} Python ${{ matrix.python }} - needs: [matrix, build] - # Test every package that built, even when another build failed - if: ${{ !cancelled() && needs.matrix.result == 'success' }} + needs: [matrix, build, build-wheel] runs-on: ${{ matrix.platform == 'windows' && (vars.GH_CI_WINDOWS_RUNNER || 'windows-2022') || matrix.platform == 'macos' && (vars.GH_CI_MACOS_RUNNER || 'macos-26-intel') || (vars.GH_CI_RUNNER || 'ubuntu-latest') }} timeout-minutes: 45 strategy: @@ -155,9 +155,7 @@ jobs: test-wheel: name: Test ${{ matrix.name }} Wheels Python ${{ matrix.python }} - needs: [matrix, build-wheel] - # Test every package that built, even when another build failed - if: ${{ !cancelled() && needs.matrix.result == 'success' }} + needs: [matrix, build, build-wheel] runs-on: ${{ matrix.platform == 'windows' && (vars.GH_CI_WINDOWS_RUNNER || 'windows-2022') || matrix.platform == 'macos' && (vars.GH_CI_MACOS_RUNNER || 'macos-26-intel') || (vars.GH_CI_RUNNER || 'ubuntu-latest') }} timeout-minutes: 45 strategy: diff --git a/ci/README.md b/ci/README.md index e342789..1386a6e 100644 --- a/ci/README.md +++ b/ci/README.md @@ -7,7 +7,7 @@ | `../conda-recipe/` | The conda recipe. `conda_build_config.yaml` lists the Python versions. The recipe builds on Linux, Windows and Intel macOS unless a platform-only skip in `meta.yaml`, such as `skip: true # [win]`, rules one out. | | `../pyproject.toml` | What the wheels are built from. Its Python classifiers list the wheels' Python versions, and its Operating System classifiers their platforms. `[tool.cibuildwheel]` holds the wheel build settings, and `[tool.gh-ci]` holds the run-time requirements the wheels need on top of `[project]`'s, which the conda packages get from the recipe: `pin-compatible` requires at least the `mkl-devel` version the build used, below its next major. | | `../.github/workflows/intel-ci.yml` | One job reads both matrices. One job per platform and Python version builds and uploads `mkl-service Python `, and one builds `mkl-service Wheels Python `. Then one job per package tests it. | -| `matrix.py` | Reads the platforms and Python versions from the recipe, or with `--system wheel` from `pyproject.toml`. A pull request gets the oldest and the newest regular versions and the newest free-threaded one. | +| `matrix.py` | Reads the platforms and Python versions from the recipe, or with `--system wheel` from `pyproject.toml`. Only a tag gets every version: a pull request or a push gets the oldest and the newest regular versions and the newest free-threaded one. | | `build.py` | Builds one Python version: with conda-build, which runs the recipe's own tests, or with `--system wheel` with cibuildwheel, in a manylinux container on Linux. The ELF files in a wheel keep only their `$ORIGIN` RPATH and RUNPATH entries, and must have full RELRO. | | `hooks.py` | The workflow's test jobs: installs one package into a clean environment with the requirements in `config.yml`, and runs `test.py`. A conda package's environment comes from conda-forge; a wheel goes into a venv made from conda-forge's Python, with everything else from PyPI. | | `config.yml` | Names the workflow that builds the packages, its artifact names, and what the tests need. | @@ -15,15 +15,15 @@ The scripts need nothing beyond the Python standard library and the tools each one's docstring names. macOS packages build and test on Intel runners, as MKL has no Apple silicon build. -**A pull request.** Actions builds the oldest and the newest regular Python versions and the newest free-threaded one on Linux, Windows and macOS, as a conda package and, where `pyproject.toml` declares the platform, as a wheel, and tests each package. +**A pull request or a push to `master`.** Actions builds the oldest and the newest regular Python versions and the newest free-threaded one on Linux, Windows and macOS, as a conda package and, where `pyproject.toml` declares the platform, as a wheel, and tests each package. -**A push to `master` or a tag.** Actions builds and tests every declared version. +**A tag.** Actions builds and tests every declared version. To support another Python, add it to `conda-recipe/conda_build_config.yaml` for the conda packages and as a classifier in `pyproject.toml` for the wheels; nothing else lists versions. Try it locally from a conda base environment with conda-build, or with cibuildwheel for wheels: ```bash python ci/matrix.py # every platform and Python version -python ci/matrix.py --event pull_request # what a pull request builds +python ci/matrix.py --event pr # what a pull request or a push builds python ci/build.py --python VERSION --output /tmp/out # VERSION: one matrix.py lists python ci/hooks.py --python VERSION --artifacts /tmp/out --work /tmp/hooks python ci/build.py --system wheel --python VERSION --output /tmp/wheels diff --git a/ci/matrix.py b/ci/matrix.py index 3326d65..76fad67 100644 --- a/ci/matrix.py +++ b/ci/matrix.py @@ -37,10 +37,11 @@ Prints the build matrix as JSON for strategy.matrix: {"include": [{"platform": "linux", "name": "Linux", "python": "3.14"}, ...]}, every platform with every -Python version. For a pull_request event only the oldest and the newest regular -versions and the newest free-threaded one are listed. --github-output also -writes NAME= to $GITHUB_OUTPUT, for later jobs. Standard library only; -reading pyproject.toml needs Python 3.11 or newer for tomllib. +Python version. Only a tag builds them all: for --event pr or push only the +oldest and the newest regular versions and the newest free-threaded one are +listed. --github-output also writes NAME= to $GITHUB_OUTPUT, for later +jobs. Standard library only; reading pyproject.toml needs Python 3.11 or newer +for tomllib. """ import argparse @@ -145,7 +146,8 @@ "Operating System :: MacOS": ("macos",), } -PULL_REQUEST_EVENTS = ("pull_request",) +# Events that build only some of the declared Python versions +SUBSET_EVENTS = ("pr", "push") OLDEST_MINOR = 10 FREE_THREADED_MINOR = 13 # A Free Threading classifier adds 3.Nt from 3.14, the first supported one, @@ -592,10 +594,10 @@ def declared_platforms(system: str, selector: Path) -> list[str]: def for_event(pythons: list[Python], event: str) -> list[Python]: """ - All of them, or for a pull request the oldest and newest regular ones and - the newest free-threaded one. + All of them for a tag; for a pull request or a push the oldest and newest + regular ones and the newest free-threaded one. """ - if event not in PULL_REQUEST_EVENTS: + if event not in SUBSET_EVENTS: return pythons regular = [python for python in pythons if not python.version.endswith("t")] threaded = [python for python in pythons if python.version.endswith("t")] @@ -650,7 +652,10 @@ def main(argv: list[str] | None = None) -> int: help="build system to read instead of the detected one", ) parser.add_argument( - "--event", default="", help="GitHub event name, such as pull_request" + "--event", + default="tag", + choices=("pr", "tag", "push"), + help="what the build is for; only a tag builds every version", ) parser.add_argument( "--github-output",