Skip to content

Commit 315198a

Browse files
committed
git actions: fail build if extensions aren't built
we run running again and again into situation our wheels are missing some of the part we expect cause of extensions silently failing with this change we can stop the builds cause of that, and attend to it
1 parent dccfe90 commit 315198a

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

.github/workflows/build-push.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ env:
1212
CIBW_TEST_COMMAND_WINDOWS: "pytest {project}/tests/unit -k \"not (test_deserialize_date_range_year or test_datetype or test_libevreactor)\" "
1313
CIBW_BEFORE_TEST: "pip install -r {project}/test-requirements.txt"
1414
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"
15-
CIBW_ENVIRONMENT: "CASS_DRIVER_BUILD_CONCURRENCY=2 CFLAGS='-g0 -O3'"
15+
CIBW_ENVIRONMENT: "CASS_DRIVER_BUILD_CONCURRENCY=2 CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST=yes CFLAGS='-g0 -O3'"
1616
CIBW_SKIP: cp36* cp37* pp*i686 *musllinux*
1717
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
1818
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux_2_28

setup.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def __init__(self, ext):
204204
sys.argv = [a for a in sys.argv if a not in ("--no-murmur3", "--no-libev", "--no-cython", "--no-extensions")]
205205

206206
build_concurrency = int(os.environ.get('CASS_DRIVER_BUILD_CONCURRENCY', '0'))
207-
207+
CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST = bool(os.environ.get('CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST', 'no') == 'yes')
208208

209209
class NoPatchExtension(Extension):
210210

@@ -284,6 +284,9 @@ def run(self):
284284
except DistutilsPlatformError as exc:
285285
sys.stderr.write('%s\n' % str(exc))
286286
warnings.warn(self.error_message % "C extensions.")
287+
if CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST:
288+
raise
289+
287290

288291
def build_extensions(self):
289292
if build_concurrency > 1:
@@ -302,6 +305,8 @@ def build_extension(self, ext):
302305
sys.stderr.write('%s\n' % str(exc))
303306
name = "The %s extension" % (ext.name,)
304307
warnings.warn(self.error_message % (name,))
308+
if CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST:
309+
raise
305310

306311
def _setup_extensions(self):
307312
# We defer extension setup until this command to leveraage 'setup_requires' pulling in Cython before we
@@ -325,13 +330,14 @@ def _setup_extensions(self):
325330
extra_compile_args=compile_args)
326331
for m in cython_candidates],
327332
nthreads=build_concurrency,
328-
exclude_failures=True))
333+
exclude_failures=not CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST))
329334

330335
self.extensions.extend(cythonize(NoPatchExtension("*", ["cassandra/*.pyx"], extra_compile_args=compile_args),
331336
nthreads=build_concurrency))
332337
except Exception:
333338
sys.stderr.write("Failed to cythonize one or more modules. These will not be compiled as extensions (optional).\n")
334-
339+
if CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST:
340+
raise
335341

336342
def pre_build_check():
337343
"""

0 commit comments

Comments
 (0)