From 63717b0ea336ce0cd9c54e1b132c590ce8467ceb Mon Sep 17 00:00:00 2001 From: Jason Murray Date: Thu, 15 Oct 2026 13:47:52 -0700 Subject: [PATCH] Polish README, fix example workflow, update author --- .github/workflows/example.yaml | 6 +++--- README.md | 30 +++++++++++++++++++++++++++--- action.yml | 2 +- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/.github/workflows/example.yaml b/.github/workflows/example.yaml index 5b87e39..ccd4929 100644 --- a/.github/workflows/example.yaml +++ b/.github/workflows/example.yaml @@ -7,7 +7,7 @@ on: pull_request: types: - opened - - syncronize + - synchronize - reopened env: total-runners: 5 @@ -24,7 +24,7 @@ jobs: MAX_INDEX=$((${{ env.total-runners }}-1)) INDEX_LIST=$(seq 0 ${MAX_INDEX}) INDEX_JSON=$(jq --null-input --compact-output '. |= [inputs]' <<< ${INDEX_LIST}) - echo "::set-output name=json::${INDEX_JSON}" + echo "json=${INDEX_JSON}" >> "$GITHUB_OUTPUT" run-parallel-tests: runs-on: ubuntu-latest @@ -39,7 +39,7 @@ jobs: with: repository: eliotsykes/rspec-rails-examples path: examples/ - - uses: chaosaffe/split-tests@v1-alpha.1 + - uses: scruplelesswizard/split-tests@v1 id: split-tests name: Split tests with: diff --git a/README.md b/README.md index d3959f5..4f1b379 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,34 @@ # split-tests -_Github Action for splitting a test suite into equal time groups for parallel execution._ +[![Smoke Tests](https://github.com/scruplelesswizard/split-tests/actions/workflows/smoke-tests.yaml/badge.svg)](https://github.com/scruplelesswizard/split-tests/actions/workflows/smoke-tests.yaml) +[![Latest release](https://img.shields.io/github/v/release/scruplelesswizard/split-tests)](https://github.com/scruplelesswizard/split-tests/releases) + +_GitHub Action for splitting a test suite into equal time groups for parallel execution._ ## Introduction -This actions allows you to split up a suite of tests so they can be executed in parallel across a fleet of runners. The overall goal is to reduce developer feedback time by distributing the load. +This action splits a suite of tests so they can run in parallel across a fleet of runners. The goal is to reduce developer feedback time by distributing the load evenly, so no single runner is left running the slow tests while the others sit idle. + +- **Any test runner.** The action only decides which test _files_ each runner gets, and outputs them as a space-separated string. Pass that string to RSpec, pytest, Jest, `go test` or anything else. +- **Three ways to split:** by file count, by line count, or by real durations from a previous JUnit report. +- **Pinned and checksummed.** The `split_tests` binary is pinned to a specific release and verified by SHA256. A weekly workflow opens a PR when upstream releases a new version. + +Runs on `ubuntu` (Linux) runners only, because `split_tests` is installed as a Linux binary. + +## Quick start -Runs on `ubuntu` (Linux) runners only — `split_tests` is installed as a Linux binary. +```yaml +- uses: actions/checkout@v4 +- uses: scruplelesswizard/split-tests@v1 + id: split + with: + glob: "test/**/*_test.py" + split-total: 4 + split-index: ${{ matrix.index }} # 0..3, one per matrix job +- run: pytest ${{ steps.split.outputs.test-suite }} +``` + +The `glob` default is `spec/**/*_spec.rb` (RSpec), so set it for other languages. See the full matrix example [below](#example-workflow). ## Usage @@ -24,6 +46,8 @@ Another naive split, but this time based on the number of lines per test. It is This is the most intelligent split mechanism, using previous execution durations for each test from the JUnit report. It is used by setting the `junit-path` to the location of a previous execution's JUnit results report in your repository +Timings must be per test **file**. If your runner writes one report per worker, or per-test-case reports, merge them first with [junit-munger](https://github.com/scruplelesswizard/junit-munger), then point `junit-path` at the merged file. + ### Inputs | NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT | diff --git a/action.yml b/action.yml index db7b7d9..8513071 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,5 @@ name: Split Tests -author: chaosaffe@users.noreply.github.com +author: scruplelesswizard description: Splits test suite for parallelization with equal time inputs: split-total: