<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/run-your-test-suite-across-balanced-shards-e7jqavla9" -->

---
title: Run your test suite across balanced shards | daily.dev
description: Tuist introduces dynamic test sharding that distributes tests across CI runners using historical timing data instead of static, manually maintained splits. It...
canonical: https://daily.dev/posts/run-your-test-suite-across-balanced-shards-e7jqavla9
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Run your test suite across balanced shards | daily.dev
og:description: Tuist introduces dynamic test sharding that distributes tests across CI runners using historical timing data instead of static, manually maintained splits. It...
og:url: https://daily.dev/posts/run-your-test-suite-across-balanced-shards-e7jqavla9
og:image: https://api.daily.dev/og/posts/e7jqAvlA9.png
og:image:alt: Run your test suite across balanced shards
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Run your test suite across balanced shards

**[
      Tuist
    ](https://daily.dev/sources/tuist-blog)** · 4 min read · 0 upvotes · 0 comments

## Summary

Tuist introduces dynamic test sharding that distributes tests across CI runners using historical timing data instead of static, manually maintained splits. It uses a greedy Longest-Processing-Time bin-packing algorithm to balance shard durations, estimating new tests via median duration. A two-phase build/test workflow lets teams use cheaper runners for the test phase and integrates with Tuist's selective testing and test insights, with setup examples for GitHub Actions, generated projects, and Gradle.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://tuist.dev/blog/2026/03/25/test-sharding>

## Questions this post answers

### What algorithm does Tuist use to balance test shards across CI runners?

Tuist uses a greedy Longest Processing Time (LPT) bin-packing algorithm: it sorts all test units by average historical duration in descending order, then assigns each one to whichever shard currently has the lowest total duration. Tests without historical data, such as new tests, are estimated using the median duration of known tests.

_Teams optimizing CI runtime can follow how tools like Tuist balance test shards via daily.dev._

### How do I set up test sharding with Tuist and GitHub Actions for an Xcode project?

Configure a build job that runs `tuist xcodebuild build-for-testing` with a `--shard-total` flag to build test artifacts and generate a shard matrix, then a dependent test job that uses that matrix with a `TUIST_SHARD_INDEX` environment variable to run `tuist xcodebuild test` on each shard in parallel. Test sharding also supports generated projects via `tuist test` and Gradle projects through the Tuist Gradle plugin.

_daily.dev helps engineers track CI tooling changes like Tuist's sharding setup as they ship._

### Why does static test sharding become a maintenance problem as a test suite grows?

Static sharding requires manually deciding upfront which tests run on which shard, but as a codebase changes, that split drifts out of balance, leaving one shard finishing in minutes while another takes much longer. Since a CI workflow's speed is bound by the slowest shard, teams end up waiting on an overloaded runner while others sit idle, and rebalancing only happens once the pain becomes noticeable.

_daily.dev keeps developers weighing CI strategies like sharding informed on emerging tooling._

## Similar posts on daily.dev

- [Time-Based Sharding in Pest v4.6.0](https://daily.dev/posts/time-based-sharding-in-pest-v4-6-0-ymszvvnk6) · Laravel News · 0 upvotes · 0 comments
- [CircleCI Smarter Testing: Stop running tests that don't matter](https://daily.dev/posts/circleci-smarter-testing-stop-running-tests-that-don-t-matter-colzpxw8r) · CircleCI · 0 upvotes · 0 comments
- [Toss: Building less to ship faster](https://daily.dev/posts/toss-building-less-to-ship-faster-1arhtus0n) · 
      Tuist
     · 4 upvotes · 0 comments
- [Slashing CI Wait Times: How Pinterest Cut Android Testing Build Times by 36%\+](https://daily.dev/posts/slashing-ci-wait-times-how-pinterest-cut-android-testing-build-times-by-36--jaunslokn) · Pinterest Engineering · 0 upvotes · 0 comments
- [Pinterest Engineering Reduces Android CI Build Times by 36% with Runtime-Aware Sharding](https://daily.dev/posts/pinterest-engineering-reduces-android-ci-build-times-by-36-with-runtime-aware-sharding-bq3iy0uzb) · InfoQ · 0 upvotes · 0 comments

---

Tags: [#cicd](https://daily.dev/tags/cicd), [#github-actions](https://daily.dev/tags/github-actions)

[View this post on daily.dev](https://daily.dev/posts/run-your-test-suite-across-balanced-shards-e7jqavla9)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Run your test suite across balanced shards","url":"https://daily.dev/posts/run-your-test-suite-across-balanced-shards-e7jqavla9","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/run-your-test-suite-across-balanced-shards-e7jqavla9"},"datePublished":"2026-08-23T12:23:39.651Z","dateModified":"2026-08-23T12:57:46.135Z","description":"Tuist introduces dynamic test sharding that distributes tests across CI runners using historical timing data instead of static, manually maintained splits. It...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ff7a26283684ef38539c9a4edafdcb98?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ff7a26283684ef38539c9a4edafdcb98?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"\n      Tuist\n    ","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"\n      Tuist\n    ","logo":"https://media.daily.dev/image/upload/s--3AYDH23h--/f_auto,q_auto/v1787487506/logos/tuist-blog?_a=BAMAMicg0","url":"https://daily.dev/sources/tuist-blog"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/run-your-test-suite-across-balanced-shards-e7jqavla9","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"cicd,github-actions","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"\n      Tuist\n    ","item":"https://daily.dev/sources/tuist-blog"},{"@type":"ListItem","position":3,"name":"Run your test suite across balanced shards"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/run-your-test-suite-across-balanced-shards-e7jqavla9#faq","mainEntity":[{"@type":"Question","name":"What algorithm does Tuist use to balance test shards across CI runners?","acceptedAnswer":{"@type":"Answer","text":"Tuist uses a greedy Longest Processing Time (LPT) bin-packing algorithm: it sorts all test units by average historical duration in descending order, then assigns each one to whichever shard currently has the lowest total duration. Tests without historical data, such as new tests, are estimated using the median duration of known tests. Teams optimizing CI runtime can follow how tools like Tuist balance test shards via daily.dev."}},{"@type":"Question","name":"How do I set up test sharding with Tuist and GitHub Actions for an Xcode project?","acceptedAnswer":{"@type":"Answer","text":"Configure a build job that runs `tuist xcodebuild build-for-testing` with a `--shard-total` flag to build test artifacts and generate a shard matrix, then a dependent test job that uses that matrix with a `TUIST_SHARD_INDEX` environment variable to run `tuist xcodebuild test` on each shard in parallel. Test sharding also supports generated projects via `tuist test` and Gradle projects through the Tuist Gradle plugin. daily.dev helps engineers track CI tooling changes like Tuist's sharding setup as they ship."}},{"@type":"Question","name":"Why does static test sharding become a maintenance problem as a test suite grows?","acceptedAnswer":{"@type":"Answer","text":"Static sharding requires manually deciding upfront which tests run on which shard, but as a codebase changes, that split drifts out of balance, leaving one shard finishing in minutes while another takes much longer. Since a CI workflow's speed is bound by the slowest shard, teams end up waiting on an overloaded runner while others sit idle, and rebalancing only happens once the pain becomes noticeable. daily.dev keeps developers weighing CI strategies like sharding informed on emerging tooling."}}]}
```

