Some checks failed
Tests / test (push) Has been cancelled
`node --test tests/` 在 Node 22 上根本不工作 —— Node 把路径当模块加载, 报 "Cannot find module .../tests",退出码 1,零个测试执行。而这条命令在 CLAUDE.md 里被当作标准用法记了很久。这大概就是这套断言从来没人跑起来的 一个主要原因:照文档敲,得到一个看不懂的错误。 正确形式是裸 `node --test`(自动发现 **/*.test.mjs)。四处全改,并加断言 钉住 —— 我自己第一版钩子和 workflow 也照抄了那个错误形式,实测才发现 它会无条件拦住每一次 push。 - .gitea/workflows/tests.yml:Gitea 原生位置。用 node 容器而非 setup-node, 自建 Gitea 上后者要从 GitHub 拉,是新 runner 上又一个可能缺的东西。 容器 tag 与 NODE_VERSION 绑定,否则 CI 测的运行时和出货的不是一个。 - .github/workflows/tests.yml:镜像一份,断言保证两边执行内容一致。 - .githooks/pre-push:不依赖任何 runner 的兜底。实测过它会拦下失败的 push。 写明 --no-verify 怎么跳过 —— 拦不掉的钩子会被第一个被卡住的人删掉。 为什么需要钩子这一层:这台 Gitea 的 Actions 是开着的,但推上去的 workflow 产生了 0 次运行(total_count: 0),runner API 要鉴权查不了,最可能是没注册 runner。钩子是唯一完全不需要服务端支持的一层。 CLAUDE.md 补上 `git config core.hooksPath .githooks` —— 钩子是 per-clone 的, 没人替你装。
31 lines
879 B
YAML
31 lines
879 B
YAML
name: Tests
|
|
|
|
# Copy of .gitea/workflows/tests.yml, kept for if we ever move back to GitHub.
|
|
# Gitea reads both locations but which one a given instance scans depends on its
|
|
# config, so the workflow lives in .gitea/ and this is the mirror.
|
|
# tests/ci-parity.test.mjs keeps the two running the same thing.
|
|
on:
|
|
push:
|
|
branches: ['**']
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: node:22.22.1
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Node version
|
|
run: node --version
|
|
|
|
- name: Generated files are up to date
|
|
run: node portable/lib/i18n/build-messages.mjs --check
|
|
|
|
- name: Tests
|
|
# Bare `node --test` discovers **/*.test.mjs. `node --test tests/` fails
|
|
# with "Cannot find module" — Node reads the path as a module, not a dir.
|
|
run: node --test
|