Skip to content

Commit 359d427

Browse files
Expose wheel build failures in CI
1 parent 7ea82cb commit 359d427

2 files changed

Lines changed: 35 additions & 1 deletion

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from __future__ import annotations
2+
3+
import subprocess
4+
import sys
5+
from collections import deque
6+
7+
8+
def escape_workflow_command(value: str) -> str:
9+
return value.replace("%", "%25").replace("\r", "%0D").replace("\n", "%0A")
10+
11+
12+
process = subprocess.Popen(
13+
[sys.executable, "-m", "cibuildwheel", "--output-dir", "wheelhouse"],
14+
stdout=subprocess.PIPE,
15+
stderr=subprocess.STDOUT,
16+
text=True,
17+
)
18+
19+
assert process.stdout is not None
20+
recent_output: deque[str] = deque(maxlen=100)
21+
for line in process.stdout:
22+
print(line, end="", flush=True)
23+
recent_output.append(line)
24+
25+
return_code = process.wait()
26+
if return_code:
27+
details = escape_workflow_command("".join(recent_output))
28+
print(f"::error title=cibuildwheel failed::{details}")
29+
raise SystemExit(return_code)

.github/workflows/python-build.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v4
1818

19+
- uses: actions/setup-python@v5
20+
21+
- name: Install cibuildwheel
22+
run: python -m pip install cibuildwheel==3.2.1
23+
1924
- name: Build wheels
20-
uses: pypa/cibuildwheel@v3.2.1
25+
run: python .github/scripts/run_cibuildwheel.py
2126

2227
- uses: actions/upload-artifact@v4
2328
with:

0 commit comments

Comments
 (0)