{"id":16535848,"url":"https://github.com/leonid-shevtsov/split_tests","last_synced_at":"2026-03-07T04:31:12.887Z","repository":{"id":17138068,"uuid":"81197918","full_name":"leonid-shevtsov/split_tests","owner":"leonid-shevtsov","description":"Utility to split test files into parallel CI containers","archived":false,"fork":false,"pushed_at":"2025-04-07T11:04:11.000Z","size":18,"stargazers_count":49,"open_issues_count":2,"forks_count":17,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-02T21:09:56.568Z","etag":null,"topics":["circle-ci","continuous-integration","travis-ci"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leonid-shevtsov.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-02-07T10:50:16.000Z","updated_at":"2025-04-07T11:04:15.000Z","dependencies_parsed_at":"2025-05-07T15:56:29.328Z","dependency_job_id":null,"html_url":"https://github.com/leonid-shevtsov/split_tests","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/leonid-shevtsov/split_tests","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonid-shevtsov%2Fsplit_tests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonid-shevtsov%2Fsplit_tests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonid-shevtsov%2Fsplit_tests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonid-shevtsov%2Fsplit_tests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leonid-shevtsov","download_url":"https://codeload.github.com/leonid-shevtsov/split_tests/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonid-shevtsov%2Fsplit_tests/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30207995,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T03:24:23.086Z","status":"ssl_error","status_checked_at":"2026-03-07T03:23:11.444Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["circle-ci","continuous-integration","travis-ci"],"created_at":"2024-10-11T18:29:04.545Z","updated_at":"2026-03-07T04:31:12.844Z","avatar_url":"https://github.com/leonid-shevtsov.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# split_tests\n\nSplits a test suite into groups of equal time, based on previous tests timings.\n\nThis is necessary for running the tests in parallel. As the execution time of test files might vary drastically, you will not get the best split by simply dividing them into even groups.\n\n## Compatibility\n\nThis tool was written for Ruby and CircleCI, but it can be used with any file-based test suite on any CI.\nSince then, CircleCI has introduced built-in test splitting. Also since then, the tool has been applied on\nGitHub Actions, that does not provide native test splitting.\n\nThere is a [split-tests GitHub Action](https://github.com/marketplace/actions/split-tests) using this tool available on the Actions Marketplace.\n\nIt is written in Golang, released as a binary, and has no external dependencies.\n\n## Usage\n\nDownload and extract the latest build from the releases page.\n\n### Using the CircleCI API\n\nGet an API key and set `CIRCLECI_API_KEY` in the project config.\n\n```\nrspec $(split_tests -circle-project github.com/leonid-shevtsov/split_tests)\n```\n\n(The tool returns the set of files for the current split, joined by spaces.)\n\n### Using a JUnit report\n\n```\nrspec $(split_tests -junit -junit-path=report.xml -split-index=$CI_NODE_INDEX -split-total=$CI_NODE_TOTAL)\n```\n\nOr, if it's easier to pipe the report file:\n\n```\nrspec $(curl http://my.junit.url | split_tests -junit -split-index=$CI_NODE_INDEX -split-total=$CI_NODE_TOTAL)\n```\n\n### Naive split by line count\n\nIf you don't have test times, it might be reasonable for your project to assume runtime proportional to test length.\n\n```\nrspec $(split_tests -line-count)\n```\n\n### Apply bias\n\nOften a specific split will not just run the test suite, but also a linter or some other quicker checks. In this case you can use the `bias` argument to balance the split better:\n\n```\n# account for 20-second linter run in split 0\nsplit_tests -bias 0=20 -junit ...\n```\n\nThe effect is that the split algorithm will assume an external delay of 20 seconds for the 0th split, and will reduce its assigned load by 20 seconds (as best it can.) Bias can be negative, too.\n\nDon't forget to specify the same bias configuration on all runners, not just the ones that have bias.\n\nThis works best when you have real test timings (JUnit or CircleCI mode.) For splits by line count, you can still find the right bias empirically - although splits by line count are never perfectly balanced anyway.\n\n### Naive split by file count\n\nIn the absence of prior test times, `split_tests` can still split files into even groups by count.\n\n```\nrspec $(split_tests)\n```\n\n## Arguments\n\n````plain\n$./split_tests -help\n\n  -bias string\n        Set bias for specific splits (if one split is doing extra work like running a linter).\n        Format: [split_index]=[bias_in_seconds],[another_index]=[another_bias],...\n  -circleci-branch string\n        Current branch for CircleCI (or set CIRCLE_BRANCH) - required to use CircleCI\n  -circleci-key string\n        CircleCI API key (or set CIRCLECI_API_KEY environment variable) - required to use CircleCI\n  -circleci-project string\n        CircleCI project name (e.g. github/leonid-shevtsov/split_tests) - required to use CircleCI\n  -exclude-glob string\n        Glob pattern to exclude test files. Make sure to single-quote.\n  -glob string\n        Glob pattern to find test files. Make sure to single-quote to avoid shell expansion. (default \"spec/**/*_spec.rb\")\n  -help\n        Show this help text\n  -junit\n        Use a JUnit XML report for test times\n  -junit-path string\n        Path to a JUnit XML report (leave empty to read from stdin; use glob pattern to load multiple files)\n  -line-count\n        Use line count to estimate test times\n  -split-index int\n        This test container's index (or set CIRCLE_NODE_INDEX) (default -1)\n  -split-total int\n        Total number of containers (or set CIRCLE_NODE_TOTAL) (default -1)\n```\n\n## Compilation\n\nThis tool is written in Go and uses Go modules.\n\n- Install Go\n- Checkout the code\n- `make`\n\n---\n\n(c) [Leonid Shevtsov](https://leonid.shevtsov.me) 2017-2020\n````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonid-shevtsov%2Fsplit_tests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleonid-shevtsov%2Fsplit_tests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonid-shevtsov%2Fsplit_tests/lists"}