Skip to content

Commit 0c3259e

Browse files
committed
ci: restore blocking Windows test matrix
1 parent 5d5a42a commit 0c3259e

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

.github/workflows/tests.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,37 @@ jobs:
5252
- name: Run tests
5353
run: python -m pytest -p no:cacheprovider -q tests
5454

55+
windows:
56+
name: Windows / Python ${{ matrix.python-version }}
57+
runs-on: windows-2025
58+
timeout-minutes: 20
59+
strategy:
60+
fail-fast: false
61+
matrix:
62+
python-version:
63+
- "3.10"
64+
- "3.14"
65+
66+
steps:
67+
- name: Check out repository
68+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
69+
with:
70+
persist-credentials: false
71+
72+
- name: Set up Python
73+
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
74+
with:
75+
python-version: ${{ matrix.python-version }}
76+
77+
- name: Install test dependency
78+
run: python -m pip install "pytest==8.4.2"
79+
80+
- name: Compile Python source
81+
run: python -m py_compile codex-instruct.py
82+
83+
- name: Run tests
84+
run: python -m pytest -p no:cacheprovider -q tests
85+
5586
quality:
5687
name: Quality / Python 3.14
5788
runs-on: ubuntu-24.04

codex-instruct.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,14 @@ def normalize_md_name(name: str) -> str:
555555
raise ValueError("--name 不能包含 '..'")
556556
if not SAFE_NAME_RE.fullmatch(raw):
557557
raise ValueError("--name 只能包含字母、数字、点、下划线和连字符")
558+
windows_stem = raw.split(".", 1)[0].upper()
559+
if (
560+
windows_stem in {"CON", "PRN", "AUX", "NUL", "CONIN$", "CONOUT$"}
561+
or re.fullmatch(r"COM[1-9]", windows_stem)
562+
or re.fullmatch(r"LPT[1-9]", windows_stem)
563+
or raw.endswith(".")
564+
):
565+
raise ValueError("--name uses a Windows reserved device name")
558566
if raw == LEGACY_MD_FILENAME[:-3]:
559567
raise ValueError(
560568
f"--name 保留给旧版迁移,不能使用 {LEGACY_MD_FILENAME[:-3]}"

0 commit comments

Comments
 (0)