File tree Expand file tree Collapse file tree 2 files changed +30
-5
lines changed
Expand file tree Collapse file tree 2 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -16,10 +16,21 @@ jobs:
1616 strategy :
1717 fail-fast : false
1818 matrix :
19- test_type :
20- - collections
21- - topics
22- - all
19+ include :
20+ - test_type : topics
21+ - test_type : collections
22+ shard : 0
23+ total_shards : 4
24+ - test_type : collections
25+ shard : 1
26+ total_shards : 4
27+ - test_type : collections
28+ shard : 2
29+ total_shards : 4
30+ - test_type : collections
31+ shard : 3
32+ total_shards : 4
33+ - test_type : all
2334 runs-on : ubuntu-latest
2435 steps :
2536 - uses : actions/checkout@v6.0.1
5869 TOPIC_FILES : ${{ steps.topics.outputs.changed }}
5970 COLLECTION_FILES : ${{ steps.collections.outputs.changed }}
6071 TEST_ALL_FILES : ${{ steps.all.outputs.changed }}
72+ COLLECTION_SHARD : ${{ matrix.shard }}
73+ COLLECTION_TOTAL_SHARDS : ${{ matrix.total_shards }}
Original file line number Diff line number Diff line change @@ -53,7 +53,19 @@ def dirs_to_test
5353end
5454
5555def collections
56- collection_dirs . map { |dir_path | File . basename ( dir_path ) }
56+ all = collection_dirs . map { |dir_path | File . basename ( dir_path ) }
57+ shard_collections ( all )
58+ end
59+
60+ def shard_collections ( all_collections )
61+ shard = ENV [ "COLLECTION_SHARD" ] &.to_i
62+ total_shards = ENV [ "COLLECTION_TOTAL_SHARDS" ] &.to_i
63+
64+ return all_collections unless !shard . nil? && !total_shards . nil? && total_shards > 1
65+
66+ # Sort alphabetically for deterministic sharding
67+ sorted = all_collections . sort
68+ sorted . select . with_index { |_ , i | i % total_shards == shard }
5769end
5870
5971def items_for_collection ( collection )
You can’t perform that action at this time.
0 commit comments