Skip to content

Commit 4da56ec

Browse files
authored
Fix release pipeline (#183)
* initial cibuildwheel setup * Update pyproject.toml * Updated test-command * Enable most builds * Skip builds for 32-bit OS * Updated upload_pypi action
1 parent f817f33 commit 4da56ec

File tree

2 files changed

+68
-38
lines changed

2 files changed

+68
-38
lines changed

.github/workflows/pypi.yml

+52-37
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,53 @@ concurrency:
1717
cancel-in-progress: true
1818

1919
jobs:
20-
# The job to build pypi wheels users can installed precompiled for them.
21-
# At the moment only linux wheels are build, Windows and MacOS will compile on installation
22-
# Before prebuilds all users had to compile code anyway.
23-
build:
20+
# The job to build precompiled pypi wheels.
21+
make_sdist:
22+
name: Make SDist
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v3
26+
with:
27+
submodules: true
28+
29+
- name: Build SDist
30+
run: pipx run build --sdist
31+
32+
- uses: actions/upload-artifact@v3
33+
with:
34+
path: dist/*.tar.gz
35+
36+
build_wheels:
37+
name: Build ${{ matrix.python-version }} wheels on ${{ matrix.platform }}
38+
runs-on: ${{ matrix.platform }}
2439
strategy:
2540
matrix:
26-
python-version: ["3.7", "3.8", "3.9", "3.10"]
27-
name: Build source distribution
28-
runs-on: ubuntu-latest
41+
platform:
42+
- macos-12
43+
- windows-2022
44+
- ubuntu-20.04
2945
steps:
3046
- uses: actions/checkout@v3
3147
with:
3248
fetch-depth: 0
33-
- uses: actions/setup-python@v4
49+
50+
- name: Build wheels
51+
uses: pypa/[email protected]
52+
53+
- uses: actions/upload-artifact@v3
3454
with:
35-
python-version: ${{ matrix.python-version }}
36-
- name: Build the sdist and the wheel
37-
run: |
38-
pip install build
39-
python -m build
40-
- name: Check the sdist installs and imports
55+
path: ./wheelhouse/*.whl
56+
57+
check_dist:
58+
name: Check dist
59+
needs: [make_sdist,build_wheels]
60+
runs-on: ubuntu-22.04
61+
steps:
62+
- uses: actions/download-artifact@v3
63+
with:
64+
name: artifact
65+
path: dist
66+
- name: Check SDist
4167
run: |
4268
mkdir -p test-sdist
4369
cd test-sdist
@@ -47,32 +73,21 @@ jobs:
4773
venv-sdist/bin/python -c "import pytensor;print(pytensor.__version__)"
4874
# check import cython module
4975
venv-sdist/bin/python -c 'from pytensor.scan import scan_perform; print(scan_perform.get_version())'
50-
- name: Check the bdist installs and imports
51-
run: |
52-
mkdir -p test-bdist
53-
cd test-bdist
54-
python -m venv venv-bdist
55-
venv-bdist/bin/python -m pip install ../dist/pytensor-*.whl
56-
# check import
57-
venv-bdist/bin/python -c "import pytensor;print(pytensor.__version__)"
58-
# check import cython module
59-
venv-bdist/bin/python -c 'from pytensor.scan import scan_perform; print(scan_perform.get_version())'
60-
- uses: actions/upload-artifact@v3
61-
with:
62-
name: artifact
63-
path: dist/*
76+
77+
- run: pipx run twine check --strict dist/*
6478

6579
upload_pypi:
6680
name: Upload to PyPI on release
67-
needs: [build]
81+
needs: [check_dist]
6882
runs-on: ubuntu-latest
6983
if: github.event_name == 'release' && github.event.action == 'published'
7084
steps:
71-
- uses: actions/download-artifact@v3
72-
with:
73-
name: artifact
74-
path: dist
75-
- uses: pypa/[email protected]
76-
with:
77-
user: __token__
78-
password: ${{ secrets.pypi_secret }}
85+
- uses: actions/download-artifact@v3
86+
with:
87+
name: artifact
88+
path: dist
89+
90+
- uses: pypa/[email protected]
91+
with:
92+
user: __token__
93+
password: ${{ secrets.pypi_password }}

pyproject.toml

+16-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ authors = [
1818
]
1919
description = "Optimizing compiler for evaluating mathematical expressions on CPUs and GPUs."
2020
readme = "README.rst"
21-
license = {file = "LICENCE.txt"}
21+
license = {file = "LICENSE.txt"}
2222
classifiers = [
2323
"Development Status :: 6 - Mature",
2424
"Intended Audience :: Education",
@@ -206,3 +206,18 @@ show_error_codes = true
206206
allow_redefinition = false
207207
files = ["pytensor", "tests"]
208208
plugins = ["numpy.typing.mypy_plugin"]
209+
210+
[tool.cibuildwheel]
211+
build = "*"
212+
# Uncomment to skip builds that compile but fail when trying to test (maybe due to incompatibility with runner)
213+
# archs = ["auto64"]
214+
# Disable any-platform (pp*), and 32-bit builds.
215+
# Additional options to consider: "*musllinux*"
216+
skip = ["pp*", "*-win32", "*-manylinux_i686"]
217+
build-frontend = "build"
218+
test-command = 'python -c "import pytensor; print(pytensor.__version__); from pytensor.scan import scan_perform; print(scan_perform.get_version())"'
219+
test-skip = ["cp37*", "*musllinux*", "*win32*", "*i686*"]
220+
221+
# Testing seems to be running into issues locating libs where expected
222+
# test-requires = ["pytest", "numba", "jax", "jaxlib"]
223+
# test-command = "pytest {package}/tests"

0 commit comments

Comments
 (0)