Skip to content
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

MNT: Create and test universal wheels #17

Merged
merged 9 commits into from
Dec 23, 2024
88 changes: 86 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test suite
name: Build, test, deploy

on:
push:
Expand All @@ -18,9 +18,9 @@ defaults:
run:
shell: bash -el {0}

# Commented sections to be uncommented once CI is active
jobs:
test:
name: Test repo install
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -68,3 +68,87 @@ jobs:
- name: Test
run: pytest --pyargs gradunwarp --cov gradunwarp
working-directory: /tmp

build:
name: Build packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build sdist and wheel
run: pipx run build
- name: Check packages
run: pipx run twine check dist/*
- uses: actions/upload-artifact@v4
with:
name: dist
path: ./dist/*

test-dist:
name: Test package install
needs: [build]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-13', 'macos-latest', 'windows-latest']
python:
- ['conda', '2.7']
- ['native', '3']
package: ['sdist', 'wheel']
exclude:
# macos-latest is now exclusively aarch64, and there's no Python 2 package
- os: macos-latest
python: ['conda', '2.7']

steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: ./dist

- name: Set up Python ${{ matrix.python[1] }} (native)
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python[1] }}
allow-prereleases: true
if: matrix.python[0] == 'native'
- name: Set up Python ${{ matrix.python[1] }} (miniconda)
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-version: latest
python-version: ${{ matrix.python[1] }}
effigies marked this conversation as resolved.
Show resolved Hide resolved
if: matrix.python[0] == 'conda'
effigies marked this conversation as resolved.
Show resolved Hide resolved

- name: Install sdist
run: pip install dist/*.tar.gz
if: matrix.package == 'sdist'
- name: Install wheel
run: pip install dist/*.whl
if: matrix.package == 'wheel'

- name: Check gradunwarp version
shell: bash -el -c python {0}
run: |
from gradunwarp.core.globals import VERSION
print(VERSION)

- name: Install pytest
run: pip install pytest
- name: Run tests
run: pytest -v --pyargs gradunwarp

publish:
name: Upload to PyPI
runs-on: ubuntu-latest
environment: "Package deployment"
needs: [test, test-dist]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
150 changes: 0 additions & 150 deletions .github/workflows/wheels.yml

This file was deleted.

14 changes: 1 addition & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
[build-system]
requires = [
"setuptools",
# Numpy 1.25 allows back-compiling and supports 3.9
"numpy>=1.25; python_version >= '3.9'",
# Last version to support 3.6-3.8
"numpy==1.19; python_version > '3.0' and python_version < '3.9'",
# Last version to support 2.7
"numpy==1.16; python_version < '3.0'",
]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.bumpver]
Expand All @@ -33,9 +25,5 @@ push = false
"^VERSION = '{version}'"
]

[tool.cibuildwheel]
# Do not bother building pypy wheels
skip = "pp*"

[tool.ruff.extend-per-file-ignores]
"*/__init__.py" = ["F401"]
6 changes: 4 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ packages = find:
install_requires =
nibabel >= 3.2.1; python_version >= '3.0'
nibabel >= 2.0; python_version < '3.0'
numpy>=1.26.0b1; python_version > '3.11'
numpy; python_version <= '3.11'
numpy
scipy

[options.package_data]
gradunwarp.core.tests = data/*

[bdist_wheel]
universal = 1
Loading