comparison contrib/automation/hgautomation/cli.py @ 42913:92593d72e10b

automation: implement "publish-windows-artifacts" command The new command and associated functionality can be used to automate the publishing of Windows release artifacts. It supports uploading wheels to PyPI (using twine) and copying the artifacts to mercurial-scm.org and updating the latest.dat file to advertise them via the website. I ran `automation.py publish-windows-artifacts 5.1.1` and it appeared to "just work." But the real test will be to do this on the next release... Differential Revision: https://phab.mercurial-scm.org/D6786
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 05 Sep 2019 21:09:58 -0700
parents d80edcb0b30c
children d1d919f679f7
comparison
equal deleted inserted replaced
42912:6bf88befa027 42913:92593d72e10b
183 windows.synchronize_hg(SOURCE_ROOT, '.', instance) 183 windows.synchronize_hg(SOURCE_ROOT, '.', instance)
184 windows.run_tests(instance.winrm_client, python_version, arch, 184 windows.run_tests(instance.winrm_client, python_version, arch,
185 test_flags) 185 test_flags)
186 186
187 187
188 def publish_windows_artifacts(hg: HGAutomation, aws_region, version: str,
189 pypi: bool, mercurial_scm_org: bool,
190 ssh_username: str):
191 windows.publish_artifacts(DIST_PATH, version,
192 pypi=pypi, mercurial_scm_org=mercurial_scm_org,
193 ssh_username=ssh_username)
194
195
188 def get_parser(): 196 def get_parser():
189 parser = argparse.ArgumentParser() 197 parser = argparse.ArgumentParser()
190 198
191 parser.add_argument( 199 parser.add_argument(
192 '--state-path', 200 '--state-path',
401 help='AMI name of base image', 409 help='AMI name of base image',
402 default=aws.WINDOWS_BASE_IMAGE_NAME, 410 default=aws.WINDOWS_BASE_IMAGE_NAME,
403 ) 411 )
404 sp.set_defaults(func=run_tests_windows) 412 sp.set_defaults(func=run_tests_windows)
405 413
414 sp = subparsers.add_parser(
415 'publish-windows-artifacts',
416 help='Publish built Windows artifacts (wheels, installers, etc)'
417 )
418 sp.add_argument(
419 '--no-pypi',
420 dest='pypi',
421 action='store_false',
422 default=True,
423 help='Skip uploading to PyPI',
424 )
425 sp.add_argument(
426 '--no-mercurial-scm-org',
427 dest='mercurial_scm_org',
428 action='store_false',
429 default=True,
430 help='Skip uploading to www.mercurial-scm.org',
431 )
432 sp.add_argument(
433 '--ssh-username',
434 help='SSH username for mercurial-scm.org',
435 )
436 sp.add_argument(
437 'version',
438 help='Mercurial version string to locate local packages',
439 )
440 sp.set_defaults(func=publish_windows_artifacts)
441
406 return parser 442 return parser
407 443
408 444
409 def main(): 445 def main():
410 parser = get_parser() 446 parser = get_parser()