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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
83 changes: 81 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,82 @@ 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-latest', 'windows-latest']
python:
- ['conda', '2.7']
- ['native', '3']
package: ['sdist', 'wheel']

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:
python-version: ${{ matrix.python[1] }}
if: matrix.python[0] == 'conda'

- 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 @@ -32,7 +24,3 @@ push = false
"gradunwarp/core/globals.py" = [
"^VERSION = '{version}'"
]

[tool.cibuildwheel]
# Do not bother building pypy wheels
skip = "pp*"
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