Skip to content

ci: speed up test and CI workflow#23

Merged
Drumato merged 9 commits into
mainfrom
update-all
May 14, 2026
Merged

ci: speed up test and CI workflow#23
Drumato merged 9 commits into
mainfrom
update-all

Conversation

@Drumato
Copy link
Copy Markdown
Collaborator

@Drumato Drumato commented May 14, 2026

Summary

CI と `make test` の所要時間を段階的に削減する一連の改善。各コミットで 1 つずつ手を入れ、warm cache 状態で再計測しながら積み上げました。

入れた改善

  1. `-v` 除去 (test/integration/e2e): ログ削減・実行時間は微減
  2. kind cluster setup と `go build` を並列実行: ~6s 一貫削減
  3. キャッシュキー改善 (go-build を per-job + per-commit にして restore-keys でフォールバック): go.sum 更新時の cold rebuild を回避
  4. paths-ignore: docs/LICENSE/CHANGELOG-only PR で CI 全スキップ

計測結果

test lint Integration E2E Wall clock
Baseline (main #22, warm) 58s 33s 42s 126s 126s
全変更後 (warm 最良観測) 58s 48s 59s 96s 96s
全変更後 (本 PR 最新ラン) 65s 42s 51s 134s 134s

CI runner の変動 (±30s) が大きいため絶対値での評価は揺れますが、構造的な改善として:

  • go.sum 更新時の cold rebuild ペナルティを回避
  • docs-only PR は CI を完全スキップ
  • kind setup と build の並列化で一貫した数秒削減

検討したが採用しなかったもの

  • kindest/node image cache: `docker save/load` のオーバーヘッドが pull 時間と相殺し効果なし → 並列化に差し替え
  • setup-go の内蔵キャッシュへの移行: per-job スコープを失い lint への cross-job pollution を再発させるため見送り
  • Ginkgo `-procs N` 並列化: `tags-filter` namespace を 2 spec が共有しており fixture 分離が必要なため別 PR
  • integration tag の二重実行解消: 改修後 wall clock は E2E が支配項のため効果が観測しづらく見送り

Test plan

  • 全 CI ジョブが green
  • cold/warm 両方で wall time を実測
  • paths-ignore の設定が PR 全体差分ベースで評価されることを確認
  • 次回 go.sum 更新時の cold rebuild ペナルティが軽減されることを観察

🤖 Generated with Claude Code

Drumato and others added 2 commits May 14, 2026 12:41
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The -v flag prints every test name and slows test output significantly
without adding value when tests pass. Test failures still surface via
exit code and stderr.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Drumato Drumato requested a review from takutakahashi as a code owner May 14, 2026 03:49
Drumato and others added 7 commits May 14, 2026 13:00
kind create cluster pulls the ~700MB node image every run, dominating
the E2E setup time. Cache the image as a docker tarball keyed on the
image tag, save it on miss, restore via docker load on hit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
kind create cluster waits ~16s for the control plane, and go build .
takes ~17s — running them sequentially adds up. Background the build
and wait for it after kind comes up so the slower of the two governs
the step.

Also drops the kind node image cache from the previous commit since
docker save/load overhead matched the pull time it was meant to avoid.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
go-build / golangci-lint caches were keyed only on hashFiles('go.sum'),
so after the initial hit the primary key never changed and the cache
stopped accumulating new entries from later commits. When go.sum then
updated (e.g. Go 1.26.2 bump), the entire build cache had to be
rebuilt from scratch.

Add github.sha to the primary key so each commit saves a fresh cache,
and add restore-keys fallback so misses still restore the closest
prior cache (same go.sum first, OS/arch second).

go-mod cache keeps its go.sum-only primary key (modules only change
with go.sum) but gains restore-keys for fallback.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous commit unified the go-build primary key across jobs.
That made the lint job restore the test job's heavier build cache via
restore-keys, regressing lint from ~41s to ~75s (+17s in cache
restore).

Add \${{ github.job }} to the cache key so each job (test, lint,
integration, e2e) maintains its own incremental build cache lineage.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Docs-only PRs trigger the full test/lint/integration/e2e pipeline
even though no Go code is touched. Use paths-ignore to skip the
workflow when only markdown, LICENSE, .gitignore, .tagpr, or
CHANGELOG.md changed.

Mixed PRs (docs + code) still trigger CI because paths-ignore only
skips when every changed path matches the ignore list.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Temporary commit to verify CI skips docs-only changes. Will be
reverted in the next commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
paths-ignore on pull_request triggers compares against the entire
PR diff (base..head), so a docs-only commit pushed to a PR that
also has Go changes still triggers CI. The configuration is correct
for fresh docs-only PRs; the probe just isn't observable here.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Drumato Drumato merged commit 8877ba5 into main May 14, 2026
4 checks passed
@Drumato Drumato deleted the update-all branch May 15, 2026 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant