contrib/automation/hgautomation/cli.py
changeset 45942 89a2afe31e82
parent 45693 64a9423450ef
child 48357 fc1ba19ec4a0
child 48747 ae28d37f5969
equal deleted inserted replaced
45941:346af7687c6f 45942:89a2afe31e82
   280         '--state-path',
   280         '--state-path',
   281         default='~/.hgautomation',
   281         default='~/.hgautomation',
   282         help='Path for local state files',
   282         help='Path for local state files',
   283     )
   283     )
   284     parser.add_argument(
   284     parser.add_argument(
   285         '--aws-region', help='AWS region to use', default='us-west-2',
   285         '--aws-region',
       
   286         help='AWS region to use',
       
   287         default='us-west-2',
   286     )
   288     )
   287 
   289 
   288     subparsers = parser.add_subparsers()
   290     subparsers = parser.add_subparsers()
   289 
   291 
   290     sp = subparsers.add_parser(
   292     sp = subparsers.add_parser(
   291         'bootstrap-linux-dev', help='Bootstrap Linux development environments',
   293         'bootstrap-linux-dev',
   292     )
   294         help='Bootstrap Linux development environments',
   293     sp.add_argument(
   295     )
   294         '--distros', help='Comma delimited list of distros to bootstrap',
   296     sp.add_argument(
       
   297         '--distros',
       
   298         help='Comma delimited list of distros to bootstrap',
   295     )
   299     )
   296     sp.add_argument(
   300     sp.add_argument(
   297         '--parallel',
   301         '--parallel',
   298         action='store_true',
   302         action='store_true',
   299         help='Generate AMIs in parallel (not CTRL-c safe)',
   303         help='Generate AMIs in parallel (not CTRL-c safe)',
   310         default=aws.WINDOWS_BASE_IMAGE_NAME,
   314         default=aws.WINDOWS_BASE_IMAGE_NAME,
   311     )
   315     )
   312     sp.set_defaults(func=bootstrap_windows_dev)
   316     sp.set_defaults(func=bootstrap_windows_dev)
   313 
   317 
   314     sp = subparsers.add_parser(
   318     sp = subparsers.add_parser(
   315         'build-all-windows-packages', help='Build all Windows packages',
   319         'build-all-windows-packages',
   316     )
   320         help='Build all Windows packages',
   317     sp.add_argument(
   321     )
   318         '--revision', help='Mercurial revision to build', default='.',
   322     sp.add_argument(
   319     )
   323         '--revision',
   320     sp.add_argument(
   324         help='Mercurial revision to build',
   321         '--version', help='Mercurial version string to use',
   325         default='.',
       
   326     )
       
   327     sp.add_argument(
       
   328         '--version',
       
   329         help='Mercurial version string to use',
   322     )
   330     )
   323     sp.add_argument(
   331     sp.add_argument(
   324         '--base-image-name',
   332         '--base-image-name',
   325         help='AMI name of base image',
   333         help='AMI name of base image',
   326         default=aws.WINDOWS_BASE_IMAGE_NAME,
   334         default=aws.WINDOWS_BASE_IMAGE_NAME,
   327     )
   335     )
   328     sp.set_defaults(func=build_all_windows_packages)
   336     sp.set_defaults(func=build_all_windows_packages)
   329 
   337 
   330     sp = subparsers.add_parser(
   338     sp = subparsers.add_parser(
   331         'build-inno', help='Build Inno Setup installer(s)',
   339         'build-inno',
       
   340         help='Build Inno Setup installer(s)',
   332     )
   341     )
   333     sp.add_argument(
   342     sp.add_argument(
   334         '--python-version',
   343         '--python-version',
   335         help='Which version of Python to target',
   344         help='Which version of Python to target',
   336         choices={2, 3},
   345         choices={2, 3},
   344         choices={'x86', 'x64'},
   353         choices={'x86', 'x64'},
   345         nargs='*',
   354         nargs='*',
   346         default=['x64'],
   355         default=['x64'],
   347     )
   356     )
   348     sp.add_argument(
   357     sp.add_argument(
   349         '--revision', help='Mercurial revision to build', default='.',
   358         '--revision',
   350     )
   359         help='Mercurial revision to build',
   351     sp.add_argument(
   360         default='.',
   352         '--version', help='Mercurial version string to use in installer',
   361     )
       
   362     sp.add_argument(
       
   363         '--version',
       
   364         help='Mercurial version string to use in installer',
   353     )
   365     )
   354     sp.add_argument(
   366     sp.add_argument(
   355         '--base-image-name',
   367         '--base-image-name',
   356         help='AMI name of base image',
   368         help='AMI name of base image',
   357         default=aws.WINDOWS_BASE_IMAGE_NAME,
   369         default=aws.WINDOWS_BASE_IMAGE_NAME,
   358     )
   370     )
   359     sp.set_defaults(func=build_inno)
   371     sp.set_defaults(func=build_inno)
   360 
   372 
   361     sp = subparsers.add_parser(
   373     sp = subparsers.add_parser(
   362         'build-windows-wheel', help='Build Windows wheel(s)',
   374         'build-windows-wheel',
       
   375         help='Build Windows wheel(s)',
   363     )
   376     )
   364     sp.add_argument(
   377     sp.add_argument(
   365         '--python-version',
   378         '--python-version',
   366         help='Python version to build for',
   379         help='Python version to build for',
   367         choices={'2.7', '3.7', '3.8', '3.9'},
   380         choices={'2.7', '3.7', '3.8', '3.9'},
   374         choices={'x86', 'x64'},
   387         choices={'x86', 'x64'},
   375         nargs='*',
   388         nargs='*',
   376         default=['x64'],
   389         default=['x64'],
   377     )
   390     )
   378     sp.add_argument(
   391     sp.add_argument(
   379         '--revision', help='Mercurial revision to build', default='.',
   392         '--revision',
       
   393         help='Mercurial revision to build',
       
   394         default='.',
   380     )
   395     )
   381     sp.add_argument(
   396     sp.add_argument(
   382         '--base-image-name',
   397         '--base-image-name',
   383         help='AMI name of base image',
   398         help='AMI name of base image',
   384         default=aws.WINDOWS_BASE_IMAGE_NAME,
   399         default=aws.WINDOWS_BASE_IMAGE_NAME,
   400         choices={'x86', 'x64'},
   415         choices={'x86', 'x64'},
   401         nargs='*',
   416         nargs='*',
   402         default=['x64'],
   417         default=['x64'],
   403     )
   418     )
   404     sp.add_argument(
   419     sp.add_argument(
   405         '--revision', help='Mercurial revision to build', default='.',
   420         '--revision',
   406     )
   421         help='Mercurial revision to build',
   407     sp.add_argument(
   422         default='.',
   408         '--version', help='Mercurial version string to use in installer',
   423     )
       
   424     sp.add_argument(
       
   425         '--version',
       
   426         help='Mercurial version string to use in installer',
   409     )
   427     )
   410     sp.add_argument(
   428     sp.add_argument(
   411         '--base-image-name',
   429         '--base-image-name',
   412         help='AMI name of base image',
   430         help='AMI name of base image',
   413         default=aws.WINDOWS_BASE_IMAGE_NAME,
   431         default=aws.WINDOWS_BASE_IMAGE_NAME,
   419         help='Terminate all active EC2 instances managed by us',
   437         help='Terminate all active EC2 instances managed by us',
   420     )
   438     )
   421     sp.set_defaults(func=terminate_ec2_instances)
   439     sp.set_defaults(func=terminate_ec2_instances)
   422 
   440 
   423     sp = subparsers.add_parser(
   441     sp = subparsers.add_parser(
   424         'purge-ec2-resources', help='Purge all EC2 resources managed by us',
   442         'purge-ec2-resources',
       
   443         help='Purge all EC2 resources managed by us',
   425     )
   444     )
   426     sp.set_defaults(func=purge_ec2_resources)
   445     sp.set_defaults(func=purge_ec2_resources)
   427 
   446 
   428     sp = subparsers.add_parser('run-tests-linux', help='Run tests on Linux',)
   447     sp = subparsers.add_parser(
       
   448         'run-tests-linux',
       
   449         help='Run tests on Linux',
       
   450     )
   429     sp.add_argument(
   451     sp.add_argument(
   430         '--distro',
   452         '--distro',
   431         help='Linux distribution to run tests on',
   453         help='Linux distribution to run tests on',
   432         choices=linux.DISTROS,
   454         choices=linux.DISTROS,
   433         default='debian10',
   455         default='debian10',
   466         nargs='*',
   488         nargs='*',
   467     )
   489     )
   468     sp.set_defaults(func=run_tests_linux)
   490     sp.set_defaults(func=run_tests_linux)
   469 
   491 
   470     sp = subparsers.add_parser(
   492     sp = subparsers.add_parser(
   471         'run-tests-windows', help='Run tests on Windows',
   493         'run-tests-windows',
   472     )
   494         help='Run tests on Windows',
   473     sp.add_argument(
   495     )
   474         '--instance-type', help='EC2 instance type to use', default='t3.medium',
   496     sp.add_argument(
       
   497         '--instance-type',
       
   498         help='EC2 instance type to use',
       
   499         default='t3.medium',
   475     )
   500     )
   476     sp.add_argument(
   501     sp.add_argument(
   477         '--python-version',
   502         '--python-version',
   478         help='Python version to use',
   503         help='Python version to use',
   479         choices={'2.7', '3.5', '3.6', '3.7', '3.8', '3.9'},
   504         choices={'2.7', '3.5', '3.6', '3.7', '3.8', '3.9'},
   484         help='Architecture to test',
   509         help='Architecture to test',
   485         choices={'x86', 'x64'},
   510         choices={'x86', 'x64'},
   486         default='x64',
   511         default='x64',
   487     )
   512     )
   488     sp.add_argument(
   513     sp.add_argument(
   489         '--test-flags', help='Extra command line flags to pass to run-tests.py',
   514         '--test-flags',
       
   515         help='Extra command line flags to pass to run-tests.py',
   490     )
   516     )
   491     sp.add_argument(
   517     sp.add_argument(
   492         '--base-image-name',
   518         '--base-image-name',
   493         help='AMI name of base image',
   519         help='AMI name of base image',
   494         default=aws.WINDOWS_BASE_IMAGE_NAME,
   520         default=aws.WINDOWS_BASE_IMAGE_NAME,
   512         action='store_false',
   538         action='store_false',
   513         default=True,
   539         default=True,
   514         help='Skip uploading to www.mercurial-scm.org',
   540         help='Skip uploading to www.mercurial-scm.org',
   515     )
   541     )
   516     sp.add_argument(
   542     sp.add_argument(
   517         '--ssh-username', help='SSH username for mercurial-scm.org',
   543         '--ssh-username',
   518     )
   544         help='SSH username for mercurial-scm.org',
   519     sp.add_argument(
   545     )
   520         'version', help='Mercurial version string to locate local packages',
   546     sp.add_argument(
       
   547         'version',
       
   548         help='Mercurial version string to locate local packages',
   521     )
   549     )
   522     sp.set_defaults(func=publish_windows_artifacts)
   550     sp.set_defaults(func=publish_windows_artifacts)
   523 
   551 
   524     sp = subparsers.add_parser(
   552     sp = subparsers.add_parser(
   525         'try', help='Run CI automation against a custom changeset'
   553         'try', help='Run CI automation against a custom changeset'