Skip to content

Commit 9a8b4dd

Browse files
fruchdkropachev
authored andcommitted
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 9d6390f commit 9a8b4dd

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Diff for: .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

Diff for: setup.py

+9-2
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
@@ -326,6 +331,7 @@ def _setup_extensions(self):
326331
for m in cython_candidates],
327332
nthreads=build_concurrency,
328333
compiler_directives={'language_level': 3},
334+
exclude_failures=not CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST,
329335
))
330336

331337
self.extensions.extend(cythonize(
@@ -335,7 +341,8 @@ def _setup_extensions(self):
335341
))
336342
except Exception:
337343
sys.stderr.write("Failed to cythonize one or more modules. These will not be compiled as extensions (optional).\n")
338-
344+
if CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST:
345+
raise
339346

340347
def pre_build_check():
341348
"""

0 commit comments

Comments
 (0)