Skip to content

Commit 4a78eb7

Browse files
committed
cicd: move cibuildwheel configuration to pyproject.toml
1 parent a9725f4 commit 4a78eb7

File tree

2 files changed

+54
-64
lines changed

2 files changed

+54
-64
lines changed

.github/workflows/lib-build-and-push.yml

Lines changed: 7 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,20 @@ on:
66
upload:
77
description: 'Upload to PyPI'
88
type: boolean
9+
required: false
910
default: false
1011

1112
python-version:
1213
description: 'Python version to run on'
13-
required: true
1414
type: string
15+
required: true
1516
default: "3.13"
1617

1718
target:
18-
type: string
1919
description: "target os to build for: linux,macos,windows"
20-
default: "linux,macos,windows"
21-
22-
cibw-skip:
2320
type: string
24-
description: 'CIBUILDWHEEL builds pattern to skip, goes to CIBW_SKIP env'
2521
required: false
26-
default: 'cp36* cp37* pp*i686 *musllinux*'
27-
28-
env:
29-
CIBW_TEST_COMMAND_LINUX: >
30-
pytest {project}/tests/unit &&
31-
EVENT_LOOP_MANAGER=gevent pytest {project}/tests/unit/io/test_geventreactor.py
32-
33-
CIBW_TEST_COMMAND_MACOS: "pytest {project}/tests/unit -k 'not (test_multi_timer_validation or test_empty_connections or test_timer_cancellation)' "
34-
CIBW_TEST_COMMAND_WINDOWS: "pytest {project}/tests/unit -k \"not (test_deserialize_date_range_year or test_datetype or test_libevreactor)\" "
35-
CIBW_BEFORE_TEST: "pip install -r {project}/test-requirements.txt"
36-
CIBW_BEFORE_BUILD_LINUX: "rm -rf ~/.pyxbld && rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux && yum install -y libffi-devel libev libev-devel openssl openssl-devel"
37-
CIBW_ENVIRONMENT: "CASS_DRIVER_BUILD_CONCURRENCY=2 CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST=yes CFLAGS='-g0 -O3'"
38-
CIBW_SKIP: cp36* cp37* pp*i686 *musllinux*
39-
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
40-
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux_2_28
41-
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
42-
CIBW_MANYLINUX_PYPY_AARCH64_IMAGE: manylinux_2_28
22+
default: "linux,macos,windows"
4323

4424
jobs:
4525
prepare-matrix:
@@ -109,7 +89,7 @@ jobs:
10989
if: runner.os == 'Windows'
11090
uses: turtlebrowser/get-conan@main
11191

112-
- name: configure libev for Windows
92+
- name: Configure libev for Windows
11393
if: runner.os == 'Windows'
11494
run: |
11595
conan profile detect
@@ -120,51 +100,18 @@ jobs:
120100
run: |
121101
brew install libev
122102
123-
- name: Overwrite for Linux 64
124-
if: runner.os == 'Linux' && matrix.platform == 'x86_64'
125-
run: |
126-
echo "CIBW_BUILD=cp3*_x86_64" >> $GITHUB_ENV
127-
128-
- name: Overwrite for Linux PyPy
129-
if: runner.os == 'Linux' && matrix.platform == 'PyPy'
103+
- name: Overwrite for Linux and MacOS
104+
if: runner.os == 'Linux' || runner.os == 'MacOS'
130105
run: |
131-
echo "CIBW_BUILD=pp*" >> $GITHUB_ENV
132-
echo "CIBW_TEST_COMMAND_LINUX=" >> $GITHUB_ENV
133-
134-
- name: Overwrite for Windows 64
135-
if: runner.os == 'Windows' && matrix.platform == 'win64'
136-
run: |
137-
echo "CIBW_BUILD=cp*win_amd64" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
138-
echo "CIBW_ENVIRONMENT_WINDOWS= CC=clang CXX=clang++" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
139-
140-
- name: Overwrite for Windows PyPY
141-
if: runner.os == 'Windows' && matrix.platform == 'PyPy'
142-
run: |
143-
echo "CIBW_BUILD=pp*" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
144-
echo "CIBW_TEST_COMMAND_WINDOWS=" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
145-
146-
- name: Overwrite for MacOs
147-
if: runner.os == 'MacOs' && matrix.platform == 'all'
148-
run: |
149-
echo "CIBW_BUILD=cp39* cp310* cp311* cp312* cp313*" >> $GITHUB_ENV
150-
echo "CIBW_BEFORE_TEST_MACOS=pip install -r {project}/test-requirements.txt pytest" >> $GITHUB_ENV
106+
##### Set MACOSX_DEPLOYMENT_TARGET
151107
if [ "${{ matrix.os }}" == "macos-13" ]; then
152108
echo "MACOSX_DEPLOYMENT_TARGET=13.0" >> $GITHUB_ENV;
153109
echo "Enforcing target deployment for 13.0"
154110
elif [ "${{ matrix.os }}" == "macos-14" ]; then
155111
echo "MACOSX_DEPLOYMENT_TARGET=14.0" >> $GITHUB_ENV;
156112
echo "Enforcing target deployment for 14.0"
157-
else
158-
echo "Unknown macos version" && false;
159113
fi
160114
161-
- name: Overwrite for MacOs PyPy
162-
if: runner.os == 'MacOs' && matrix.platform == 'PyPy'
163-
run: |
164-
echo "CIBW_BUILD=pp*" >> $GITHUB_ENV
165-
echo "CIBW_BEFORE_TEST_MACOS=pip install -r {project}/test-requirements.txt pytest" >> $GITHUB_ENV
166-
echo "CIBW_TEST_COMMAND_MACOS=" >> $GITHUB_ENV
167-
168115
- name: Build wheels
169116
run: |
170117
python3 -m cibuildwheel --output-dir wheelhouse
@@ -241,9 +188,6 @@ jobs:
241188
permissions:
242189
id-token: write
243190

