Skip to content

Commit

Permalink
split dry run CI by target
Browse files Browse the repository at this point in the history
  • Loading branch information
mkannwischer committed Oct 17, 2024
1 parent 6c88fdf commit 31434ec
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/test_basic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ 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
strategy:
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
Expand All @@ -22,7 +26,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' ||
Expand Down
14 changes: 11 additions & 3 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand All @@ -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)
Expand Down Expand Up @@ -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(",")
Expand All @@ -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()

0 comments on commit 31434ec

Please sign in to comment.