From 8218b961a96f66b930221ab1950e4c5682d37ff5 Mon Sep 17 00:00:00 2001 From: luojiyin Date: Mon, 10 Aug 2026 18:25:15 +0800 Subject: [PATCH 1/2] ci: add quality gate and coverage report Closes deerwork-ai/deer-workflow#10 Co-authored-by: Codex --- .github/workflows/check.yml | 31 +++++++++++++++++++++++++++++++ AGENTS.md | 1 + docs/index.md | 1 + docs/index.zh-CN.md | 1 + package.json | 1 + 5 files changed, 35 insertions(+) create mode 100644 .github/workflows/check.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..75f3229 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,31 @@ +name: Check + +on: + push: + branches: [main] + pull_request: + +permissions: + contents: read + +jobs: + check: + name: Quality gate + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Bun + uses: oven-sh/setup-bun@v2 + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: Run quality gate + run: bun run check + + - name: Report test coverage + run: bun run test:coverage diff --git a/AGENTS.md b/AGENTS.md index fdf01f4..8136b2d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -173,6 +173,7 @@ The root `package.json` is the source of truth for project commands: | `bun run lint:staged` | Run the pre-commit checks against Git-staged files. | | `bun run prepare` | Install the repository-managed Husky hooks. | | `bun test` | Run every test under the top-level `tests/` directory. | +| `bun run test:coverage` | Run every test and print the Bun coverage report. | | `bun run typecheck` | Type-check both `src/` and `tests/` without emitting files. | | `bun run check` | Run type-checking, lint, format checks, and the complete test suite. | diff --git a/docs/index.md b/docs/index.md index 5af2825..952c45e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -369,6 +369,7 @@ The root `package.json` is the source of truth for project commands: | `bun run lint:staged` | Run pre-commit checks against Git-staged files. | | `bun run prepare` | Install the repository-managed Husky hooks. | | `bun test` | Run every test under the top-level `tests/` directory. | +| `bun run test:coverage` | Run every test and print the Bun coverage report. | | `bun run typecheck` | Type-check `src/` and `tests/` without emitting files. | | `bun run check` | Run type-checking, lint, formatting, and all tests. | diff --git a/docs/index.zh-CN.md b/docs/index.zh-CN.md index ed360a4..6a26af0 100644 --- a/docs/index.zh-CN.md +++ b/docs/index.zh-CN.md @@ -347,6 +347,7 @@ bun run check | `bun run lint:staged` | 对 Git 暂存文件运行 pre-commit 检查。 | | `bun run prepare` | 安装仓库管理的 Husky Hooks。 | | `bun test` | 运行顶层 `tests/` 目录下的全部测试。 | +| `bun run test:coverage` | 运行全部测试并输出 Bun 覆盖率报告。 | | `bun run typecheck` | 对 `src/` 和 `tests/` 执行类型检查,但不输出文件。 | | `bun run check` | 运行类型检查、Lint、格式检查和全部测试。 | diff --git a/package.json b/package.json index 098f795..5658e26 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "format:check": "prettier . --check", "lint:staged": "lint-staged", "test": "bun test", + "test:coverage": "bun test --coverage", "typecheck": "bunx tsc --noEmit", "check": "bun run typecheck && bun run lint && bun run format:check && bun test", "prepare": "husky" From 7ba2e01585132b8e0ce23602618af1f9bf159764 Mon Sep 17 00:00:00 2001 From: luojiyin Date: Mon, 10 Aug 2026 18:35:10 +0800 Subject: [PATCH 2/2] ci(check): align action and Bun versions Co-authored-by: Codex --- .github/workflows/check.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 75f3229..1511607 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -16,10 +16,12 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Set up Bun uses: oven-sh/setup-bun@v2 + with: + bun-version: 1.3.14 - name: Install dependencies run: bun install --frozen-lockfile