Speed up CI: split tests across machines + fix hot spec files (cruft removal won't help)

未关闭
#2,933 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
30/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
活跃
技术栈
github-actions, ruby
领域
ci-cd, testing

调研方向

Start with the timing table: the hot spec files are spec/requests/dedupable_spec.rb, spec/services/tag_alias_seeder_spec.rb and spec/requests/events_spec.rb, and the test step runs under parallel_rspec. Splitting jobs across matrix runs means changing the CI workflow, which the payload does not name, so confirm the maintainers want that before starting. Done means a measured drop in wall-clock CI time, with the 17 pending examples handled separately.

由索引模型根据 Issue 内容生成。

描述

blocked

🤖 From Claude:

CI takes 11–13 min. Deleting old/redundant specs won't fix that: removing every cruft candidate saves only about 25s. The time goes to the test step itself and a handful of slow spec files.

Measured from the per-example timing files of one green CI run (12,769 examples).

Where the time goes (one run, 11 min total)

Step Time
Setup (containers, Ruby, npm, Vite build, DBs) ~1:40
parallel_rspec, 4 processes 9:21
  • Total example time is 34.6 min, split 4 ways. Processes finished between 7:50 and 9:14.
  • By directory: requests 16.2 min (47%), services 8.0, system 3.8, models 3.4, everything else ~3.
  • Factories are cheap (2–40ms per create), so they aren't the cause.

Cruft: low value

Candidate Examples Total time Wall-clock saved
Auth-gate request specs (guest / regular user / denied) 463 1.0 min ~15s
View specs 563 0.5 min ~8s
Scaffold-style request specs 101 0.1 min ~2s
Pending/skipped examples 17 0 0
  • Delete or fix the 17 pending examples for hygiene. It won't speed anything up.
  • Keep the auth-gate specs. They're cheap and check the real routing and redirects.

Real levers

  1. Split tests across 2–3 GitHub Actions matrix jobs (biggest win)

    • 2 machines × 4 processes → tests ~4.5 min, CI ~6.5 min. 3 machines → CI ~5 min.
    • Repo is public, so standard runners are free.
    • parallel_rspec --only-group lets each job take a share.
  2. Speed up the hot files. The top 12 files are ~35% of all example time:

    File Time Examples Per example
    spec/requests/dedupable_spec.rb 124s 113 ~1.1s
    spec/requests/events_spec.rb 81s 413
    spec/services/event_registration_services/public_registration_spec.rb 77s 110 0.7s
    spec/requests/people_dedupe_professional_licenses_spec.rb 68s 31 2.2s
    spec/services/event_dashboard_spec.rb 57s 143
    spec/services/tag_alias_seeder_spec.rb 46s 23 2s (runs the whole seeder in every example)
    • Running heavy setup once per file instead of once per example could roughly halve these, saving ~1.5 min wall clock.
  3. Group by runtime instead of file size

    • Record a runtime log (ParallelTests::RSpec::RuntimeLogger) and use --group-by runtime.
    • Evens out the 7:50 vs 9:14 spread, saving ~30–40s.
  4. Two slow system specs (11–13s each), low priority

    • community_news_index_spec.rb:170 and notification_incoming_responded_spec.rb:8.
    • Probably slow only because they run first in their process and wait for Chrome to start.
主要语言
Ruby
星标
15
派生
28
平均合并
14 小时 29 分钟
30 天内合并 PR
292

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

rubyforgood/awbw 的其他 Issue

查看 rubyforgood/awbw 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。