Use manylinux_2_28 for Linux wheel builds #16
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
| # Build the tfce Python package for every platform. | |
| # | |
| # The point of the compiled core is that it is 14x faster than a stepped TFCE on | |
| # one map, and 72x on a block of permutations. That is worth nothing if users have | |
| # to have a C compiler, so wheels are built here for Linux, macOS and Windows and | |
| # nobody ever compiles anything. | |
| # | |
| # The C core is shared with the MATLAB toolbox and lives at the repository root; | |
| # python/setup.py vendors it into the package at build time, which is why this | |
| # checks out the whole repository rather than just python/. | |
| # | |
| # Publishing is NOT done here. `Publish Python Package` (publish-pypi.yml) calls | |
| # this workflow and uploads what comes out, so there is exactly one path to PyPI | |
| # and it is a deliberate, manual one. | |
| name: Python wheels | |
| on: | |
| push: | |
| branches: [master, main] | |
| paths: | |
| - "python/**" | |
| - "c/**" | |
| - ".github/workflows/python_wheels.yml" | |
| pull_request: | |
| paths: | |
| - "python/**" | |
| - "c/**" | |
| workflow_dispatch: | |
| workflow_call: | |
| jobs: | |
| wheels: | |
| name: ${{ matrix.os }} (${{ matrix.cibw-archs }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # One runner per architecture, each building only what it natively is. | |
| # Nothing is cross-compiled and nothing is emulated: aarch64 Linux is a | |
| # real arm64 runner, not QEMU, which is the difference between a job that | |
| # takes minutes and one that takes hours. | |
| include: | |
| - os: ubuntu-22.04 | |
| cibw-archs: x86_64 | |
| artifact: wheels-linux-x86_64 | |
| - os: ubuntu-22.04-arm | |
| cibw-archs: aarch64 | |
| artifact: wheels-linux-aarch64 | |
| # macos-26 is what macos-latest points to. macos-26-intel is the same OS | |
| # on x86_64: GitHub retired macos-13 in December 2025, and Intel macOS | |
| # is itself scheduled to disappear from Actions after macOS 15/26, so | |
| # this entry has a shelf life. | |
| - os: macos-26 | |
| cibw-archs: arm64 | |
| artifact: wheels-macos-arm64 | |
| - os: macos-26-intel | |
| cibw-archs: x86_64 | |
| artifact: wheels-macos-x86_64 | |
| - os: windows-latest | |
| cibw-archs: AMD64 | |
| artifact: wheels-windows-amd64 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install cibuildwheel | |
| run: pip install cibuildwheel==2.23.3 | |
| # Run from the repository root, with python/ as the argument -- NOT from | |
| # inside python/. On Linux cibuildwheel copies its working directory into | |
| # the container, and setup.py vendors the core from ../c: build from python/ | |
| # and the core is outside the copy and the build fails. This is also why | |
| # pyproject's test-command says {package}/tests and not {project}/tests -- | |
| # {project} is this directory, {package} is python/. | |
| - name: Build wheels | |
| env: | |
| CIBW_ARCHS: ${{ matrix.cibw-archs }} | |
| run: cibuildwheel python --output-dir wheelhouse | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: wheelhouse/*.whl | |
| sdist: | |
| name: sdist | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - run: pipx run build --sdist | |
| working-directory: python | |
| # An sdist that cannot build is worse than no sdist: it turns | |
| # `pip install tfce` into a compile error on any platform without a wheel. | |
| # So it is built from source here, in a directory with no repository in | |
| # sight, and the tests are run against what comes out. | |
| - name: Install the sdist from source and test it | |
| run: | | |
| python -m venv /tmp/fresh | |
| /tmp/fresh/bin/pip install --upgrade pip pytest | |
| /tmp/fresh/bin/pip install python/dist/*.tar.gz | |
| cp -r python/tests /tmp/tests | |
| cd /tmp && /tmp/fresh/bin/python -m pytest /tmp/tests -q \ | |
| --ignore=/tmp/tests/test_nilearn_compat.py | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: sdist | |
| path: python/dist/*.tar.gz | |
| # Everything publishable in one artifact, so the publish workflow has a single | |
| # thing to download and PyPI gets the sdist alongside the wheels. | |
| merge: | |
| name: merge artifacts | |
| needs: [wheels, sdist] | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Download wheels | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: wheels-* | |
| merge-multiple: true | |
| path: dist/ | |
| - name: Download sdist | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: sdist | |
| path: dist/ | |
| - name: List what will be published | |
| run: ls -lh dist/ | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: all-wheels | |
| path: dist/ | |
| retention-days: 30 |