There's a lot of open issues
Prepare and reuse CI timing history while parallel_tests owns test collection and sharding.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

 Project Readme

A solid green cube beside eight outlined cubes in perspective

Parallel Tests CI

Gem Version Test Lint Package Coverage

Runtime-balanced RSpec and Minitest shards for GitHub Actions, powered by parallel_tests. Timing history is collected and reused automatically.

Usage

Requires Ruby 3.3+ and either RSpec or Minitest 5.

RSpec

Add to your Gemfile and run bundle install:

gem 'parallel_tests-ci', '0.2.1', require: 'parallel_tests/ci/rspec'

RSpec matches spec/**/*_spec.rb by default and records timings automatically; no changes to spec_helper.rb are needed.

Add .github/workflows/test.yml:

name: Test
on: [push, pull_request]

permissions:
  contents: read
  actions: read

jobs:
  test:
    name: Test
    uses: dblock/parallel_tests-ci/.github/workflows/rspec.yml@v0.2.1
    with:
      shards: 8

Minitest

Add to your Gemfile and run bundle install:

gem 'parallel_tests-ci', '0.2.1', require: 'parallel_tests/ci/minitest'

Minitest matches test/**/*_test.rb by default. If your test boot does not call Bundler.require, add require 'parallel_tests/ci/minitest' to test_helper.rb. The timing hook only activates in shard workers.

Add .github/workflows/test.yml:

name: Test
on: [push, pull_request]

permissions:
  contents: read
  actions: read

jobs:
  test:
    name: Test
    uses: dblock/parallel_tests-ci/.github/workflows/minitest.yml@v0.2.1
    with:
      shards: 8

Standalone Shard Matrix Action

If you manage your own CI jobs, use the standalone action to plan RSpec or Minitest shards. It defaults to RSpec; set framework: minitest for Minitest. See the RSpec and Minitest examples, replacing uses: ./ with uses: dblock/parallel_tests-ci@v0.2.1. Unlike the reusable workflows, the standalone action only assigns files to shards; your workflow runs the tests and manages timing history.

Configuration

The workflow uses Ruby from your version file and defaults to Ubuntu. The first run groups tests by file size. Successful pushes on the default branch record timings for later runs, and PRs read them without updating history.

These inputs configure the reusable workflows.

Runners and Execution

Input Default Purpose
runs-on ubuntu-latest Runner label or JSON label array for all jobs.
timeout-minutes 360 Minutes per job, including setup; positive integer.
max-parallel 256 Concurrent worker limit (1-256).
fail-fast false Cancel remaining workers on failure.
fetch-depth 1 Checkout depth; 0 gets all history and tags.
ruby-version Empty Override the caller's Ruby version.
bundler-cache true Cache gems; false still installs them.

Suite and Setup

Input Default Purpose
shards 4 Workers (1-256), capped at test file count.
worker-name {shard.number} of {shard.count} Worker label template.
pattern spec/**/*_spec.rb (RSpec), test/**/*_test.rb (Minitest) Repository-relative test glob.
test-options [] Test framework arguments as a JSON array.
environment {} Non-secret env vars as a JSON object.
before-bundle Empty Shell setup before gem install in all jobs.
setup Empty Shell setup before tests in each worker.

Use arguments supported by the selected framework, for example test-options: '["--seed","123"]'.

Shard Grouping

Input Default Purpose
group-by auto Choose auto, filesize, or runtime.
  • auto: Use runtime history when usable timings cover at least half the selected files. Otherwise, group by file size.
  • filesize: Group by file size without reading timing history. Reusable workflows still collect fresh timings.
  • runtime: Group by runtime. Planning fails if usable timings cover fewer than half the selected files.

Artifacts

Input Default Purpose
artifacts Empty Extra files to keep, even on failure.
artifact-prefix parallel-tests-ci Artifact name prefix; unique per call.
artifact-retention-days 30 Days to keep run artifacts; 0 uses repo default.
baseline-retention-days 90 Days to keep timing history; 0 uses repo default.

See Workflow Inputs for templates, secret environments, and setup rules, and Plans and Retries for rerun behavior.

Demo

Posebook runs 1,142 examples across eight workers. Times are for the slowest successful RSpec worker, excluding setup and spec loading.

Slowest worker RSpec time: serial 395s, custom sharding 61.62s, parallel_tests alone 70.71s, parallel_tests-ci cold run 79.11s, warm run 57.59s

Contributing

See Contributing, Coding Guidance, Design, Changelog, Releasing, and Upgrading.

License

Distributed under the MIT License.