244-
# upload to PyPI on every tag starting with 'v'
245-
# alternatively, to publish when a GitHub Release is created, use the following rule:
246-
# if: github.event_name == 'release' && github.event.action == 'published'
247191
steps:
248192
- uses: actions/download-artifact@v4
249193
with:

pyproject.toml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,50 @@ requires = [
7878
"Cython",
7979
]
8080

81-
build-backend = "setuptools.build_meta"
81+
build-backend = "setuptools.build_meta"
82+
83+
[tool.setuptools_scm]
84+
version_file = "cassandra/_version.py"
85+
tag_regex = '(?P<version>\d*?\.\d*?\.\d*?)-scylla'
86+
87+
#### CI BUILDWHEEL CONFIG ####
88+
89+
[tool.cibuildwheel]
90+
build-frontend = "build[uv]"
91+
environment = { CASS_DRIVER_BUILD_CONCURRENCY = "2", CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST = "yes", CFLAGS = "-g0 -O3" }
92+
skip = ["cp2*", "cp36*", "pp36*", "cp37*", "pp37*", "*i686", "*musllinux*"]
93+
build = ["cp3*"]
94+
95+
before-test = "pip install -r {project}/test-requirements.txt"
96+
97+
manylinux-x86_64-image = "manylinux_2_28"
98+
manylinux-aarch64-image = "manylinux_2_28"
99+
manylinux-pypy_x86_64-image = "manylinux_2_28"
100+
manylinux-pypy_aarch64-image = "manylinux_2_28"
101+
102+
[tool.cibuildwheel.linux]
103+
104+
before-build = "rm -rf ~/.pyxbld && rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux && yum install -y libffi-devel libev libev-devel openssl openssl-devel"
105+
test-command = [
106+
"pytest {package}/tests/unit",
107+
"EVENT_LOOP_MANAGER=gevent pytest {package}/tests/unit/io/test_geventreactor.py",
108+
]
109+
110+
[tool.cibuildwheel.macos]
111+
build = ["cp3*"]
112+
test-command = [
113+
"pytest {project}/tests/unit -k 'not (test_multi_timer_validation or test_empty_connections or test_timer_cancellation)'"
114+
]
115+
116+
[tool.cibuildwheel.windows]
117+
build-frontend = "build" # build[uv] seems to be broken on Windows
118+
test-command = [
119+
"pytest {project}/tests/unit -k \"not (test_deserialize_date_range_year or test_datetype or test_libevreactor)\""
120+
]
121+
122+
# TODO: set CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST to yes when https://github.com/scylladb/python-driver/issues/429 is fixed
123+
environment = { CASS_DRIVER_BUILD_CONCURRENCY = "2", CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST = "no"}
124+
125+
[[tool.cibuildwheel.overrides]]
126+
select = "pp*"
127+
test-command = []

0 commit comments

Comments
 (0)