A [blog post about work-stealing for CI](https://labs.factorialhr.com/posts/work-stealing-for-ci-specbandit) caught my attention. Instead of splitting the tests into shards before the jobs start, put every test file in one queue and let each worker take a batch, then another, until the queue is empty. A fast worker takes more batches, a slow one takes fewer, and nobody waits for the unluckiest shard. Their [specbandit](https://github.com/factorialco/specbandit) implementation keeps that queue in Redis, which every worker must be able to reach. This didn’t seem possible on GitHub-hosted runners without running a database somewhere else since GitHub Actions jobs can’t reach each other, runners accept no inbound connections, and a job’s outputs only become visible after it ends.

Where there’s a will, there’s a way. We just need a TCP tunnel that can be shared. Here’s how it works.

![A coordinator job runs Valkey and opens a Pinggy TCP tunnel, uploads the tunnel's address as a workflow artifact, and the workers download it, connect through the tunnel with an OIDC token, and steal batches.](/images/posts/2026/2026-12-04-work-stealing-on-github-actions-without-a-database/how-it-works.png)

A first job of the workflow starts [Valkey](https://valkey.io) in a container and exposes it through a free [Pinggy](https://pinggy.io) TCP tunnel. It uploads the tunnel’s address as a workflow artifact, and the worker jobs download it, prove with a GitHub OIDC token that they belong to the same run, and steal work until the queue is empty. The queue lives exactly as long as the workflow, and there’s nothing to host, pay for, or secure. I packaged it into [bored-ci](https://github.com/dblock/bored-ci).

### Demo

On [Posebook](https://github.com/dblock/posebook)’s 1,253 examples across eight workers, bored-ci finished the whole workflow in a median of 133 seconds, 2.3× faster than [`parallel_tests-ci`](/2026/11/19/automatic-rspec-sharding-on-github-actions.html) (304 seconds) and 3.8× faster than running the specs serially (504 seconds).

![Posebook on eight workers, median of three runs: parallel_tests-ci, slowest worker 85.17s of RSpec and 304s of workflow; bored-ci, 67.84s and 133s.](/images/posts/2026/2026-12-04-work-stealing-on-github-actions-without-a-database/posebook-bored-ci.png)

The tests themselves aren’t much faster. The gain is in everything around them: in one `parallel_tests-ci` run, two shards took about 6 minutes each to run 1 minute of specs because their runners were slow to set up. With a queue, a slow runner just takes fewer batches.

### How to Use It

Add a coordinator job and a matrix of workers to `.github/workflows/test.yml`:

```
name: Test
on: [push, pull_request]

permissions:
  contents: read
  id-token: write

jobs:
  coordinator:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: dblock/bored-ci/coordinator@v0
        with:
          list: find spec -name '*_spec.rb'
          workers: 8

  worker:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        worker: [1, 2, 3, 4, 5, 6, 7, 8]
    steps:
      - uses: actions/checkout@v7
      - uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true
      - uses: dblock/bored-ci/worker@v0
        with:
          run: bundle exec rspec
```

### What It Does

- Batches shrink as the queue empties so the workers finish together, or, with `batch: time`, are sized by how long each file took before.
- Timings are saved in the Actions cache, and later runs restore those of their branch, then of the pull request’s base, then of the default branch, and put the slowest files first.
- Failed tests can be [retried](https://github.com/dblock/bored-ci/blob/main/docs/failures.md) one at a time, and those that then pass are reported as flaky.
- The tasks of a worker that dies go back to the queue.
- `serve: rspec` and `serve: minitest` load the app once per worker instead of once per batch.
- There are recipes for [RSpec](https://github.com/dblock/bored-ci/blob/main/docs/runners/rspec.md), [Minitest](https://github.com/dblock/bored-ci/blob/main/docs/runners/minitest.md), [Jest](https://github.com/dblock/bored-ci/blob/main/docs/runners/jest.md), [pytest](https://github.com/dblock/bored-ci/blob/main/docs/runners/pytest.md), and [Go](https://github.com/dblock/bored-ci/blob/main/docs/runners/go.md).
- The tunnel can be [Pinggy](https://github.com/dblock/bored-ci/blob/main/docs/tunnels/pinggy.md) or your own [bore](https://github.com/dblock/bored-ci/blob/main/docs/tunnels/bore.md) server.
- The [CLI](https://github.com/dblock/bored-ci/blob/main/docs/cli.md) writes the workflow with `npx bored-ci init`, previews how the workers would split the tests with `list`, runs the whole thing on your machine with `run`, and summarizes a workflow run with `status`.

It’s easy to adapt bored-ci to other frameworks. The `list` command prints one task per line and `run` gets a batch of them as arguments, so anything that can run a list of files works, and a runner that should start only once can speak the small `serve` protocol, which reads each batch on standard input and replies with the failed tasks.
