Skip to content

Commit e76b7db

Browse files
committed
fix(ci): Windows 平台 job 用 ASCII 断言并开 UTF-8 输出(避开区域设置转义)
1 parent 580f7b2 commit e76b7db

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎.github/workflows/ci.yml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ jobs:
4242
platform:
4343
runs-on: windows-latest
4444
timeout-minutes: 5
45+
env:
46+
# 中文文案在英文区域设置下会被 Python 的 backslashreplace 转义成 \uXXXX,
47+
# 打开 UTF-8 模式让日志里看到的是人能读的中文(不影响被测逻辑)。
48+
PYTHONUTF8: "1"
4549
steps:
4650
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
4751
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
@@ -60,7 +64,9 @@ jobs:
6064
set -e
6165
echo "$output"
6266
test "$code" -ne 0
63-
echo "$output" | grep -q "仅 Linux / macOS"
67+
# 只断言 ASCII 片段:Windows 英文区域设置下中文会被转义成 \uXXXX,
68+
# 用中文 grep 会因编码而假失败(PYTHONUTF8 只管本项目自己的输出)。
69+
echo "$output" | grep -q "Linux / macOS"
6470
if echo "$output" | grep -q "ModuleNotFoundError"; then
6571
echo "::error::Windows 上仍出现 ModuleNotFoundError(issue #46 回归)"
6672
exit 1

0 commit comments

Comments
 (0)