@@ -17,27 +17,53 @@ concurrency:
1717 cancel-in-progress : true
1818
1919jobs :
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/cibuildwheel@v2.11.4
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/gh-action-pypi-publish@v1.6.4
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/gh-action-pypi-publish@v1.5.0
91+ with :
92+ user : __token__
93+ password : ${{ secrets.pypi_password }}
0 commit comments