diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d7eb768..6bc6209 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,4 @@ -# PR-time test gate with native Linux, Windows, and macOS coverage. -# Race checks remain on master/manual runs. +# PR-time test gate with native Linux, Windows, macOS, and Go race coverage. # # Two PR jobs call the same subtasks used by the local `task check` entrypoint: # - lint: `task check:static` covers documentation drift, Go vet/gofmt, and @@ -10,8 +9,8 @@ # - test: `task check:test` builds bin/one then runs Go + Dashboard tests. # Build is required because tests/e2e snapshot tests skip when # bin/one is missing. -# Native Windows and macOS jobs also run on every PR. The master ruleset -# requires lint, test, test-windows, and test-macos before merging. +# Native Windows, macOS, and Go race jobs also run on every PR. The master +# ruleset requires lint, test, test-windows, test-macos, and test-race before merging. # # Both jobs need Node + pnpm because sync-web runs `pnpm install` + # `vite build` against apps/dashboard/. @@ -212,9 +211,7 @@ jobs: run: task check test-race: - # Race tests are useful but slow on GitHub-hosted runners. Keep them off - # the PR critical path and run them before/after merging to master. - if: github.event_name != 'pull_request' + # Catch Go data races before merging, alongside the other required jobs. runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 @@ -271,11 +268,9 @@ jobs: exit 1 fi - - name: Build binary - run: task build - - - name: Run tests - run: task test + - name: Run Go race tests + # test:go builds the CLI for E2E coverage; Dashboard tests run in test. + run: task test:go test-macos: # Run before merging so macOS path and process regressions block PRs. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 372aa57..1e99d7a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -56,15 +56,16 @@ task pre-push # 推前必跑(含上面所有 + verify-docs) pre-commit hook 会自动运行与 PR CI 相同的 `task check`;如果当前 checkout 尚未 启用 hook,先运行 `task hooks:install`。hook 会拒绝混合已暂存、未暂存或未跟踪的 文件,确保本地检查的内容与即将提交、随后由 CI 检查的快照一致 -4. **必跑** `task pre-push` 全绿(在 PR gate 之外额外运行 Go race detector) +4. **必跑** `task pre-push` 全绿(包含 Go race detector) 5. 推送 + 开 PR -PR CI 在 Linux 上并行执行 `task check:static` 与 `task check:test`,同时在 -Windows 上执行 `task check`、macOS 上执行 `task check:test`。master 的保护规则 -要求 `lint`、`test`、`test-windows`、`test-macos` 四项检查全部通过才能合并。 +PR CI 在 Linux 上并行执行 `task check:static`、`task check:test` 与 +`task test:go`(Go race detector),同时在 Windows 上执行 `task check`、 +macOS 上执行 `task check:test`。master 的保护规则要求 `lint`、`test`、 +`test-windows`、`test-macos`、`test-race` 五项检查全部通过才能合并。 本地 `task check` 和 `task pre-push` 只验证当前操作系统,不能代替其他平台的 -CI;`task pre-push` 额外运行 Go race detector,远端 race 检查保留在 master -和手动触发的工作流中。 +CI;`task pre-push` 额外运行 Go race detector。远端五项检查会在 PR、master +推送和手动触发的工作流中运行。 ## 改不同部分的注意事项