Skip to content

Commit 4db1564

Browse files
committed
Add Windows CI workflow with timeout guard
1 parent 8477bf7 commit 4db1564

2 files changed

Lines changed: 61 additions & 2 deletions

File tree

.github/workflows/ci-windows.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: CI Windows
2+
3+
on:
4+
push:
5+
branches: [ "github-actions-ci", "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
jobs:
10+
build-and-test:
11+
runs-on: windows-latest
12+
timeout-minutes: 60
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Install Python dependencies
28+
run: pip install -r tools/requirements.txt
29+
30+
- name: Read CEF version
31+
id: cef-version
32+
run: |
33+
$ver = (Select-String -Path src/version/cef_version_win.h `
34+
-Pattern '#define CEF_VERSION "([^"]+)"').Matches[0].Groups[1].Value
35+
echo "value=$ver" >> $env:GITHUB_OUTPUT
36+
37+
- name: Cache CEF binaries
38+
uses: actions/cache@v4
39+
with:
40+
path: build/cef_binary_*
41+
key: cef-windows64-${{ steps.cef-version.outputs.value }}
42+
43+
- name: Download CEF binaries
44+
run: python tools/download_cef.py
45+
46+
- name: Prepare prebuilt CEF
47+
run: python tools/automate.py --prebuilt-cef
48+
49+
- name: Build and run unit tests
50+
run: python tools/build.py --unittests

unittests/_test_runner.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,22 @@ def _run_suites_in_isolation(self, suites):
150150
for testcase in suite:
151151
testcase_id = testcase.id()
152152
break
153-
# Run test using new instance of Python interpreter
153+
# Run test using new instance of Python interpreter.
154+
# Timeout guards against CEF shutdown hangs blocking CI forever.
155+
ISOLATED_TEST_TIMEOUT = 120 # seconds
154156
try:
155157
output = subprocess.check_output(
156158
[sys.executable, "_test_runner.py", testcase_id,
157159
CUSTOM_CMDLINE_ARG],
158-
stderr=subprocess.STDOUT)
160+
stderr=subprocess.STDOUT,
161+
timeout=ISOLATED_TEST_TIMEOUT)
159162
exit_code = 0
163+
except subprocess.TimeoutExpired as exc:
164+
output = (exc.output or b"") + (
165+
"\n[_test_runner.py] ERROR: isolated test timed out"
166+
" after {sec}s\n".format(sec=ISOLATED_TEST_TIMEOUT)
167+
.encode("utf-8"))
168+
exit_code = 1
160169
except subprocess.CalledProcessError as exc:
161170
output = exc.output
162171
exit_code = exc.returncode

0 commit comments

Comments
 (0)