@@ -120,7 +120,7 @@ def list_checks(testcases, printer, detailed=False):
120120 printer .info (
121121 '\n ' .join (format_check (c , deps [c .name ], detailed ) for c in checks )
122122 )
123- printer .info (f'Found { len (checks )} check(s)' )
123+ printer .info (f'Found { len (checks )} check(s)\n ' )
124124
125125
126126def logfiles_message ():
@@ -273,6 +273,11 @@ def main():
273273 '-r' , '--run' , action = 'store_true' ,
274274 help = 'Run the selected checks'
275275 )
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+ )
276281
277282 # Run options
278283 run_options .add_argument (
@@ -335,10 +340,6 @@ def main():
335340 '--disable-hook' , action = 'append' , metavar = 'NAME' , dest = 'hooks' ,
336341 default = [], help = 'Disable a pipeline hook for this run'
337342 )
338- run_options .add_argument (
339- '--ci-generate' , action = 'store' , metavar = 'FILE' ,
340- help = "Store ci pipeline in yaml FILE" ,
341- )
342343
343344 # Environment options
344345 env_options .add_argument (
@@ -793,12 +794,6 @@ def _case_failed(t):
793794 )
794795 printer .verbose (f'Final number of test cases: { len (testcases )} ' )
795796
796- if options .ci_generate :
797- with open (options .ci_generate , 'wt' ) as fp :
798- ci .emit_pipeline (fp , testcases )
799-
800- sys .exit (0 )
801-
802797 # Disable hooks
803798 for tc in testcases :
804799 for h in options .hooks :
@@ -809,9 +804,23 @@ def _case_failed(t):
809804 list_checks (testcases , printer , options .list_detailed )
810805 sys .exit (0 )
811806
807+ if options .ci_generate :
808+ list_checks (testcases , printer )
809+ printer .info ('[Generate CI]' )
810+ with open (options .ci_generate , 'wt' ) as fp :
811+ ci .emit_pipeline (fp , testcases )
812+
813+ printer .info (
814+ f' Gitlab pipeline generated successfully '
815+ f'in { options .ci_generate !r} .\n '
816+ )
817+ sys .exit (0 )
818+
812819 if not options .run :
813- printer .error (f"No action specified. Please specify `-l'/`-L' for "
814- f"listing or `-r' for running. "
820+ printer .error ("No action option specified. Available options:\n "
821+ " - `-l'/`-L' for listing\n "
822+ " - `-r' for running\n "
823+ " - `--ci-generate' for generating a CI pipeline\n "
815824 f"Try `{ argparser .prog } -h' for more options." )
816825 sys .exit (1 )
817826
0 commit comments