Skip to content
Closed
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
72 changes: 72 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Wheels

# Wheels are checked on pull requests and published when a GitHub release is published,
# under the release's tag, such as 2.0.0.
on:
pull_request:
release:
types: [published]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
sdist:
name: Source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- run: pipx run build --sdist
- uses: actions/upload-artifact@v7
with:
name: dist-sdist
path: dist/*.tar.gz

wheels:
name: Wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
# Builds every CPython cibuildwheel supports, free-threaded included, and runs
# the tests in pyproject.toml's [tool.cibuildwheel] against each wheel.
- uses: pypa/cibuildwheel@v4.3.0
env:
CIBW_ARCHS_WINDOWS: AMD64 # 64-bit only, as CI covers
- uses: actions/upload-artifact@v7
with:
name: dist-wheels-${{ matrix.os }}
path: wheelhouse/*.whl

publish:
name: Publish to PyPI
if: github.event_name == 'release' && github.repository == 'artem-ogre/PythonCDT' # a fork's release builds the wheels but never publishes
needs: [sdist, wheels]
runs-on: ubuntu-latest
# PyPI trusted publishing: no token is stored, PyPI trusts this workflow in this repository.
environment:
name: pypi
url: https://pypi.org/p/PythonCDT
permissions:
id-token: write
attestations: write
contents: read
steps:
- uses: actions/download-artifact@v8
with:
pattern: dist-*
path: dist
merge-multiple: true
- uses: actions/attest-build-provenance@v4
with:
subject-path: dist/*
- uses: pypa/gh-action-pypi-publish@release/v1
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ filterwarnings = ["error"]
testpaths = ["cdt_bindings_test.py"]

[tool.cibuildwheel]
test-command = "pytest {project}/cdt_bindings_test.py"
test-command = "pytest cdt_bindings_test.py"
test-sources = ["cdt_bindings_test.py", "CDT/visualizer/data"] # the tests read input files by paths relative to the project
test-extras = ["test"]
test-requires = ["numpy"] # the tests import numpy; the test extra holds only pytest
test-skip = ["*universal2:arm64"]
# Setuptools bug causes collision between pypy and cpython artifacts
before-build = "rm -rf {project}/build"
Loading