Fail the CI if an optional module fails to compile (GH-27466)

This commit is contained in:
Pablo Galindo Salgado 2021-07-30 15:21:09 +01:00 committed by GitHub
parent f4367ba3c5
commit 7cad0bee80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 0 deletions

View File

@ -119,6 +119,8 @@ jobs:
runs-on: macos-latest runs-on: macos-latest
needs: check_source needs: check_source
if: needs.check_source.outputs.run_tests == 'true' if: needs.check_source.outputs.run_tests == 'true'
env:
PYTHONSTRICTEXTENSIONBUILD: 1
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Configure CPython - name: Configure CPython
@ -137,6 +139,7 @@ jobs:
if: needs.check_source.outputs.run_tests == 'true' if: needs.check_source.outputs.run_tests == 'true'
env: env:
OPENSSL_VER: 1.1.1k OPENSSL_VER: 1.1.1k
PYTHONSTRICTEXTENSIONBUILD: 1
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Register gcc problem matcher - name: Register gcc problem matcher
@ -227,6 +230,7 @@ jobs:
if: needs.check_source.outputs.run_tests == 'true' if: needs.check_source.outputs.run_tests == 'true'
env: env:
OPENSSL_VER: 1.1.1k OPENSSL_VER: 1.1.1k
PYTHONSTRICTEXTENSIONBUILD: 1
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0 ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@ -18,6 +18,7 @@ env:
# Set rpath with env var instead of -Wl,-rpath linker flag # Set rpath with env var instead of -Wl,-rpath linker flag
# OpenSSL ignores LDFLAGS when linking bin/openssl # OpenSSL ignores LDFLAGS when linking bin/openssl
- LD_RUN_PATH="${OPENSSL_DIR}/lib" - LD_RUN_PATH="${OPENSSL_DIR}/lib"
- PYTHONSTRICTEXTENSIONBUILD=1
branches: branches:
only: only:

View File

@ -571,6 +571,9 @@ class PyBuildExt(build_ext):
print("Custom linker flags may require --with-openssl-rpath=auto") print("Custom linker flags may require --with-openssl-rpath=auto")
print() print()
if os.environ.get("PYTHONSTRICTEXTENSIONBUILD") and (self.failed or self.failed_on_import):
raise RuntimeError("Failed to build some stdlib modules")
def build_extension(self, ext): def build_extension(self, ext):
if ext.name == '_ctypes': if ext.name == '_ctypes':