|
21 | 21 | import reframe.core.runtime as runtime |
22 | 22 | import reframe.core.warnings as warnings |
23 | 23 | import reframe.frontend.argparse as argparse |
| 24 | +import reframe.frontend.ci as ci |
24 | 25 | import reframe.frontend.dependencies as dependencies |
25 | 26 | import reframe.frontend.filters as filters |
26 | 27 | import reframe.frontend.runreport as runreport |
@@ -119,7 +120,7 @@ def list_checks(testcases, printer, detailed=False): |
119 | 120 | printer.info( |
120 | 121 | '\n'.join(format_check(c, deps[c.name], detailed) for c in checks) |
121 | 122 | ) |
122 | | - printer.info(f'Found {len(checks)} check(s)') |
| 123 | + printer.info(f'Found {len(checks)} check(s)\n') |
123 | 124 |
|
124 | 125 |
|
125 | 126 | def logfiles_message(): |
@@ -272,6 +273,11 @@ def main(): |
272 | 273 | '-r', '--run', action='store_true', |
273 | 274 | help='Run the selected checks' |
274 | 275 | ) |
| 276 | + action_options.add_argument( |
| 277 | + '--ci-generate', action='store', metavar='FILE', |
| 278 | + help=('Generate into FILE a Gitlab CI pipeline ' |
| 279 | + 'for the selected tests and exit'), |
| 280 | + ) |
275 | 281 |
|
276 | 282 | # Run options |
277 | 283 | run_options.add_argument( |
@@ -334,6 +340,8 @@ def main(): |
334 | 340 | '--disable-hook', action='append', metavar='NAME', dest='hooks', |
335 | 341 | default=[], help='Disable a pipeline hook for this run' |
336 | 342 | ) |
| 343 | + |
| 344 | + # Environment options |
337 | 345 | env_options.add_argument( |
338 | 346 | '-M', '--map-module', action='append', metavar='MAPPING', |
339 | 347 | dest='module_mappings', default=[], |
@@ -795,9 +803,23 @@ def _case_failed(t): |
795 | 803 | list_checks(testcases, printer, options.list_detailed) |
796 | 804 | sys.exit(0) |
797 | 805 |
|
| 806 | + if options.ci_generate: |
| 807 | + list_checks(testcases, printer) |
| 808 | + printer.info('[Generate CI]') |
| 809 | + with open(options.ci_generate, 'wt') as fp: |
| 810 | + ci.emit_pipeline(fp, testcases) |
| 811 | + |
| 812 | + printer.info( |
| 813 | + f' Gitlab pipeline generated successfully ' |
| 814 | + f'in {options.ci_generate!r}.\n' |
| 815 | + ) |
| 816 | + sys.exit(0) |
| 817 | + |
798 | 818 | if not options.run: |
799 | | - printer.error(f"No action specified. Please specify `-l'/`-L' for " |
800 | | - f"listing or `-r' for running. " |
| 819 | + printer.error("No action option specified. Available options:\n" |
| 820 | + " - `-l'/`-L' for listing\n" |
| 821 | + " - `-r' for running\n" |
| 822 | + " - `--ci-generate' for generating a CI pipeline\n" |
801 | 823 | f"Try `{argparser.prog} -h' for more options.") |
802 | 824 | sys.exit(1) |
803 | 825 |
|
|
0 commit comments