GitHub Actions 多服务 CI

Monorepo 多服务 CI 设计:并行 job、各服务独立 lint/build/test、并发取消、commitlint。

#type / howto #status / growing #tech / ops #resource / github-actions

[!info] related notes

GitHub Actions 多服务 CI

设计要点

三个服务并行

jobs:
  web:       # pnpm lint + typecheck + build
  api:       # go vet + build + test
  ai-service: # ruff check + pytest

互不依赖,GitHub Actions 自动并行。总耗时 = 最慢的那个。

并发取消

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

同一分支多次 push,取消之前的运行。

各服务的工具链

服务包管理LintTest
webpnpmESLintVitest
apigo modgo vetgo test
ai-serviceuvruffpytest

Commitlint

只在 PR 时运行,校验 commit message 是否符合 Conventional Commits。

缓存

各工具链的缓存:

  • pnpm: actions/cachecache: pnpm
  • Go: actions/setup-go 内置
  • uv: astral-sh/setup-uv 内置
创建于 2026/6/25 更新于 2026/6/25