Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
b5cb4b5
Add docs
franciszekjob Jan 19, 2026
6188f3f
Merge branch '3548-partitioning-logic' of https://github.com/foundry-…
franciszekjob Jan 19, 2026
8f96f8d
Merge branch '3548-partitioning-logic' of https://github.com/foundry-…
franciszekjob Jan 20, 2026
bf81040
Merge branch '3548-partition-summary-message' of https://github.com/f…
franciszekjob Jan 20, 2026
80e81db
Merge branch '3548-partitioning-logic' into 3548-partitioning-docs
franciszekjob Jan 20, 2026
45a50c4
Merge branch '3548-partitioning-logic' into 3548-partitioning-docs
franciszekjob Jan 20, 2026
79743c6
Review
franciszekjob Jan 20, 2026
08e58c8
Merge branch '3548-partitioning-docs' of https://github.com/foundry-r…
franciszekjob Jan 20, 2026
9f7f9c3
Merge branch '3548-partition-summary-message' of https://github.com/f…
franciszekjob Jan 20, 2026
57e7198
Merge branch '3548-partition-summary-message' into 3548-partitioning-…
franciszekjob Jan 20, 2026
77e4537
Merge branch '3548-partition-summary-message' of https://github.com/f…
franciszekjob Jan 20, 2026
14f7d12
Fixes
franciszekjob Jan 20, 2026
7e3d873
Merge branch '3548-partitioning-docs' of https://github.com/foundry-r…
franciszekjob Jan 20, 2026
8e0f9ff
Merge branch '3548-partition-summary-message' into 3548-partitioning-…
franciszekjob Jan 20, 2026
99bb692
Merge branch '3548-partition-summary-message' into 3548-partitioning-…
franciszekjob Jan 20, 2026
c46a236
Merge branch '3548-partition-summary-message' into 3548-partitioning-…
franciszekjob Jan 20, 2026
8720ca6
Merge branch '3548-partition-summary-message' into 3548-partitioning-…
franciszekjob Jan 20, 2026
d56e743
Merge branch '3548-partition-summary-message' into 3548-partitioning-…
franciszekjob Jan 21, 2026
993f497
Merge branch '3548-partition-summary-message' into 3548-partitioning-…
franciszekjob Jan 21, 2026
5736386
Merge branch '3548-partition-summary-message' into 3548-partitioning-…
franciszekjob Jan 21, 2026
3c7e13d
Fix newline
franciszekjob Jan 27, 2026
d36bd69
Merge branch '3548-partitioning-docs' of https://github.com/foundry-r…
franciszekjob Jan 27, 2026
48b9ed9
Merge branch '3548-partition-summary-message' of https://github.com/f…
franciszekjob Jan 27, 2026
fabc64f
Merge branch '3548-partition-summary-message' into 3548-partitioning-…
franciszekjob Feb 2, 2026
3bf334e
Update docs
franciszekjob Feb 2, 2026
3b5fd8f
Merge branch '3548-partition-summary-message' into 3548-partitioning-…
franciszekjob Feb 2, 2026
ed0cad9
Merge branch '3548-partition-summary-message' into 3548-partitioning-…
franciszekjob Feb 4, 2026
dcde981
Merge branch '3548-partition-summary-message' into 3548-partitioning-…
franciszekjob Feb 4, 2026
d8e9962
Merge branch '3548-partition-summary-message' into 3548-partitioning-…
franciszekjob Feb 4, 2026
c2d290e
Merge branch '3548-partition-summary-message' of https://github.com/f…
franciszekjob Feb 4, 2026
e12f636
Add missing file
franciszekjob Feb 4, 2026
ff815dc
Merge branch '3548-partition-summary-message' of https://github.com/f…
franciszekjob Feb 5, 2026
d6bb562
Merge branch '3548-partition-summary-message' into 3548-partitioning-…
franciszekjob Feb 5, 2026
f5136dd
Merge branch '3548-partition-summary-message' of https://github.com/f…
franciszekjob Feb 5, 2026
46ebd9c
Merge branch '3548-partition-summary-message' of https://github.com/f…
franciszekjob Feb 5, 2026
1f21296
Merge branch '3548-partition-summary-message' into 3548-partitioning-…
franciszekjob Feb 5, 2026
26bf1c7
Merge branch '3548-partition-summary-message' into 3548-partitioning-…
franciszekjob Feb 5, 2026
461910a
Merge branch '3548-partition-summary-message' of https://github.com/f…
franciszekjob Feb 5, 2026
ef99d39
Merge branch '3548-partition-summary-message' into 3548-partitioning-…
franciszekjob Feb 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Forge

#### Added

