ci: add a non-blocking Windows baseline for the Python suite (#3165)

This commit is contained in:
Bingxi Zhao (Frank)
2026-12-02 05:28:01 -05:00

View File

@@ -385,6 +385,107 @@ jobs:
PYTHONPATH: ${{ github.workspace }}
DEEPTUTOR_TEST_REDIS_URL: redis://127.0.0.1:6379/0
# Baseline, not a gate: #2354 tracks the Windows-specific failures that keep
# this leg red. Running it on the nightly schedule and on demand gives a
# comparable count run to run, and it never blocks a pull request.
python-tests-windows-baseline:
name: Python Tests baseline (windows-latest)
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: windows-latest
continue-on-error: true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Cache pip packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-baseline-3.12-${{ hashFiles('requirements/full.txt', 'requirements/cli.txt', 'requirements/partners.txt', 'pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-baseline-3.12-
- name: Install test dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/full.txt
pip install -r requirements/partners.txt
pip install pytest pytest-asyncio
- name: Create minimal runtime config
shell: bash
run: |
mkdir -p data/user/settings
cat > data/user/settings/main.yaml <<'YAML'
system:
language: en
logging:
level: WARNING
YAML
cp tests/fixtures/ci_model_catalog.json data/user/settings/model_catalog.json
- name: Run Python tests (baseline)
run: pytest -q -rA --durations=25 --junitxml=windows-pytest.xml tests deeptutor/learning/tests
env:
# cp1252 is the default code page on the Windows runners; without these
# the encoding failures in #2354 mask the rest of the run.
PYTHONIOENCODING: utf-8
PYTHONUTF8: "1"
PYTHONPATH: ${{ github.workspace }}
- name: Summarize the baseline
if: always()
shell: bash
run: |
python - <<'PY'
import collections, glob, os, sys, xml.etree.ElementTree as ET
reports = glob.glob("windows-pytest.xml")
if not reports:
print("no junit report: the run did not reach the test step")
sys.exit(0)
passed = failed = skipped = 0
per_file = collections.Counter()
for case in ET.parse(reports[0]).iter("testcase"):
outcomes = [child.tag for child in case]
if "failure" in outcomes or "error" in outcomes:
failed += 1
parts = case.get("classname", "").split(".")
for index, part in enumerate(parts):
if part[:1].isupper():
parts = parts[:index]
break
per_file[".".join(parts) or "?"] += 1
elif "skipped" in outcomes:
skipped += 1
else:
passed += 1
summary = f"{passed} passed, {failed} failed, {skipped} skipped"
print(summary)
for name, count in per_file.most_common(10):
print(f" {count:>3} {name}")
if os.environ.get("GITHUB_STEP_SUMMARY"):
with open(os.environ["GITHUB_STEP_SUMMARY"], "a", encoding="utf-8") as fh:
fh.write(f"### Windows baseline\n\n{summary}\n\n")
for name, count in per_file.most_common(10):
fh.write(f"- {count} x `{name}`\n")
PY
- name: Upload junit report
if: always()
uses: actions/upload-artifact@v4
with:
name: windows-pytest-report
path: windows-pytest.xml
if-no-files-found: ignore
video-lesson-sandbox:
name: Video lesson isolation (${{ matrix.os }})
runs-on: ${{ matrix.os }}