about summary refs log tree commit diff
path: root/library/compiler-builtins
diff options
context:
space:
mode:
authorTrevor Gross <tmgross@umich.edu>2025-01-14 07:46:20 +0000
committerTrevor Gross <tmgross@umich.edu>2025-01-15 00:57:23 +0000
commitf63ef37218c7def3efeb7a434fcfd0a2b87dcaec (patch)
tree8a856c8eaa4b4d67299e678d1a5dafc44913129a /library/compiler-builtins
parent5e65179a3912f3b293fd39b05bf8903428a86346 (diff)
downloadrust-f63ef37218c7def3efeb7a434fcfd0a2b87dcaec.tar.gz
rust-f63ef37218c7def3efeb7a434fcfd0a2b87dcaec.zip
Slightly restructure `ci/calculate-exhaustive-matrix.py`
Change this script into a generic CI utility that we will be able to
expand in the future.
Diffstat (limited to 'library/compiler-builtins')
-rw-r--r--library/compiler-builtins/libm/.github/workflows/main.yaml3
-rwxr-xr-xlibrary/compiler-builtins/libm/ci/ci-util.py (renamed from library/compiler-builtins/libm/ci/calculate-exhaustive-matrix.py)30
2 files changed, 26 insertions, 7 deletions
diff --git a/library/compiler-builtins/libm/.github/workflows/main.yaml b/library/compiler-builtins/libm/.github/workflows/main.yaml
index 30976d47262..40b67c4c251 100644
--- a/library/compiler-builtins/libm/.github/workflows/main.yaml
+++ b/library/compiler-builtins/libm/.github/workflows/main.yaml
@@ -7,7 +7,6 @@ on:
 
 env:
   CARGO_TERM_COLOR: always
-  CARGO_TERM_VERBOSE: true
   RUSTDOCFLAGS: -Dwarnings
   RUSTFLAGS: -Dwarnings
   RUST_BACKTRACE: full
@@ -202,7 +201,7 @@ jobs:
       - name: Fetch pull request ref
         run: git fetch origin "$GITHUB_REF:$GITHUB_REF"
         if: github.event_name == 'pull_request'
-      - run: python3 ci/calculate-exhaustive-matrix.py >> "$GITHUB_OUTPUT"
+      - run: python3 ci/ci-util.py generate-matrix >> "$GITHUB_OUTPUT"
         id: script
 
   extensive:
diff --git a/library/compiler-builtins/libm/ci/calculate-exhaustive-matrix.py b/library/compiler-builtins/libm/ci/ci-util.py
index 8b42f9389f9..733ec26fa33 100755
--- a/library/compiler-builtins/libm/ci/calculate-exhaustive-matrix.py
+++ b/library/compiler-builtins/libm/ci/ci-util.py
@@ -1,18 +1,30 @@
 #!/usr/bin/env python3
-"""Calculate which exhaustive tests should be run as part of CI.
+"""Utilities for CI.
 
 This dynamically prepares a list of routines that had a source file change based on
 git history.
 """
 
+import json
 import subprocess as sp
 import sys
-import json
 from dataclasses import dataclass
+from inspect import cleandoc
 from os import getenv
 from pathlib import Path
 from typing import TypedDict
 
+USAGE = cleandoc(
+    """
+    usage:
+
+    ./ci/ci-util.py <SUBCOMMAND>
+
+    SUBCOMMAND:
+        generate-matrix    Calculate a matrix of which functions had source change,
+                           print that as JSON object.
+    """
+)
 
 REPO_ROOT = Path(__file__).parent.parent
 GIT = ["git", "-C", REPO_ROOT]
@@ -139,9 +151,17 @@ def eprint(*args, **kwargs):
 
 
 def main():
-    ctx = Context()
-    output = ctx.make_workflow_output()
-    print(f"matrix={output}")
+    match sys.argv[1:]:
+        case ["generate-matrix"]:
+            ctx = Context()
+            output = ctx.make_workflow_output()
+            print(f"matrix={output}")
+        case ["--help" | "-h"]:
+            print(USAGE)
+            exit()
+        case _:
+            eprint(USAGE)
+            exit(1)
 
 
 if __name__ == "__main__":