diff --git a/.husky/pre-push b/.husky/pre-push deleted file mode 100644 index 052d28f..0000000 --- a/.husky/pre-push +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -# Skip the build + test suite when a push carries only documentation -# (*.md or anything under docs/). Mirrors the `changes` gate in -# .github/workflows/pr.yml so docs-only pushes stay fast. When the range -# can't be determined we fall through and run the full suite. -z40=0000000000000000000000000000000000000000 -skip=1 -saw_ref=0 - -while read -r local_ref local_sha remote_ref remote_sha; do - saw_ref=1 - [ "$local_sha" = "$z40" ] && continue # branch deletion — nothing to build - if [ "$remote_sha" = "$z40" ]; then - base=$(git merge-base origin/main "$local_sha" 2>/dev/null) || base="" - [ -z "$base" ] && { skip=0; continue; } # unknown base — be safe, build - range="$base $local_sha" - else - range="$remote_sha $local_sha" - fi - changed=$(git diff --name-only $range 2>/dev/null) || { skip=0; continue; } - echo "$changed" | grep -qvE '(\.md$|^docs/)' && skip=0 -done - -[ "$saw_ref" = "0" ] && skip=0 - -if [ "$skip" = "1" ]; then - echo "pre-push: docs-only change — skipping build + test." - exit 0 -fi - -dotnet tool restore >/dev/null -dotnet husky run --group pre-push diff --git a/.husky/task-runner.json b/.husky/task-runner.json index d313f35..89f42ba 100644 --- a/.husky/task-runner.json +++ b/.husky/task-runner.json @@ -6,26 +6,6 @@ "group": "pre-commit", "command": "dotnet", "args": ["csharpier", "check", "."] - }, - { - "name": "build", - "group": "pre-push", - "command": "dotnet", - "args": ["build", "--nologo", "--verbosity", "minimal"] - }, - { - "name": "test", - "group": "pre-push", - "command": "dotnet", - "args": [ - "test", - "--no-build", - "--nologo", - "--verbosity", - "minimal", - "--filter", - "Category!=Integration" - ] } ] } diff --git a/README.md b/README.md index e35cd48..76aff46 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,7 @@ dotnet build dotnet test --filter "Category!=Integration" ``` -Local hooks (CSharpier formatter check on commit, build + tests on push) install on first contributor run via `dotnet husky install`. +A local CSharpier formatter check on commit installs on first contributor run via `dotnet husky install`. Build and tests run in CI, not on push. ## License diff --git a/docs/CONTRIBUTING.jp.md b/docs/CONTRIBUTING.jp.md index 382d4f6..4f1f0b1 100644 --- a/docs/CONTRIBUTING.jp.md +++ b/docs/CONTRIBUTING.jp.md @@ -23,7 +23,7 @@ GitHub Flow(単一の `main`、短命の topic branch、squash-merge、Convent ## ローカル hooks -Husky.Net の pre-commit が CSharpier を実行、pre-push が `dotnet build` + `dotnet test --filter "Category!=Integration"` を実行 — [ADR 0025](adr/0025-dev-automation-hooks.md) を参照。 +Husky.Net の pre-commit が CSharpier を実行します。build とテストは push 時には走らせず CI(`pr.yml`)の担当 — [ADR 0025](adr/0025-dev-automation-hooks.md) を参照。 ## CI ゲーティング @@ -41,7 +41,7 @@ Clean Architecture + DDD + handler レベル CQRS([ADR 0003](adr/0003-architec xUnit + Shouldly + Testably.Abstractions。テストは `src/` を 1:1 でミラー (`IviCli..Tests`)。挙動変更には TDD(Red → Green → Refactor)を採用してください。 -Integration テストは `[Trait("Category", "Integration")]` を付与し、pre-push hook と PR ビルドでは既定で skip され、`nightly.yml` で実行されます。 +Integration テストは `[Trait("Category", "Integration")]` を付与し、PR ビルドでは既定で skip され、`nightly.yml` で実行されます。 ## ADR diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 7fe082b..6fbff09 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -23,7 +23,7 @@ GitHub Flow (single `main`, short-lived topic branches, squash-merge, Convention ## Local hooks -Husky.Net pre-commit runs CSharpier; pre-push runs `dotnet build` + `dotnet test --filter "Category!=Integration"` — see [ADR 0025](adr/0025-dev-automation-hooks.md). +Husky.Net pre-commit runs CSharpier. Build and tests are not run on push — that is CI's job (`pr.yml`) — see [ADR 0025](adr/0025-dev-automation-hooks.md). ## CI gating @@ -41,7 +41,7 @@ Clean Architecture + DDD + handler-level CQRS (see [ADR 0003](adr/0003-architect xUnit + Shouldly + Testably.Abstractions. Tests mirror `src/` 1:1 (`IviCli..Tests`). TDD (Red → Green → Refactor) is expected for behavioural changes. -Integration tests carry `[Trait("Category", "Integration")]`; they are skipped by default in the pre-push hook and PR build, and run on `nightly.yml`. +Integration tests carry `[Trait("Category", "Integration")]`; they are skipped by default in the PR build, and run on `nightly.yml`. ## ADRs diff --git a/docs/README.jp.md b/docs/README.jp.md index a14926d..8dd5664 100644 --- a/docs/README.jp.md +++ b/docs/README.jp.md @@ -188,7 +188,7 @@ dotnet build dotnet test --filter "Category!=Integration" ``` -ローカル hooks (commit 時 CSharpier formatter チェック、push 時 build + tests) は初回 `dotnet husky install` で導入されます。 +ローカルの CSharpier formatter チェック (commit 時) は初回 `dotnet husky install` で導入されます。build とテストは push 時ではなく CI で実行されます。 ## ライセンス diff --git a/docs/adr/0025-dev-automation-hooks.md b/docs/adr/0025-dev-automation-hooks.md index 4c8d3bb..4dc5a9f 100644 --- a/docs/adr/0025-dev-automation-hooks.md +++ b/docs/adr/0025-dev-automation-hooks.md @@ -54,15 +54,18 @@ Rationale: - CSharpier's output is deterministic across machines, so violations are unambiguous. - pre-commit must stay fast (sub-second). Format check qualifies; tests do not. -### 4. pre-push: build + unit/architecture tests +### 4. pre-push: no build or tests (CI owns them) -Run **`dotnet build`** followed by **`dotnet test --filter "Category!=Integration"`** on push. If either fails, the push is rejected. +Pre-push runs nothing. Build and `dotnet test --filter "Category!=Integration"` run in CI (`pr.yml`) on every PR, in a clean environment with `--locked-mode`. There is no `.husky/pre-push` hook. Rationale: -- Squash merge means individual commit greenness does not survive to `main`, so blocking every commit with tests fights TDD's Red phase commits unnecessarily. -- Pre-push is the latest local moment to catch broken code before it touches the remote. -- Integration tests are excluded (per ADR 0009) — they belong in nightly / manual CI runs. +- The pre-push build + test duplicated the PR CI gate while diverging from it: a local run has no `--locked-mode` and a different SDK / OS, so a local pass did not imply a CI pass and a local failure was sometimes environmental. CI is the authoritative build / test gate. +- It added minutes of latency to every non-docs push, and — bypassable with `--no-verify` — was never a hard gate anyway. +- Keeping it usable had required a docs-only skip script that re-implemented CI's changed-files logic locally; a second copy that could drift. Removing the tests removes the need for the skip. +- Squash merge means individual commit greenness does not survive to `main`, so there is little value in blocking each local push on the full suite. + +The original decision ran `dotnet build` + `dotnet test` on push; it is superseded here. ### 5. Claude Code PostToolUse hook: auto-format edited C# files @@ -88,11 +91,9 @@ No local `commit-msg` hook is configured. - CONTRIBUTING (when written) will reiterate this norm. - The CI checks on the server side enforce the same rules regardless of local bypass. -### 8. File-type filtering: deferred - -A `staged-file-type` filter (skipping format/test when only docs are changed, etc.) is **not** introduced in Phase 1. Test runs are expected to be sub-second for the foreseeable future, so the simplicity of unconditional execution is preferred. +### 8. File-type filtering: not needed -If pre-push run time exceeds a few seconds on a routine basis, this decision is revisited. +No `staged-file-type` filter is required. The only local hook is the pre-commit CSharpier check, which inspects C# and is a no-op on docs-only changes. (An earlier revision briefly ran tests on push behind a docs-only skip script; §4 removed both.) ### 9. Branch-aware policy: not adopted @@ -112,14 +113,7 @@ dotnet tool restore >/dev/null dotnet husky run --group pre-commit ``` -`.husky/pre-push`: - -```sh -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" -dotnet tool restore >/dev/null -dotnet husky run --group pre-push -``` +There is no `.husky/pre-push` (§4). `.claude/settings.json` (PostToolUse hook for CSharpier):