This repository was archived by the owner on Apr 28, 2025. It is now read-only.
File tree 2 files changed +26
-7
lines changed
2 files changed +26
-7
lines changed Original file line number Diff line number Diff line change 7
7
8
8
env :
9
9
CARGO_TERM_COLOR : always
10
- CARGO_TERM_VERBOSE : true
11
10
RUSTDOCFLAGS : -Dwarnings
12
11
RUSTFLAGS : -Dwarnings
13
12
RUST_BACKTRACE : full
@@ -202,7 +201,7 @@ jobs:
202
201
- name : Fetch pull request ref
203
202
run : git fetch origin "$GITHUB_REF:$GITHUB_REF"
204
203
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"
206
205
id : script
207
206
208
207
extensive :
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python3
2
- """Calculate which exhaustive tests should be run as part of CI.
2
+ """Utilities for CI.
3
3
4
4
This dynamically prepares a list of routines that had a source file change based on
5
5
git history.
6
6
"""
7
7
8
+ import json
8
9
import subprocess as sp
9
10
import sys
10
- import json
11
11
from dataclasses import dataclass
12
+ from inspect import cleandoc
12
13
from os import getenv
13
14
from pathlib import Path
14
15
from typing import TypedDict
15
16
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
+ )
16
28
17
29
REPO_ROOT = Path (__file__ ).parent .parent
18
30
GIT = ["git" , "-C" , REPO_ROOT ]
@@ -139,9 +151,17 @@ def eprint(*args, **kwargs):
139
151
140
152
141
153
def 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 )
145
165
146
166
147
167
if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments