Skip to content

Speed up the spec suite with parallel runs and a lighter app copy - #213

Merged
OutlawAndy merged 3 commits into
masterfrom
parallel-spec-suite
Oct 12, 2026
Merged

OutlawAndy merged 3 commits into
masterfrom
parallel-spec-suite

Conversation

@OutlawAndy

@OutlawAndy OutlawAndy commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Why?

The spec suite took 5m14s locally and 7m13s on CI, which was close to the job's 10-minute timeout. It now takes about 1 minute locally and 3–5 minutes on CI.

What Changed

Run Before After
Local, one process 5m14s 2m54s
Local, bin/ci (parallel) — ~62s
CI (bin/ci, 4-core runner) 7m13s 3m02s–4m44s (two runs)
  • Generator specs no longer copy example_rails_current/node_modules for each example. That folder is untracked and absent on CI, so the specs already pass without it; generators that need packages install them. Skipping it accounts for the local one-process speedup.
  • bin/ci runs the suite with parallel_tests. Each process copies the example app into its own spec/tmp<N>, so processes do not collide.
  • CI runs bin/ci. .rspec_parallel writes one JUnit file per process when CI is set, and the report step collects tmp/rspec*.xml.

parallel_rspec loads .rspec_parallel instead of .rspec, so that file repeats --require spec_helper. Plain bundle exec rspec still uses .rspec, unchanged.

Parallel runs are now limited by the slowest single file. parallel_tests splits work by file, and modals_generator_spec has 7 examples that each run a real yarn add. I did not fake the yarn calls, because the specs check the real package.json output.

Pre-merge checklist

  • Update relevant READMEs (Testing section now covers bin/ci and running single specs)

Notes

Please don't commit version changes within your PR. Versioning, releasing, and changelog entries are managed through the Release workflow.


🤖 Generated with Claude Code

Generator specs copied the example app per example, including an
untracked node_modules that CI never has and Yarn PnP deletes anyway.
Specs now run under parallel_tests via bin/ci, each process in its own
spec/tmp<N>, with per-process JUnit output on CI.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@OutlawAndy
OutlawAndy requested a review from wesrich October 12, 2026 17:58
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Comment thread bin/ci
Comment on lines +1 to +4
#!/usr/bin/env sh
set -e

bundle exec parallel_rspec "$@"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is okay, but seems not entirely necessary to move into a separate bin/ci 🤔

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes it easier to run locally. People are familiar with calling bin/ci in the terminal

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is mostly so CI and local run the exact same command: parallel_rspec and any flags we add later live in one place, and the README can point at one entry point. Happy to inline it into ci.yml if you would rather not have the extra file.

Comment thread spec/support/helpers/example_app.rb Outdated
cleanup_test_app
FileUtils.cp_r(TEMPLATE_APP_PATH, destination_root)
FileUtils.mkdir_p(destination_root)
# node_modules is untracked, absent on CI, and removed by Yarn PnP on first use

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's weird... Are we even using Yarn PnP on this repo? I think most of them have the PnP stuff turned off (but also might be some other problematic things in our ci.yml, like missing a general node/yarn setup step in the first place)....

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wesrich I think that's correct, but I also think we should keep it. As you can see in the PR description - even without parallel tests, not copying node_modules alone (as in that's the only change) cuts the spec time in half!

@OutlawAndy OutlawAndy Oct 12, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch: the PnP reason was wrong. Generators write .yarnrc.yml with nodeLinker: node-modules before their first yarn call, so PnP never applies during specs. The real reason it is safe: node_modules is untracked and absent on CI, and the suite already passes there without it. I corrected the comment in abd2984 and fixed the PR description.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@OutlawAndy
OutlawAndy merged commit 8e5fdf6 into master Oct 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants