@@ -3,243 +3,110 @@ name: Build Wheels
3
3
on :
4
4
push :
5
5
branches :
6
- - main
6
+ - quaddtype-packaging
7
7
tags :
8
- - " v* "
8
+ - ' v* '
9
9
pull_request :
10
10
11
11
jobs :
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 :
71
13
name : Build wheels on ${{ matrix.os }}
72
14
runs-on : ${{ matrix.os }}
73
15
strategy :
74
16
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'
76
27
77
28
steps :
78
29
- uses : actions/checkout@v3
79
30
80
31
- name : Set up Python
81
32
uses : actions/setup-python@v4
82
33
with :
83
- python-version : " >= 3.10.0 "
34
+ python-version : ' 3.10'
84
35
85
36
- name : Setup Miniconda
86
37
uses : conda-incubator/setup-miniconda@v3
87
38
with :
88
39
auto-update-conda : true
89
- python-version : " 3.10"
40
+ python-version : ' 3.10'
90
41
channels : conda-forge
91
42
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
-
168
43
- name : Install SLEEF and other dependencies
169
44
shell : bash -l {0}
170
45
run : |
171
46
conda config --add channels conda-forge
172
47
conda config --set channel_priority strict
173
48
conda install -y sleef numpy
174
49
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
176
51
echo "sleef.h not found. Installation may have failed."
177
52
exit 1
178
53
fi
179
- ls -l "$CONDA_PREFIX/Library/include/sleef.h"
180
- ls -l "$CONDA_PREFIX/Library/lib/sleef"*
181
54
182
55
- 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
190
56
shell : bash -l {0}
191
57
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
194
67
195
68
- name : Build wheels
196
69
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'
206
74
CIBW_ENVIRONMENT : >-
75
+ SLEEF_PATH="${{ env.SLEEF_PATH }}"
207
76
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}' }}
212
86
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}')"
216
88
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'
219
91
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
224
93
working-directory : ./quaddtype
225
94
226
95
- uses : actions/upload-artifact@v3
227
96
with :
228
97
path : ./quaddtype/wheelhouse/*.whl
229
- name : wheels-windows- ${{ matrix.architecture }}
98
+ name : wheels-${{ matrix.os }}
230
99
231
100
publish_to_testpypi :
232
101
name : Publish to TestPyPI
233
- needs : [build_wheels_linux, build_wheels_macos, build_wheels_windows ]
102
+ needs : [build_wheels ]
234
103
runs-on : ubuntu-latest
235
104
if : startsWith(github.ref, 'refs/tags/')
236
105
steps :
237
- - name : Download all workflow run artifacts
238
- uses : actions/download-artifact@v2
106
+ - uses : actions/download-artifact@v2
239
107
with :
240
108
path : dist
241
- - name : Publish to TestPyPI
242
- uses : pypa/gh-action-pypi-publish@v1.9.0
109
+ - uses : pypa/gh-action-pypi-publish@v1.9.0
243
110
with :
244
111
user : __token__
245
112
password : ${{ secrets.PYPI_API_TOKEN }}
@@ -248,32 +115,23 @@ jobs:
248
115
249
116
create_release :
250
117
name : Create Release
251
- needs : [build_wheels_linux, build_wheels_macos, build_wheels_windows ]
118
+ needs : [build_wheels ]
252
119
runs-on : ubuntu-latest
253
120
if : startsWith(github.ref, 'refs/tags/')
254
-
255
121
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
261
124
with :
262
125
path : artifacts
263
-
264
- - name : Create Release
265
- id : create_release
266
- uses : actions/create-release@v1
126
+ - uses : actions/create-release@v1
267
127
env :
268
128
GITHUB_TOKEN : ${{ secrets.ACCESS_TOKEN }}
269
129
with :
270
130
tag_name : ${{ github.ref }}
271
131
release_name : Release ${{ github.ref }}
272
132
draft : false
273
133
prerelease : false
274
-
275
- - name : Upload Release Assets
276
- uses : softprops/action-gh-release@v1
134
+ - uses : softprops/action-gh-release@v1
277
135
if : startsWith(github.ref, 'refs/tags/')
278
136
with :
279
137
files : ./artifacts/**/*.whl
0 commit comments