- Partitioned test execution with `--partition <INDEX/TOTAL>` flag. Read more [here](https://foundry-rs.github.io/starknet-foundry/snforge-advanced-features/tests-partitioning.html)

## [0.55.0] - 2026-01-13

## Forge
### Forge

#### Changed

Expand Down
1 change: 1 addition & 0 deletions docs/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ level = 0

[preprocessor.variables.variables]
snforge_std_version = "0.55.0"
matrix.partition = "{{ matrix.partition }}"
28 changes: 28 additions & 0 deletions docs/example_workflows/partitioned_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: My workflow

on:
push:
pull_request:

jobs:
check:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
partition: [ 1, 2, 3, 4 ]
steps:
- uses: actions/checkout@v4

- name: Setup Starknet Foundry
uses: foundry-rs/setup-snfoundry@v3

- name: Setup Scarb
uses: software-mansion/setup-scarb@v1
with:
scarb-lock: ./hello_starknet/Scarb.lock

- name: Run tests
run: |
cd hello_starknet
snforge test --partition '${{ matrix.partition }}/4'
14 changes: 14 additions & 0 deletions docs/listings/tests_partitioning/Scarb.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "tests_partitioning"
version = "0.1.0"
edition = "2024_07"

[dependencies]
starknet = "2.12.0"
assert_macros = "2.12.0"

[dev-dependencies]
snforge_std = { path = "../../../snforge_std" }

[scripts]
test = "snforge test"
5 changes: 5 additions & 0 deletions docs/listings/tests_partitioning/src/lib.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#[starknet::contract]
pub mod HelloStarknet {
#[storage]
struct Storage {}
}
34 changes: 34 additions & 0 deletions docs/listings/tests_partitioning/tests/example.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#[test]
fn test_a() {
assert_eq!(1 + 1, 2);
}

#[test]
fn test_b() {
assert_eq!(1 + 1, 2);
}

#[test]
fn test_c() {
assert_eq!(1 + 1, 2);
}

#[test]
fn test_d() {
assert_eq!(1 + 1, 2);
}

#[test]
fn test_e() {
assert_eq!(1 + 1, 2);
}

#[test]
fn test_f() {
assert_eq!(1 + 1, 2);
}

#[test]
fn test_g() {
assert_eq!(1 + 1, 2);
}
1 change: 1 addition & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
* [Debugging](snforge-advanced-features/debugging.md)
* [Oracles](snforge-advanced-features/oracles.md)
* [Parametrized Tests](snforge-advanced-features/parametrized-testing.md)
* [Tests Partitioning](snforge-advanced-features/tests-partitioning.md)

---

Expand Down
5 changes: 5 additions & 0 deletions docs/src/appendix/snforge/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ To learn more about fee calculation formula (and the impact of tracking sierra g
## `--gas-report`
Display a table of L2 gas breakdown for each contract and selector.

## `--partition <INDEX/TOTAL>`

If specified, divides tests into partitions and runs specified partition.
`<PARTITION>` is in the format `INDEX/TOTAL`, where `INDEX` is the 1-based index of the partition to run, and `TOTAL` is the number of partitions.

## `-P`, `--profile` `<PROFILE>`
Specify the profile to use by name.

Expand Down
10 changes: 10 additions & 0 deletions docs/src/appendix/starknet-foundry-github-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,13 @@ Make sure you pass the valid path to `Scarb.lock` to [setup-scarb](https://githu
```yml
{{#include ../../example_workflows/basic_workflow.yml}}
```

## Workflow With Partitioned Tests

If you have a large number of tests, you can speed up your CI by partitioning tests and running them in parallel jobs. Here's an example workflow that demonstrates how to achieve this:

```yml
{{#include ../../example_workflows/partitioned_workflow.yml}}
```

Read more about [tests partitioning here](../snforge-advanced-features/tests-partitioning.md).
44 changes: 44 additions & 0 deletions docs/src/snforge-advanced-features/tests-partitioning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Tests Partitioning

When your test suite contains a large number of tests (especially fuzz tests), it can be helpful to split them into partitions and run each partition separately, for example in parallel CI jobs.


`snforge` supports this via the `--partition <INDEX/TOTAL>` flag.

When this flag is provided, `snforge` will divide all collected tests into `TOTAL` partitions and run only the partition with the given `INDEX` (1-based).

## Example

Let's consider package with the following 7 tests:

```rust
{{#include ../../listings/tests_partitioning/tests/example.cairo}}
```

Running `snforge test --partition 1/2` will run tests `test_a`, `test_c`, `test_e`, `test_g` (4 tests), while running `snforge test --partition 2/2` will run tests `test_b`, `test_d`, `test_f` (3 tests).

<!-- { "package_name": "tests_partitioning" } -->
```shell
$ snforge test --partition 1/2
```

<details>
<summary>Output:</summary>

```shell
Collected 4 test(s) from tests_partitioning package
Running 4 test(s) from tests/
[PASS] tests_partitioning_integrationtest::example::test_a ([..])
[PASS] tests_partitioning_integrationtest::example::test_e ([..])
[PASS] tests_partitioning_integrationtest::example::test_c ([..])
[PASS] tests_partitioning_integrationtest::example::test_g ([..])
Running 0 test(s) from src/
Tests: 4 passed, 0 failed, 0 ignored, 0 filtered out

Finished partition run: 1/2
```

</details>


See example Github Actions workflow demonstrating partitioned test execution [here](../appendix/starknet-foundry-github-action.html#workflow-with-partitioned-tests).
Loading