From e688284e1de7a6222bff7fd83012183734e873cb Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Sat, 30 Aug 2025 20:39:45 +0100 Subject: [PATCH 1/2] Fix a few bugs in run_example_ci_config tooling Github-deploy.yml had a fix to make it work out-of-the-box. --- bin/run_example_ci_configs.py | 38 +++++++++++++++++++++++++++++++---- examples/github-deploy.yml | 5 +++-- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/bin/run_example_ci_configs.py b/bin/run_example_ci_configs.py index 6eb6a4f0c..da8d5b6a4 100755 --- a/bin/run_example_ci_configs.py +++ b/bin/run_example_ci_configs.py @@ -2,6 +2,7 @@ import os +import re import shutil import subprocess import sys @@ -13,7 +14,7 @@ import click -DIR = Path(__file__).parent.resolve() +DIR = Path(__file__).parent.parent.resolve() def shell(cmd: str, *, check: bool, **kwargs: object) -> subprocess.CompletedProcess[str]: @@ -38,6 +39,29 @@ class CIService(typing.NamedTuple): name: str dst_config_path: str badge_md: str + config_file_transform: typing.Callable[[str], str] = lambda x: x # identity by default + + +def github_config_file_transform(content: str) -> str: + # one of the the github configs only builds on main, so we need to remove that restriction + # so our example build will run on the test branch. + # + # replace: + # """ + # push: + # branches: + # - main + # """ + # with: + # """ + # push: + # """" + content = re.sub( + r"push:\n\s+branches:\n\s+- main", + "push:", + content, + ) + return content services = [ @@ -54,7 +78,8 @@ class CIService(typing.NamedTuple): CIService( name="github", dst_config_path=".github/workflows/example.yml", - badge_md="[![Build](https://github.com/pypa/cibuildwheel/workflows/Build/badge.svg?branch={branch})](https://github.com/pypa/cibuildwheel/actions)", + badge_md="[![Build](https://github.com/pypa/cibuildwheel/actions/workflows/example.yml/badge.svg?branch={branch})](https://github.com/pypa/cibuildwheel/actions?query=branch%3A{branch})", + config_file_transform=github_config_file_transform, ), CIService( name="travis-ci", @@ -93,6 +118,8 @@ def run_example_ci_configs(config_files=None): if len(config_files) == 0: config_files = Path("examples").glob("*-minimal.yml") + else: + config_files = [Path(f) for f in config_files] # check each CI service has at most 1 config file configs_by_service = set() @@ -125,12 +152,15 @@ def run_example_ci_configs(config_files=None): dst_config_file = example_project / service.dst_config_path dst_config_file.parent.mkdir(parents=True, exist_ok=True) - shutil.copyfile(config_file, dst_config_file) + + contents = config_file.read_text(encoding="utf8") + contents = service.config_file_transform(contents) + dst_config_file.write_text(contents, encoding="utf8") subprocess.run(["git", "add", example_project], check=True) message = textwrap.dedent( f"""\ - Test example minimal configs + Test example CI configs Testing files: {[str(f) for f in config_files]} Generated from branch: {previous_branch} diff --git a/examples/github-deploy.yml b/examples/github-deploy.yml index ce5f81440..7e8d8aedd 100644 --- a/examples/github-deploy.yml +++ b/examples/github-deploy.yml @@ -107,5 +107,6 @@ jobs: merge-multiple: true - uses: pypa/gh-action-pypi-publish@release/v1 - with: - # To test: repository-url: https://test.pypi.org/legacy/ + # To test uploads to TestPyPI, uncomment the following: + # with: + # repository-url: https://test.pypi.org/legacy/ From 85c9451a3cba7218b2c79ff79ce180b8515f03e8 Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Mon, 8 Sep 2025 16:02:06 +0100 Subject: [PATCH 2/2] Add flaky marker on test_ssl (due to external internet access during the test, it does occasionally fail) --- test/test_ssl.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/test_ssl.py b/test/test_ssl.py index 0ea958ba3..d335f0630 100644 --- a/test/test_ssl.py +++ b/test/test_ssl.py @@ -1,6 +1,8 @@ import socket import textwrap +import pytest + from . import test_projects, utils project_with_ssl_tests = test_projects.new_c_project( @@ -19,6 +21,7 @@ ) +@pytest.mark.flaky(reruns=2) def test(tmp_path): # this test checks that SSL is working in the build environment using # some checks in setup.py.