Skip to content

Commit 099f1be

Browse files
author
t-swsingh_microsoft
committed
fixing setup
1 parent 7756dfb commit 099f1be

File tree

2 files changed

+163
-1
lines changed

2 files changed

+163
-1
lines changed

.github/workflows/build_wheels.yml

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,120 @@ on:
44
push:
55
branches:
66
- win-sleeef
7+
tags:
8+
- 'quaddtype-v*'
9+
paths:
10+
- 'quaddtype/**'
711
pull_request:
12+
paths:
13+
- 'quaddtype/**'
814
workflow_dispatch:
915

1016
jobs:
17+
build_wheels_linux:
18+
name: Build wheels on Linux
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v3
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: '>=3.10.0'
27+
28+
- name: Install cibuildwheel
29+
run: pip install cibuildwheel==2.20.0
30+
31+
- name: Build wheels
32+
env:
33+
CIBW_BUILD: 'cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64'
34+
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
35+
CIBW_BUILD_VERBOSITY: '3'
36+
CIBW_BEFORE_ALL: |
37+
git clone https://github.com/shibatch/sleef.git
38+
cd sleef
39+
cmake -S . -B build -DSLEEF_BUILD_QUAD:BOOL=ON -DSLEEF_BUILD_SHARED_LIBS:BOOL=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON
40+
cmake --build build/ --clean-first -j
41+
cmake --install build --prefix /usr/local
42+
CIBW_ENVIRONMENT: >
43+
CFLAGS="-I/usr/local/include $CFLAGS"
44+
CXXFLAGS="-I/usr/local/include $CXXFLAGS"
45+
LDFLAGS="-L/usr/local/lib64 $LDFLAGS"
46+
LD_LIBRARY_PATH="/usr/local/lib64:$LD_LIBRARY_PATH"
47+
CIBW_REPAIR_WHEEL_COMMAND: |
48+
auditwheel repair -w {dest_dir} --plat manylinux_2_28_x86_64 {wheel}
49+
CIBW_TEST_COMMAND: |
50+
pip install {package}[test]
51+
pytest {project}/tests
52+
CIBW_TEST_EXTRAS: 'test'
53+
run: |
54+
python -m cibuildwheel --output-dir wheelhouse
55+
working-directory: ./quaddtype
56+
57+
- uses: actions/upload-artifact@v4
58+
with:
59+
path: ./quaddtype/wheelhouse/*.whl
60+
name: wheels-linux
61+
62+
build_wheels_macos:
63+
name: Build wheels on ${{ matrix.os }}
64+
runs-on: ${{ matrix.os }}
65+
strategy:
66+
matrix:
67+
os: [macos-13, macos-14]
68+
69+
steps:
70+
- uses: actions/checkout@v3
71+
72+
- name: Set up Python
73+
uses: actions/setup-python@v4
74+
with:
75+
python-version: '3.10'
76+
77+
- name: Install SLEEF
78+
env:
79+
MACOSX_DEPLOYMENT_TARGET: '11.0'
80+
run: |
81+
git clone https://github.com/shibatch/sleef.git
82+
cd sleef
83+
cmake -S . -B build \
84+
-DSLEEF_BUILD_QUAD:BOOL=ON \
85+
-DSLEEF_BUILD_SHARED_LIBS:BOOL=ON \
86+
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
87+
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
88+
-DCMAKE_INSTALL_RPATH="@loader_path/../lib" \
89+
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON
90+
cmake --build build/ --clean-first -j
91+
sudo cmake --install build --prefix /usr/local
92+
- name: Install cibuildwheel
93+
run: pip install cibuildwheel==2.20.0
94+
95+
- name: Build wheels
96+
env:
97+
CIBW_BUILD: 'cp310-* cp311-* cp312-*'
98+
CIBW_ARCHS_MACOS: ${{ matrix.os == 'macos-13' && 'x86_64' || 'arm64' }}
99+
CIBW_BUILD_VERBOSITY: '1'
100+
CIBW_ENVIRONMENT: >
101+
MACOSX_DEPLOYMENT_TARGET="11.0"
102+
DYLD_LIBRARY_PATH="/usr/local/lib:$DYLD_LIBRARY_PATH"
103+
CFLAGS="-I/usr/local/include $CFLAGS"
104+
CXXFLAGS="-I/usr/local/include $CXXFLAGS"
105+
LDFLAGS="-L/usr/local/lib $LDFLAGS"
106+
CIBW_REPAIR_WHEEL_COMMAND: >
107+
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
108+
CIBW_TEST_COMMAND: |
109+
pip install {package}[test]
110+
pytest {project}/tests
111+
CIBW_TEST_EXTRAS: 'test'
112+
run: |
113+
python -m cibuildwheel --output-dir wheelhouse
114+
working-directory: ./quaddtype
115+
116+
- uses: actions/upload-artifact@v4
117+
with:
118+
path: ./quaddtype/wheelhouse/*.whl
119+
name: wheels-${{ matrix.os }}
120+
11121
build_wheels_windows:
12122
name: Build wheels on Windows
13123
runs-on: windows-latest
@@ -83,3 +193,55 @@ jobs:
83193
with:
84194
path: ./quaddtype/wheelhouse/*.whl
85195
name: wheels-windows-${{ matrix.architecture }}
196+
197+
publish_to_testpypi:
198+
name: Publish to TestPyPI
199+
needs: [build_wheels_linux, build_wheels_macos, build_wheels_windows]
200+
runs-on: ubuntu-latest
201+
if: startsWith(github.ref, 'refs/tags/quaddtype-v')
202+
steps:
203+
- name: Download all workflow run artifacts
204+
uses: actions/download-artifact@v4
205+
with:
206+
path: dist
207+
- name: Publish to TestPyPI
208+
uses: pypa/[email protected]
209+
with:
210+
user: __token__
211+
password: ${{ secrets.PYPI_API_TOKEN }}
212+
repository-url: https://test.pypi.org/legacy/
213+
packages-dir: dist/*
214+
215+
create_release:
216+
name: Create Release
217+
needs: [build_wheels_linux, build_wheels_macos, build_wheels_windows]
218+
runs-on: ubuntu-latest
219+
if: startsWith(github.ref, 'refs/tags/quaddtype-v')
220+
221+
steps:
222+
- name: Checkout code
223+
uses: actions/checkout@v2
224+
225+
- name: Download all workflow run artifacts
226+
uses: actions/download-artifact@v4
227+
with:
228+
path: artifacts
229+
230+
- name: Create Release
231+
id: create_release
232+
uses: actions/create-release@v1
233+
env:
234+
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
235+
with:
236+
tag_name: ${{ github.ref }}
237+
release_name: Release ${{ github.ref }}
238+
draft: false
239+
prerelease: false
240+
241+
- name: Upload Release Assets
242+
uses: softprops/action-gh-release@v1
243+
if: startsWith(github.ref, 'refs/tags/')
244+
with:
245+
files: ./artifacts/**/*.whl
246+
env:
247+
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}

quaddtype/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ build-backend = "mesonpy"
1010
[project]
1111
name = "numpy_quaddtype"
1212
description = "Quad (128-bit) float dtype for numpy"
13-
version = "0.0.1"
13+
version = "0.0.4"
1414
readme = 'README.md'
1515
authors = [{name = "Swayam Singh", email = "[email protected]"}]
1616
requires-python = ">=3.10.0"

0 commit comments

Comments
 (0)