Skip to content

Commit c396bd5

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

File tree

3 files changed

+63
-70
lines changed

3 files changed

+63
-70
lines changed

.github/workflows/build-pre-release.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,9 @@ on:
1313
description: "target os to build for: linux,macos,windows"
1414
default: "linux,macos,windows"
1515

16-
cibw-skip:
17-
type: string
18-
description: 'CIBUILDWHEEL builds pattern to skip, goes to CIBW_SKIP env'
19-
required: false
20-
default: 'cp36* cp37* pp*i686 *musllinux*'
21-
2216
jobs:
2317
build-and-publish:
2418
uses: ./.github/workflows/lib-build-and-push.yml
2519
with:
2620
python-version: ${{ inputs.python-version }}
2721
target: ${{ inputs.target }}
28-
cibw-skip: ${{ inputs.cibw-skip }}

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

Lines changed: 15 additions & 62 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,58 +100,34 @@ 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 MacOS
104+
if: 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'
115+
- name: Set build target
116+
shell: bash
163117
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
118+
if [[ "${{ matrix.platform }}" == "PyPy" ]]; then
119+
echo "CIBW_BUILD=pp*" >> $GITHUB_ENV;
120+
else
121+
echo "CIBW_BUILD=cp*" >> $GITHUB_ENV;
122+
fi
167123
168124
- name: Build wheels
169125
run: |
170126
python3 -m cibuildwheel --output-dir wheelhouse
171127
172128
- uses: actions/upload-artifact@v4
173129
with:
174-
name: wheels-${{ matrix.os }}-${{ matrix.platform }}
130+
name: wheels-${{ runner.os }}-${{ matrix.platform }}
175131
path: ./wheelhouse/*.whl
176132

177133
build-sdist:
@@ -241,9 +197,6 @@ jobs:
241197
permissions:
242198
id-token: write
243199

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'
247200
steps:
248201
- uses: actions/download-artifact@v4
249202
with:

pyproject.toml

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,51 @@ 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-frontend = "build"
112+
build = ["cp3*"]
113+
test-command = [
114+
"pytest {project}/tests/unit -k 'not (test_multi_timer_validation or test_empty_connections or test_timer_cancellation)'"
115+
]
116+
117+
[tool.cibuildwheel.windows]
118+
build-frontend = "build"
119+
test-command = [
120+
"pytest {project}/tests/unit -k \"not (test_deserialize_date_range_year or test_datetype or test_libevreactor)\""
121+
]
122+
123+
# TODO: set CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST to yes when https://github.com/scylladb/python-driver/issues/429 is fixed
124+
environment = { CASS_DRIVER_BUILD_CONCURRENCY = "2", CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST = "no"}
125+
126+
[[tool.cibuildwheel.overrides]]
127+
select = "pp*"
128+
test-command = []

0 commit comments

Comments
 (0)