Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
161 changes: 133 additions & 28 deletions .github/workflows/test_python.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,135 @@
name: Test Python
on: [push, pull_request]
name: Python

on: # yamllint disable-line rule:truthy
push:
pull_request:
workflow_call:
workflow_dispatch:

jobs:
test:
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
runner:
- ubuntu-latest
- macos-latest
python-version:
- "3.10"
- "3.x"
steps:

- uses: actions/checkout@v6
with:
submodules: recursive

- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install package for testing
run: python -m pip install ".[test]"

- name: Run tests
run: pytest

sdist:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v6

- uses: actions/setup-python@v6
with:
python-version: 3
pip-install: build twine

- name: Build sdist
run: python -m build --sdist

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

- name: Upload sdist
uses: actions/upload-artifact@v5
with:
name: sdist
path: dist/*.tar.gz
retention-days: 1

wheel:
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
runner:
- ubuntu-24.04
- ubuntu-24.04-arm
- macos-15
- macos-15-intel
python:
- "cp310"
- "cp311"
- "cp312"
env:
pysabi: ${{ matrix.python == 'cp312' && matrix.python || '' }}
steps:

- name: Checkout
uses: actions/checkout@v6

- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: 3
pip-install: abi3audit

- name: Setup environment
run: |
# Reproducible Builds
echo SOURCE_DATE_EPOCH=$(git log -1 --pretty=%at) >> $GITHUB_ENV
if [ ${{ runner.os }} = macOS ]; then
echo ZERO_AR_DATE=YES >> $GITHUB_ENV; fi
# macOS Deployment Target
if [ ${{ runner.os }}-${{ runner.arch }} = macOS-X64 ]; then
echo MACOSX_DEPLOYMENT_TARGET=10.13 >> $GITHUB_ENV; fi

- name: Build wheel
uses: pypa/cibuildwheel@v3.3.0
with:
extras: uv
output-dir: dist
env:
CIBW_BUILD: "${{ matrix.python }}-*"
CIBW_SKIP: "*musllinux*"
CIBW_BUILD_FRONTEND: "build[uv]"
CIBW_ENVIRONMENT: >-
SKBUILD_WHEEL_PY_API=${{ env.pysabi }}

- name: Check wheel
run: python -m abi3audit -Ss dist/*.whl
if: ${{ env.pysabi != '' }}

- name: Upload wheel
uses: actions/upload-artifact@v5
with:
name: wheel-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python }}
path: dist/*.whl
retention-days: 1

test:
needs: [wheel]
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
runner:
- ubuntu-24.04
- ubuntu-24.04-arm
- macos-15
- macos-15-intel
python:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
- "3.x"
steps:

- name: Checkout
uses: actions/checkout@v6

- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}
pip-install: pytest

- name: Download wheel
uses: actions/download-artifact@v6
with:
path: dist
pattern: wheel-${{ runner.os }}-${{ runner.arch }}-*
merge-multiple: true

- name: Install wheel
run: python -m pip install mutationpp --find-links=dist

- name: Test wheel
run: pytest
215 changes: 65 additions & 150 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -1,157 +1,72 @@
name: Python wheels
on:

on: # yamllint disable-line rule:truthy
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
publish-pypi:
description: 'Publish to PyPI'
required: false
type: boolean
default: false

jobs:
test_linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- uses: actions/setup-python@v6
with:
python-version: "3.x"

- name: Install package for testing
run: python -m pip install ".[test]"

- name: Run tests
run: pytest

test_mac:
runs-on: macos-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- uses: actions/setup-python@v6
with:
python-version: "3.x"

- name: Install package for testing
run: python -m pip install ".[test]"

- name: Run tests
run: pytest

linux_wheels:
strategy:
matrix:
python-version:
- cp310-cp310
- cp311-cp311
- cp312-cp312
- cp313-cp313
- cp314-cp314

needs: test_linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- uses: actions/setup-python@v6
with:
python-version: 3.14

- name: Build manylinux Python wheels
uses: RalfG/python-wheels-manylinux-build@v0.3.4-manylinux2010_x86_64
with:
python-versions: ${{ matrix.python-version }}

- uses: actions/upload-artifact@v2
with:
name: linux_wheels
path: "dist/*-manylinux*.whl"
retention-days: 1

mac_wheels:
strategy:
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
needs: test_mac
runs-on: macos-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install build
run: python -m pip install build

- name: Build wheel
run: python -m build --whell

- uses: actions/upload-artifact@v2
with:
name: mac_wheels
path: "dist/*.whl"
retention-days: 1

sdist:
needs: test_linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- uses: actions/setup-python@v6
with:
python-version: "3.x"

- name: Install build
run: python -m pip install build

- name: Build sdist
run: python -m build --sdist

- uses: actions/upload-artifact@v2
with:
name: sdist
path: "dist/*.tar.gz"
retention-days: 1

upload_wheels:
runs-on: ubuntu-latest
needs: [linux_wheels, mac_wheels]
steps:
- uses: actions/download-artifact@v2
with:
name: linux_wheels
path: dist

- uses: actions/download-artifact@v2
with:
name: mac_wheels
path: dist

- uses: actions/download-artifact@v2
with:
name: sdist
path: dist

- uses: actions/setup-python@v6
with:
python-version: "3.x"

- name: Install twine
run: python -m pip install twine

- name: Upload wheels
run: twine upload -u __token__ -p "${{ secrets.TESTPYPI_TOKEN }}" --repository testpypi dist/*
build:
uses: ./.github/workflows/test_python.yml

publish-pypi:
# TODO: create GitHub environment
# environment:
# name: pypi
# url: https://pypi.org/project/mutationpp
needs: [build]
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
attestations: write
steps:

- name: Download sdist artifact
uses: actions/download-artifact@v6
with:
path: dist
pattern: sdist
merge-multiple: true

- name: Download wheel artifacts
uses: actions/download-artifact@v6
with:
path: dist
pattern: wheel-*
merge-multiple: true

- name: Checksum artifacts
run: |
sha256sum -b *
echo '```' >> "$GITHUB_STEP_SUMMARY"
sha256sum -b * >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
working-directory: dist

- if: |
inputs.publish-pypi ||
github.ref_type == 'tag'
name: Attest artifacts
uses: actions/attest-build-provenance@v3
with:
subject-path: dist/*

- if: |
inputs.publish-pypi ||
github.ref_type == 'tag'
name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
# TODO: remove next line to use the main PyPI index
repository-url: https://test.pypi.org/legacy/
# TODO: setup Trusted Publising on PyPI, then remove next line
password: ${{ secrets.TESTPYPI_TOKEN }}
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if (BUILD_FORTRAN_WRAPPER)
endif()

#######################################################################
# Python bindings built with scikit-build-core + pybind11 #
# Python bindings built with scikit-build-core + nanobind #
#######################################################################

if (SKBUILD)
Expand Down
Loading