Project

binpacker

0.0
The project is in a healthy, maintained state
A test runner wrapper that models test distribution as an identical-machines scheduling problem and assigns tests to worker processes using LPT scheduling, with optional work-stealing.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

binpacker

Gem Version GitHub License

A test runner wrapper that reduces CI makespan by scheduling the identical-machines scheduling problem: assign tests to N worker processes so that the maximum worker runtime is minimized. This is closely related to the bin packing problem. It ships MultiFit (default) and LPT (Longest Processing Time first) algorithms, with optional work-stealing between workers at runtime.

Setup

Agent-driven setup (recommended)

binpacker ships an agent-driven install and setup flow. Paste this to your AI coding agent (Claude Code, Cursor, etc.) and it will install binpacker and walk the setup interactively:

Install binpacker in this project by following the instructions at
https://raw.githubusercontent.com/rigortype/binpacker/master/docs/install.md

The agent installs the gem, runs binpacker describe to inspect the project, and follows the recommended skill (binpacker-setup or binpacker-improve). See docs/design/agent-workflows.md.

Manual setup

Install the gem:

gem install binpacker

Add a binpacker.yml at your project root:

profiles:
  default:
    test_runner: rspec
    workers: auto
    timing_file: binpacker.timings
    test_pattern: "spec/**/*_spec.rb"
    scheduler:
      algorithm: multifit
      steal_enabled: true
  ci:
    extends: default
    workers: 4

For Minitest projects, set test_runner: minitest and use your test glob:

profiles:
  default:
    test_runner: minitest
    workers: auto
    timing_file: binpacker.timings
    test_pattern: "test/**/*_test.rb"
    scheduler:
      algorithm: multifit
      steal_enabled: true

Run calibration once to seed timing data (required before the first parallel run):

binpacker calibrate
# after adding new specs, measure only the ones without timing data:
binpacker calibrate --incremental

Then run your suite in parallel:

binpacker run
# or pass arguments through to the test runner:
binpacker run -- --tag ~slow
binpacker run -- --name /UserTest#test_creates/

workers: auto uses the number of available CPU cores. Set BINPACKER_PROFILE=ci or pass --profile ci to select a profile; CI environments (GitHub Actions, GitLab CI, Jenkins) are auto-detected and fall back to the ci profile when present.

Roadmap

  • Container/machine-level workers — extend the Worker model beyond single-job processes to distribute Tests across containers or machines.

License

Mozilla Public License Version 2.0. See LICENSE.