make the test suite and openapi generator platform-independent

Windows checkouts turned LF into CRLF (core.autocrlf=true), and several
tests plus the openapi generator hardcoded LF or POSIX path separators.
The result was a suite that was green on Linux CI but red on Windows, and
an openapi.json whose /api/hermes/* routes silently disappeared when
generated on Windows.

Pin the repository to LF via .gitattributes, strip shebangs before
Vite's SSR transform, and key route files by their posix path. Add a
manually triggered macOS verification workflow so the same checks run
on a self-hosted macOS runner.
This commit is contained in:
2026-10-20 11:17:34 +08:00
committed by trae-solo-agent
parent 8052bf5781
commit a1fff482bf
20 changed files with 251 additions and 48 deletions
+36
View File
@@ -0,0 +1,36 @@
# 统一行尾:仓库内的文本文件一律 LF。
#
# 为什么需要:Windows 上 git 的 core.autocrlf 默认是 true,checkout 会把 LF
# 转成 CRLF。任何「按行读文件」的测试或脚本如果写死 '\n' 分割,就只会在
# Windows 上失败,而 Linux CI 上是绿的 —— 这种平台差异很难被注意到。
# 固定 LF 之后,Windows 和 Linux 拿到的是同一份字节,行为一致。
#
# 规则:
# * text=auto —— 让 git 自行判断是不是文本
# * eol=lf —— 无论平台,checkout 时都写成 LF
# -text —— 二进制文件,禁止行尾转换
* text=auto eol=lf
# 二进制资源:不参与行尾转换
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.webp binary
*.woff binary
*.woff2 binary
*.ttf binary
*.otf binary
*.eot binary
*.mp3 binary
*.mp4 binary
*.wav binary
*.pdf binary
*.zip binary
*.gz binary
*.wasm binary
# 锁文件由 npm 生成,保持原样不转换
package-lock.json -text