about summary refs log tree commit diff
path: root/src/ci/scripts
diff options
context:
space:
mode:
authorJakub Beránek <jakub.beranek@vsb.cz>2024-04-04 14:27:38 +0200
committerJakub Beránek <jakub.beranek@vsb.cz>2024-04-04 14:45:02 +0200
commitc22c81cbc1eebff1521a3cdefceb4c287fa8dfe5 (patch)
treed2778a239b20eb86487131f477dc21187c76da77 /src/ci/scripts
parent99c42d234064bede688a02d7076d369ecce1a513 (diff)
downloadrust-c22c81cbc1eebff1521a3cdefceb4c287fa8dfe5.tar.gz
rust-c22c81cbc1eebff1521a3cdefceb4c287fa8dfe5.zip
Generate CI job matrix for PR jobs in Python
Diffstat (limited to 'src/ci/scripts')
-rwxr-xr-xsrc/ci/scripts/calculate-job-matrix.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/ci/scripts/calculate-job-matrix.py b/src/ci/scripts/calculate-job-matrix.py
new file mode 100755
index 00000000000..9b1e74c23c3
--- /dev/null
+++ b/src/ci/scripts/calculate-job-matrix.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python3
+
+"""
+This script serves for generating a matrix of jobs that should
+be executed on CI.
+
+It reads job definitions from `src/ci/github-actions/jobs.yml`
+and filters them based on the event that happened on CI.
+
+Currently, it only supports PR builds.
+"""
+
+import json
+from pathlib import Path
+
+import yaml
+
+JOBS_YAML_PATH = Path(__file__).absolute().parent.parent / "github-actions" / "jobs.yml"
+
+
+if __name__ == "__main__":
+    with open(JOBS_YAML_PATH) as f:
+        jobs = yaml.safe_load(f)
+    job_output = jobs["pr"]
+    print(f"jobs={json.dumps(job_output)}")