Skip to content

Commit

Permalink
Merge pull request #392 from pmorissette/tkp/cibw
Browse files Browse the repository at this point in the history
switch base test environment to 3.11, bump minimum cython version to account for 3.11 changes, use cibuildwheel for wheel creation
  • Loading branch information
timkpaine authored Jun 24, 2024
2 parents 9088f9a + 4363268 commit 43983f6
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 18 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.9, 3.12]
python-version: [3.11]

steps:
- uses: actions/checkout@v4
Expand All @@ -46,3 +46,19 @@ jobs:

- name: Package and check
run: make dist

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.11.2

- name: Build wheels
run: python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: "cp311-*"

- name: Check Wheels
run: twine check dist/*

- uses: actions/upload-artifact@v4
with:
path: ./dist/*.whl
name: wheel-test-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}
147 changes: 133 additions & 14 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
tags:
- 'v*'
workflow_dispatch:

jobs:
build:
Expand All @@ -12,11 +13,68 @@ jobs:

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.8, 3.9, '3.10', 3.11, 3.12]
os:
- ubuntu-22.04
- macos-12
- windows-2019
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
cibuildwheel:
- "cp38"
- "cp39"
- "cp310"
- "cp311"
- "cp312"
exclude:
- python-version: "3.8"
cibuildwheel: "cp39"
- python-version: "3.8"
cibuildwheel: "cp310"
- python-version: "3.8"
cibuildwheel: "cp311"
- python-version: "3.8"
cibuildwheel: "cp312"
- python-version: "3.9"
cibuildwheel: "cp38"
- python-version: "3.9"
cibuildwheel: "cp310"
- python-version: "3.9"
cibuildwheel: "cp311"
- python-version: "3.9"
cibuildwheel: "cp312"
- python-version: "3.10"
cibuildwheel: "cp38"
- python-version: "3.10"
cibuildwheel: "cp39"
- python-version: "3.10"
cibuildwheel: "cp311"
- python-version: "3.10"
cibuildwheel: "cp312"
- python-version: "3.11"
cibuildwheel: "cp38"
- python-version: "3.11"
cibuildwheel: "cp39"
- python-version: "3.11"
cibuildwheel: "cp310"
- python-version: "3.11"
cibuildwheel: "cp312"
- python-version: "3.12"
cibuildwheel: "cp38"
- python-version: "3.12"
cibuildwheel: "cp39"
- python-version: "3.12"
cibuildwheel: "cp310"
- python-version: "3.12"
cibuildwheel: "cp311"

steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand All @@ -27,18 +85,79 @@ jobs:
make develop
python -m pip install -U wheel twine setuptools
- name: Lint
run: make lint
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.11.2

- name: Test
run: make test
- name: Python Wheel Steps (Linux - cibuildwheel)
run: python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: "${{ matrix.cibuildwheel }}-manylinux*"
CIBW_BUILD_VERBOSITY: 3
if: ${{ runner.os == 'Linux' }}

- name: Package and check
run: make dist
- name: Python Build Steps (Macos x86)
run: python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: "${{ matrix.cibuildwheel }}-macos*"
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_BUILD_VERBOSITY: 3
if: ${{ matrix.os == 'macos-12' }}

- name: Publish distribution 📦 to PyPI
if: ${{ startsWith(github.ref, 'refs/tags') && matrix.os != 'ubuntu-latest' }}
- name: Python Build Steps (Windows 2019)
run: python -m cibuildwheel --output-dir dist
env:
TWINE_USERNAME: ${{ secrets.PYPI_UN }}
TWINE_PASSWORD: ${{ secrets.PYPI_PW }}
run: make upload
CIBW_BUILD: "${{ matrix.cibuildwheel }}-win_amd64"
if: ${{ matrix.os == 'windows-2019' }}

- name: Check Wheels
run: twine check dist/*

- name: Upload Wheel
uses: actions/upload-artifact@v4
with:
name: wheel-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}
path: dist/*.whl

# - name: Publish distribution 📦 to PyPI
# if: ${{ startsWith(github.ref, 'refs/tags') && matrix.os != 'ubuntu-latest' }}
# env:
# TWINE_USERNAME: ${{ secrets.PYPI_UN }}
# TWINE_PASSWORD: ${{ secrets.PYPI_PW }}
# run: make upload
build_sdist:
strategy:
matrix:
os:
- ubuntu-22.04
python-version:
- 3.9

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
make develop
python -m pip install -U wheel twine setuptools
- name: Python SDist Steps
run: python setup.py sdist

- name: Check sdist
run: twine check dist/*.tar.gz

- name: Upload SDist
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fix:
python -m ruff format bt setup.py docs/source/conf.py

dist:
python setup.py sdist bdist_wheel
python setup.py sdist
python -m twine check dist/*

upload: dist
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools", "wheel", "cython>0.25"]
requires = ["setuptools", "wheel", "cython>=0.29.25"]

[tool.ruff]
line-length = 180
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def local_file(filename):
],
extras_require={
"dev": [
"cython>=0.25",
"cython>=0.29.25",
"ffn>=1.0.0",
"matplotlib>=2",
"numpy>=1",
Expand Down

0 comments on commit 43983f6

Please sign in to comment.