From d48876d099b882a632d8a10b288b901767a18708 Mon Sep 17 00:00:00 2001 From: "Matthias J. Kannwischer" Date: Thu, 17 Oct 2024 20:04:22 +0800 Subject: [PATCH] split dry run CI by target --- .github/workflows/test_basic.yaml | 5 ++++- example.py | 14 +++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_basic.yaml b/.github/workflows/test_basic.yaml index 2de724f0..16884d39 100644 --- a/.github/workflows/test_basic.yaml +++ b/.github/workflows/test_basic.yaml @@ -5,12 +5,15 @@ on: types: [ opened, synchronize, labeled ] jobs: examples_dry_run: + name: Dry Run (${{ matrix.target }}) if: ${{ github.event.label.name == 'needs-ci' || github.event.pull_request.user.login == 'hanno-becker' || github.event.pull_request.user.login == 'dop-amin' || github.event.pull_request.user.login == 'mkannwischer' }} runs-on: ubuntu-latest + matrix: + target: [slothy.targets.arm_v7m.cortex_m4, slothy.targets.arm_v7m.cortex_m7, slothy.targets.aarch64.cortex_a55, slothy.targets.aarch64.cortex_a72_frontend, slothy.targets.aarch64.apple_m1_firestorm_experimental, slothy.targets.aarch64.apple_m1_icestorm_experimental] steps: - uses: actions/checkout@v3 - name: Install python dependencies @@ -22,7 +25,7 @@ jobs: run: sudo apt-get install -y llvm - name: Run examples run: | - python3 example.py --dry-run + python3 example.py --dry-run --only-target=${{ matrix.target }} tutorial: if: ${{ github.event.label.name == 'needs-ci' || github.event.pull_request.user.login == 'hanno-becker' || diff --git a/example.py b/example.py index f63c7249..372ad4bb 100644 --- a/example.py +++ b/example.py @@ -95,7 +95,7 @@ def __init__(self, infile, name=None, funcname=None, suffix="opt", def core(self, slothy): slothy.optimize() - def run(self, debug=False, log_model=False, log_model_dir="models", dry_run=False, silent=False, timeout=0, debug_logfile=None): + def run(self, debug=False, log_model=False, log_model_dir="models", dry_run=False, silent=False, timeout=0, debug_logfile=None, only_target=None): if dry_run is True: annotation = " (dry run only)" @@ -104,6 +104,10 @@ def run(self, debug=False, log_model=False, log_model_dir="models", dry_run=Fals print(f"* Example: {self.name}{annotation}...") + # skip eaxmples for all but the target that was asked for + if only_target is not None and self.target.__name__ != only_target: + return + handlers = [] h_err = logging.StreamHandler(sys.stderr) @@ -2402,7 +2406,10 @@ def main(): parser.add_argument("--debug-logfile", type=str, default=None) parser.add_argument("--log-model", default=False, action="store_true") parser.add_argument("--log-model-dir", type=str, default="models") - + parser.add_argument("--only-target", type=str,choices=[Target_CortexM4.__name__, \ + Target_CortexM7.__name__, Target_CortexM55r1.__name__, Target_CortexM85r1.__name__, \ + Target_CortexA55.__name__, Target_CortexA72.__name__, Target_AppleM1_firestorm.__name__, \ + Target_AppleM1_icestorm.__name__]) args = parser.parse_args() if args.examples != "all": todo = args.examples.split(",") @@ -2425,7 +2432,8 @@ def run_example(name, **kwargs): run_example(e, debug=args.debug, dry_run=args.dry_run, silent=args.silent, log_model=args.log_model, debug_logfile=args.debug_logfile, - log_model_dir=args.log_model_dir, timeout=args.timeout) + log_model_dir=args.log_model_dir, timeout=args.timeout, + only_target=args.only_target) if __name__ == "__main__": main()