Skip to content

Commit

Permalink
Merge branch 'master' into gil-release
Browse files Browse the repository at this point in the history
  • Loading branch information
glichtner authored Oct 20, 2024
2 parents 357c4bc + c7ee8d6 commit d7d7e7e
Show file tree
Hide file tree
Showing 13 changed files with 351 additions and 123 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.2.7
current_version = 0.2.8
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>\S+))?
serialize =
{major}.{minor}.{patch}-{release}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:

steps:
- name: Check out Git repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: 3.9

Expand Down
42 changes: 34 additions & 8 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,53 @@ on:
- main
pull_request:


jobs:
test:
name: test ${{ matrix.python-version }} - ${{ matrix.os }}
name: test py==${{ matrix.python-version }} - numpy==${{ matrix.numpy-version }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
fail-fast: true
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
numpy-version: ["1.26", "2.0"]
include:

- python-version: "3.7"
os: windows-latest
numpy-version: "1.21"

- python-version: "3.7"
os: ubuntu-latest
numpy-version: "1.21"

- python-version: "3.8"
os: windows-latest
numpy-version: "1.24"

- python-version: "3.8"
os: macos-latest
numpy-version: "1.24"

- python-version: "3.8"
os: ubuntu-latest
numpy-version: "1.24"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

- name: Install tox and dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pip setuptools wheel
pip install tox
- name: Test with tox
- name: Run tests with numpy ${{ matrix.numpy-version }}
env:
NUMPY_VERSION: ${{ matrix.numpy-version }} # Pass numpy version to tox
run: |
tox -e py
222 changes: 193 additions & 29 deletions .github/workflows/wheels-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,59 +5,223 @@ on:
tags:
- v*

workflow_dispatch:
inputs:
os_choice:
description: 'Choose what to build'
required: true
default: 'all'
type: choice
options:
- all
- sdist-only
- ubuntu-latest
- windows-latest
- macos-latest

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
build_wheels_ubuntu:
name: Build wheels on ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: Check if build is needed
id: check_build
run: |
if [ "${{ github.event_name }}" = "push" ]; then
echo "build_needed=true" >> $GITHUB_OUTPUT
elif [ "${{ github.event.inputs.os_choice }}" = "all" ] || [ "${{ github.event.inputs.os_choice }}" = "ubuntu-latest" ]; then
echo "build_needed=true" >> $GITHUB_OUTPUT
else
echo "build_needed=false" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@v4
if: ${{ steps.check_build.outputs.build_needed == 'true' }}

- name: Set up Python 3.11
if: ${{ steps.check_build.outputs.build_needed == 'true' }}
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Build wheels
if: ${{ steps.check_build.outputs.build_needed == 'true' }}
uses: pypa/[email protected]
with:
output-dir: ./wheelhouse

- name: Upload wheels
if: ${{ steps.check_build.outputs.build_needed == 'true' }}
uses: actions/upload-artifact@v4
with:
name: wheels-ubuntu-latest
path: ./wheelhouse/*.whl
overwrite: true

build_wheels_windows:
name: Build wheels on windows-latest
runs-on: windows-latest
steps:
- name: Check if build is needed
id: check_build
shell: bash
run: |
if [ "${{ github.event_name }}" = "push" ]; then
echo "build_needed=true" >> $GITHUB_OUTPUT
elif [ "${{ github.event_name }}" = "workflow_dispatch" ] && { [ "${{ github.event.inputs.os_choice }}" = "all" ] || [ "${{ github.event.inputs.os_choice }}" = "windows-latest" ]; }; then
echo "build_needed=true" >> $GITHUB_OUTPUT
else
echo "build_needed=false" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@v4
if: ${{ steps.check_build.outputs.build_needed == 'true' }}

- name: Set up Python 3.11
if: ${{ steps.check_build.outputs.build_needed == 'true' }}
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Build wheels
if: ${{ steps.check_build.outputs.build_needed == 'true' }}
uses: pypa/[email protected]
with:
output-dir: ./wheelhouse

- name: Upload wheels
if: ${{ steps.check_build.outputs.build_needed == 'true' }}
uses: actions/upload-artifact@v4
with:
name: wheels-windows-latest
path: ./wheelhouse/*.whl
overwrite: true

build_wheels_macos:
name: Build wheels on macos-latest
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Check if build is needed
id: check_build
shell: bash
run: |
if [ "${{ github.event_name }}" = "push" ]; then
echo "build_needed=true" >> $GITHUB_OUTPUT
elif [ "${{ github.event.inputs.os_choice }}" = "all" ] || [ "${{ github.event.inputs.os_choice }}" = "macos-latest" ]; then
echo "build_needed=true" >> $GITHUB_OUTPUT
else
echo "build_needed=false" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@v4
if: ${{ steps.check_build.outputs.build_needed == 'true' }}

- name: Set up Python 3.11
if: ${{ steps.check_build.outputs.build_needed == 'true' }}
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Build wheels
uses: pypa/[email protected]
if: ${{ steps.check_build.outputs.build_needed == 'true' }}
uses: pypa/[email protected]
with:
output-dir: ./wheelhouse

- uses: actions/upload-artifact@v3
- name: Upload wheels
if: ${{ steps.check_build.outputs.build_needed == 'true' }}
uses: actions/upload-artifact@v4
with:
name: wheels-macos-latest
path: ./wheelhouse/*.whl
overwrite: true

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check if build is needed
id: check_build
run: |
if [ "${{ github.event_name }}" = "push" ]; then
echo "build_needed=true" >> $GITHUB_OUTPUT
elif [ "${{ github.event.inputs.os_choice }}" = "all" ] || [ "${{ github.event.inputs.os_choice }}" = "sdist-only" ]; then
echo "build_needed=true" >> $GITHUB_OUTPUT
else
echo "build_needed=false" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@v4
if: ${{ steps.check_build.outputs.build_needed == 'true' }}

- name: Set up Python 3.11
if: ${{ steps.check_build.outputs.build_needed == 'true' }}
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Install build dependencies
if: ${{ steps.check_build.outputs.build_needed == 'true' }}
run: python -m pip install --upgrade pip build

- name: Build sdist
run: pipx run build --sdist
if: ${{ steps.check_build.outputs.build_needed == 'true' }}
run: python -m build --sdist

- uses: actions/upload-artifact@v3
- name: Upload sdist
if: ${{ steps.check_build.outputs.build_needed == 'true' }}
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
overwrite: true

upload_pypi:
needs: [build_wheels, build_sdist]
name: Upload to PyPI
needs:
- build_wheels_ubuntu
- build_wheels_windows
- build_wheels_macos
- build_sdist
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
# if: github.event_name == 'release' && github.event.action == 'published'
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
steps:
- uses: actions/download-artifact@v3
- name: Download Ubuntu wheels
uses: actions/download-artifact@v4
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
path: dist
name: wheels-ubuntu-latest
path: dist/
continue-on-error: true

- uses: ncipollo/release-action@v1
- name: Download Windows wheels
uses: actions/download-artifact@v4
with:
artifacts: "dist/*.whl,dist/*.tar.gz"
token: ${{ secrets.GITHUB_TOKEN }}
name: wheels-windows-latest
path: dist/
continue-on-error: true

- uses: pypa/[email protected]
- name: Download macOS wheels
uses: actions/download-artifact@v4
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
name: wheels-macos-latest
path: dist/
continue-on-error: true

- name: Download sdist
uses: actions/download-artifact@v4
with:
name: sdist
path: dist/
continue-on-error: true

- name: List artifacts (debug)
run: ls dist || echo "No artifacts found."

- name: Upload to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
pip install twine
twine upload dist/*
18 changes: 12 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
exclude: '^docs/'
repos:
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
args: ["--profile", "black", "--filter-files"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
exclude: '^.bumpversion.cfg$'
Expand All @@ -10,19 +16,19 @@ repos:
- id: pretty-format-json
args: ['--autofix', '--no-sort-keys']
- repo: https://github.com/ambv/black
rev: 23.7.0
rev: 24.8.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: '6.1.0'
rev: '7.1.1'
hooks:
- id: flake8
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.4.1
rev: v1.11.2
hooks:
- id: mypy
- repo: https://github.com/codespell-project/codespell
rev: 'v2.2.5'
rev: 'v2.3.0'
hooks:
- id: codespell
name: codespell
Expand Down
Loading

0 comments on commit d7d7e7e

Please sign in to comment.