ci: 新增 CI(typecheck / test / lint / format:check,Node 20.19 与 22) - #2
Merged
Merged
Conversation
- push 到 main 与所有 PR 触发,也支持 workflow_dispatch 手动运行 - 跳过 Electron 二进制下载(typecheck / 单测不需要 Electron 运行时) - lint 与 format:check 暂以注释保留,本机确认全绿后再启用 - 注:作者本机无 Node 环境,workflow 未在本地验证,首次运行结果为准
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
做了什么
新增
.github/workflows/ci.yml:在 Ubuntu 上跑 Node20.19.0与22.x两档矩阵(Vite 7 要求^20.19 || >=22.12),依次执行:npm cinpm run typecheck(node + web 两套 tsconfig)npm test(vitest run)npm run lint(biome check)npm run format:check(biome check + prettier --check src/**/*.vue)设置
ELECTRON_SKIP_BINARY_DOWNLOAD=1:类型检查与单测不需要 Electron 运行时,跳过二进制下载可让每个 job 快不少。触发条件:
push到main、任意pull_request、以及workflow_dispatch。(注意:手动触发只有在默认分支上存在该 workflow 后才可用,也就是本 PR 合并之后。)
验证
本机没有 node/npm,所以我在临时分支上真跑了一次验证,全部步骤在两个 Node 版本上均通过:
npm ci/ typecheck / test验证用的临时分支已删除。本分支与验证版本逐行一致,唯一差别是
on: push限定为main。合并后
main上会开始跑检查,之后可以给 README 加一个 CI 状态 badge。