@@ -3,243 +3,110 @@ name: Build Wheels
33on :
44 push :
55 branches :
6- - main
6+ - quaddtype-packaging
77 tags :
8- - " v* "
8+ - ' v* '
99 pull_request :
1010
1111jobs :
12- build_wheels_linux :
13- name : Build wheels on Linux
14- runs-on : ubuntu-latest
15- steps :
16- - uses : actions/checkout@v3
17-
18- - name : Set up Python
19- uses : actions/setup-python@v4
20- with :
21- python-version : " >=3.10.0"
22-
23- - name : Install cibuildwheel
24- run : pip install cibuildwheel==2.20.0
25-
26- - name : Build wheels
27- env :
28- CIBW_BUILD : " cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64"
29- CIBW_MANYLINUX_X86_64_IMAGE : manylinux_2_28
30- CIBW_BUILD_VERBOSITY : " 3"
31- CIBW_BEFORE_ALL : |
32- yum install -y wget
33- wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
34- bash miniconda.sh -b -p /root/miniconda
35- export PATH="/root/miniconda/bin:$PATH"
36- conda config --set always_yes yes --set changeps1 no
37- conda update -q conda
38- conda info -a
39- conda config --add channels conda-forge
40- conda config --set channel_priority strict
41- conda create -n build_env python=3.10
42- source activate build_env
43- conda install -y sleef
44- CIBW_ENVIRONMENT : >
45- LD_LIBRARY_PATH="/root/miniconda/envs/build_env/lib:$LD_LIBRARY_PATH"
46- LIBRARY_PATH="/root/miniconda/envs/build_env/lib:$LIBRARY_PATH"
47- CFLAGS="-I/root/miniconda/envs/build_env/include $CFLAGS"
48- CXXFLAGS="-I/root/miniconda/envs/build_env/include $CXXFLAGS"
49- LDFLAGS="-L/root/miniconda/envs/build_env/lib $LDFLAGS"
50- SLEEF_PATH="/root/miniconda/envs/build_env"
51- CIBW_REPAIR_WHEEL_COMMAND : >
52- auditwheel repair -w {dest_dir} --plat manylinux_2_28_x86_64 {wheel}
53- CIBW_TEST_COMMAND : |
54- python -c "import os; print('SLEEF_PATH:', os.environ.get('SLEEF_PATH', 'Not set'))"
55- python -c "import platform; print('Python version:', platform.python_version())"
56- python -c "import sys; print('sys.platform:', sys.platform)"
57- python -c "import quaddtype; print('quaddtype imported successfully')"
58- pip install {package}[test]
59- pytest {project}/tests
60- CIBW_TEST_EXTRAS : " test"
61- run : |
62- python -m cibuildwheel --output-dir wheelhouse
63- working-directory : ./quaddtype
64-
65- - uses : actions/upload-artifact@v3
66- with :
67- path : ./quaddtype/wheelhouse/*.whl
68- name : wheels-linux
69-
70- build_wheels_macos :
12+ build_wheels :
7113 name : Build wheels on ${{ matrix.os }}
7214 runs-on : ${{ matrix.os }}
7315 strategy :
7416 matrix :
75- os : [macos-13, macos-14]
17+ os : [ubuntu-latest, macos-13, macos-14, windows-latest]
18+ include :
19+ - os : ubuntu-latest
20+ cibw_archs : ' x86_64'
21+ - os : macos-13
22+ cibw_archs : ' x86_64'
23+ - os : macos-14
24+ cibw_archs : ' arm64'
25+ - os : windows-latest
26+ cibw_archs : ' AMD64'
7627
7728 steps :
7829 - uses : actions/checkout@v3
7930
8031 - name : Set up Python
8132 uses : actions/setup-python@v4
8233 with :
83- python-version : " >= 3.10.0 "
34+ python-version : ' 3.10'
8435
8536 - name : Setup Miniconda
8637 uses : conda-incubator/setup-miniconda@v3
8738 with :
8839 auto-update-conda : true
89- python-version : " 3.10"
40+ python-version : ' 3.10'
9041 channels : conda-forge
9142
92- - name : Install SLEEF
93- shell : bash -l {0}
94- run : |
95- conda install -y -c conda-forge sleef
96- echo $CONDA_PREFIX
97- echo "SLEEF_PATH=$CONDA_PREFIX" >> $GITHUB_ENV
98-
99- - name : Install cibuildwheel
100- run : pip install cibuildwheel==2.20.0
101-
102- - name : Build wheels
103- env :
104- CIBW_BUILD_VERBOSITY : " 1"
105- CIBW_ARCHS_MACOS : ${{ matrix.os == 'macos-13' && 'x86_64' || 'arm64' }}
106- CIBW_SKIP : " pp* cp36-* cp37-* cp38-* cp39-* cp313-*"
107- CIBW_ENVIRONMENT : >
108- SLEEF_PATH="${{ env.SLEEF_PATH }}"
109- DYLD_LIBRARY_PATH="${{ env.SLEEF_PATH }}/lib:$DYLD_LIBRARY_PATH"
110- LIBRARY_PATH="${{ env.SLEEF_PATH }}/lib:$LIBRARY_PATH"
111- CFLAGS="-I${{ env.SLEEF_PATH }}/include $CFLAGS"
112- CXXFLAGS="-I${{ env.SLEEF_PATH }}/include $CXXFLAGS"
113- LDFLAGS="-L${{ env.SLEEF_PATH }}/lib $LDFLAGS"
114- MACOSX_DEPLOYMENT_TARGET="10.13"
115- CIBW_REPAIR_WHEEL_COMMAND : " delocate-wheel -w {dest_dir} -v {wheel}"
116- CIBW_TEST_COMMAND : |
117- python -c "import os; print('SLEEF_PATH:', os.environ.get('SLEEF_PATH', 'Not set'))"
118- python -c "import platform; print('Python version:', platform.python_version())"
119- python -c "import sys; print('sys.platform:', sys.platform)"
120- python -c "import quaddtype; print('quaddtype imported successfully')"
121- pip install {package}[test]
122- pytest {project}/tests
123- CIBW_TEST_EXTRAS : " test"
124- run : |
125- echo "SLEEF_PATH: $SLEEF_PATH"
126- ls $SLEEF_PATH/include/sleef*
127- echo "PATH: $PATH"
128- which python
129- python --version
130- which pip
131- pip --version
132- cd quaddtype
133- python -m cibuildwheel --output-dir wheelhouse
134-
135- - uses : actions/upload-artifact@v3
136- with :
137- path : ./quaddtype/wheelhouse/*.whl
138- name : wheels-${{ matrix.os }}
139-
140- build_wheels_windows :
141- name : Build wheels on Windows
142- runs-on : windows-latest
143- strategy :
144- matrix :
145- architecture : [x64]
146-
147- steps :
148- - uses : actions/checkout@v3
149-
150- - name : Setup MSVC
151- uses : ilammy/msvc-dev-cmd@v1
152- with :
153- arch : ${{ matrix.architecture }}
154-
155- - name : Set up Python 3.10
156- uses : actions/setup-python@v4
157- with :
158- python-version : " 3.10"
159- architecture : ${{ matrix.architecture }}
160-
161- - name : Install Miniconda
162- uses : conda-incubator/setup-miniconda@v3
163- with :
164- auto-update-conda : true
165- python-version : " 3.10"
166- architecture : ${{ matrix.architecture }}
167-
16843 - name : Install SLEEF and other dependencies
16944 shell : bash -l {0}
17045 run : |
17146 conda config --add channels conda-forge
17247 conda config --set channel_priority strict
17348 conda install -y sleef numpy
17449 conda list
175- if [ ! -f "$CONDA_PREFIX/Library/include/sleef.h" ]; then
50+ if [ ! -f "$CONDA_PREFIX/include/sleef.h" ] && [ ! -f "$CONDA_PREFIX/ Library/include/sleef.h" ]; then
17651 echo "sleef.h not found. Installation may have failed."
17752 exit 1
17853 fi
179- ls -l "$CONDA_PREFIX/Library/include/sleef.h"
180- ls -l "$CONDA_PREFIX/Library/lib/sleef"*
18154
18255 - name : Set environment variables
183- shell : pwsh
184- run : |
185- echo "CONDA_PREFIX=$env:CONDA_PREFIX" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
186- $numpy_path = python -c "import numpy; import os; print(os.path.abspath(numpy.get_include()).replace(os.sep, '/'))"
187- echo "NUMPY_INCLUDE_DIR=$numpy_path" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
188-
189- - name : Install build dependencies
19056 shell : bash -l {0}
19157 run : |
192- pip install -U pip
193- pip install cibuildwheel==2.20.0 ninja meson meson-python numpy delvewheel pytest
58+ if [ "${{ runner.os }}" == "Windows" ]; then
59+ echo "SLEEF_PATH=$CONDA_PREFIX/Library" >> $GITHUB_ENV
60+ echo "NUMPY_INCLUDE_DIR=$(python -c "import numpy; import os; print(os.path.abspath(numpy.get_include()).replace(os.sep, '/'))")" >> $GITHUB_ENV
61+ else
62+ echo "SLEEF_PATH=$CONDA_PREFIX" >> $GITHUB_ENV
63+ fi
64+
65+ - name : Install cibuildwheel
66+ run : pip install cibuildwheel==2.20.0
19467
19568 - name : Build wheels
19669 env :
197- CONDA_PREFIX : ${{ env.CONDA_PREFIX }}
198- CIBW_SKIP : " pp* cp36-* cp37-* cp38-* cp39-* cp313-*"
199- CIBW_ARCHS_WINDOWS : ${{ matrix.architecture == 'x86' && 'x86' || 'AMD64' }}
200- CIBW_BUILD_VERBOSITY : " 1"
201- SLEEF_INCLUDE_DIR : ${{ env.CONDA_PREFIX }}\Library\include
202- SLEEF_LIBRARY : ${{ env.CONDA_PREFIX }}\Library\lib
203- DISTUTILS_USE_SDK : " 1"
204- MSSdk : " 1"
205- NUMPY_INCLUDE_DIR : ${{ env.NUMPY_INCLUDE_DIR }}
70+ CIBW_BUILD : ' cp310-* cp311-* cp312-*'
71+ CIBW_SKIP : ' pp* *-win32 *-manylinux_i686'
72+ CIBW_ARCHS : ${{ matrix.cibw_archs }}
73+ CIBW_BUILD_VERBOSITY : ' 1'
20674 CIBW_ENVIRONMENT : >-
75+ SLEEF_PATH="${{ env.SLEEF_PATH }}"
20776 NUMPY_INCLUDE_DIR="${{ env.NUMPY_INCLUDE_DIR }}"
208- SLEEF_INCLUDE_DIR="${{ env.CONDA_PREFIX }}/Library/include"
209- SLEEF_LIBRARY="${{ env.CONDA_PREFIX }}/Library/lib"
210- CIBW_BEFORE_BUILD : pip install meson meson-python ninja numpy
211- CIBW_REPAIR_WHEEL_COMMAND : " delvewheel repair -w {dest_dir} {wheel}"
77+ PATH="${{ env.SLEEF_PATH }}/bin:$PATH"
78+ ${{ runner.os == 'Windows' && 'DISTUTILS_USE_SDK=1 MSSdk=1' || '' }}
79+ CIBW_BEFORE_BUILD : >-
80+ pip install -U pip &&
81+ pip install meson meson-python ninja numpy
82+ CIBW_REPAIR_WHEEL_COMMAND : >-
83+ ${{ runner.os == 'Windows' && 'delvewheel repair -w {dest_dir} {wheel}' ||
84+ runner.os == 'macOS' && 'delocate-wheel -w {dest_dir} -v {wheel}' ||
85+ 'auditwheel repair -w {dest_dir} {wheel}' }}
21286 CIBW_TEST_COMMAND : |
213- python -c "import platform; print('Python version:', platform.python_version())"
214- python -c "import sys; print('sys.platform:', sys.platform)"
215- python -c "import quaddtype; print('quaddtype imported successfully')"
87+ python -c "import os, platform, sys, quaddtype; print(f'Python {platform.python_version()} on {sys.platform}')"
21688 pip install {package}[test]
217- pytest {project}\ tests -v || (echo "Tests failed" && exit 1)
218- CIBW_TEST_EXTRAS : " test"
89+ pytest {project}/ tests -v
90+ CIBW_TEST_EXTRAS : ' test'
21991 CIBW_TEST_FAIL_FAST : 1
220- shell : pwsh
221- run : |
222- python -m cibuildwheel --output-dir wheelhouse
223- if (-not (Test-Path wheelhouse/*.whl)) { throw "Wheel was not created" }
92+ run : python -m cibuildwheel --output-dir wheelhouse
22493 working-directory : ./quaddtype
22594
22695 - uses : actions/upload-artifact@v3
22796 with :
22897 path : ./quaddtype/wheelhouse/*.whl
229- name : wheels-windows- ${{ matrix.architecture }}
98+ name : wheels-${{ matrix.os }}
23099
231100 publish_to_testpypi :
232101 name : Publish to TestPyPI
233- needs : [build_wheels_linux, build_wheels_macos, build_wheels_windows ]
102+ needs : [build_wheels ]
234103 runs-on : ubuntu-latest
235104 if : startsWith(github.ref, 'refs/tags/')
236105 steps :
237- - name : Download all workflow run artifacts
238- uses : actions/download-artifact@v2
106+ - uses : actions/download-artifact@v2
239107 with :
240108 path : dist
241- - name : Publish to TestPyPI
242- 109+ 243110 with :
244111 user : __token__
245112 password : ${{ secrets.PYPI_API_TOKEN }}
@@ -248,32 +115,23 @@ jobs:
248115
249116 create_release :
250117 name : Create Release
251- needs : [build_wheels_linux, build_wheels_macos, build_wheels_windows ]
118+ needs : [build_wheels ]
252119 runs-on : ubuntu-latest
253120 if : startsWith(github.ref, 'refs/tags/')
254-
255121 steps :
256- - name : Checkout code
257- uses : actions/checkout@v2
258-
259- - name : Download all workflow run artifacts
260- uses : actions/download-artifact@v2
122+ - uses : actions/checkout@v2
123+ - uses : actions/download-artifact@v2
261124 with :
262125 path : artifacts
263-
264- - name : Create Release
265- id : create_release
266- uses : actions/create-release@v1
126+ - uses : actions/create-release@v1
267127 env :
268128 GITHUB_TOKEN : ${{ secrets.ACCESS_TOKEN }}
269129 with :
270130 tag_name : ${{ github.ref }}
271131 release_name : Release ${{ github.ref }}
272132 draft : false
273133 prerelease : false
274-
275- - name : Upload Release Assets
276- uses : softprops/action-gh-release@v1
134+ - uses : softprops/action-gh-release@v1
277135 if : startsWith(github.ref, 'refs/tags/')
278136 with :
279137 files : ./artifacts/**/*.whl
0 commit comments