diff --git a/ci-matrix.py b/ci-matrix.py index e9b882fa..65001d08 100644 --- a/ci-matrix.py +++ b/ci-matrix.py @@ -16,6 +16,7 @@ CI_TARGETS_YAML = "ci-targets.yaml" CI_RUNNERS_YAML = "ci-runners.yaml" CI_EXTRA_SKIP_LABELS = ["documentation"] +CI_MATRIX_SIZE_LIMIT = 256 # The maximum size of a matrix in GitHub Actions def meets_conditional_version(version: str, min_version: str) -> bool: @@ -246,14 +247,19 @@ def main() -> None: if runner_config.get("free") } - matrix = { - "include": generate_matrix_entries( - config, - runners, - args.platform, - labels, - ) - } + entries = generate_matrix_entries( + config, + runners, + args.platform, + labels, + ) + + matrix = {} + shards = len(entries) // CI_MATRIX_SIZE_LIMIT + for shard in len(shards): + matrix[str(shard)] = entries[ + shard * CI_MATRIX_SIZE_LIMIT : (shard + 1) * CI_MATRIX_SIZE_LIMIT + ] print(json.dumps(matrix))