This repository was archived by the owner on Apr 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +26
-7
lines changed Expand file tree Collapse file tree 2 files changed +26
-7
lines changed Original file line number Diff line number Diff line change 77
88env :
99 CARGO_TERM_COLOR : always
10- CARGO_TERM_VERBOSE : true
1110 RUSTDOCFLAGS : -Dwarnings
1211 RUSTFLAGS : -Dwarnings
1312 RUST_BACKTRACE : full
@@ -202,7 +201,7 @@ jobs:
202201 - name : Fetch pull request ref
203202 run : git fetch origin "$GITHUB_REF:$GITHUB_REF"
204203 if : github.event_name == 'pull_request'
205- - run : python3 ci/calculate-exhaustive-matrix .py >> "$GITHUB_OUTPUT"
204+ - run : python3 ci/ci-util .py generate-matrix >> "$GITHUB_OUTPUT"
206205 id : script
207206
208207 extensive :
Original file line number Diff line number Diff line change 11#!/usr/bin/env python3
2- """Calculate which exhaustive tests should be run as part of CI.
2+ """Utilities for CI.
33
44This dynamically prepares a list of routines that had a source file change based on
55git history.
66"""
77
8+ import json
89import subprocess as sp
910import sys
10- import json
1111from dataclasses import dataclass
12+ from inspect import cleandoc
1213from os import getenv
1314from pathlib import Path
1415from typing import TypedDict
1516
17+ USAGE = cleandoc (
18+ """
19+ usage:
20+
21+ ./ci/ci-util.py <SUBCOMMAND>
22+
23+ SUBCOMMAND:
24+ generate-matrix Calculate a matrix of which functions had source change,
25+ print that as JSON object.
26+ """
27+ )
1628
1729REPO_ROOT = Path (__file__ ).parent .parent
1830GIT = ["git" , "-C" , REPO_ROOT ]
@@ -139,9 +151,17 @@ def eprint(*args, **kwargs):
139151
140152
141153def main ():
142- ctx = Context ()
143- output = ctx .make_workflow_output ()
144- print (f"matrix={ output } " )
154+ match sys .argv [1 :]:
155+ case ["generate-matrix" ]:
156+ ctx = Context ()
157+ output = ctx .make_workflow_output ()
158+ print (f"matrix={ output } " )
159+ case ["--help" | "-h" ]:
160+ print (USAGE )
161+ exit ()
162+ case _:
163+ eprint (USAGE )
164+ exit (1 )
145165
146166
147167if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments