diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 35e25353a91fc69fbe41a2de8bada8ca850d08bc..6ec7e0f754be049fcaffbd52e713f51a4ad4b1d0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -57,6 +57,11 @@ build_linux_36: variables: PYTHON_VERSION: "3.6" BUILD_EGG: "true" + script: + - python3 ./bob/devtools/bootstrap.py -vv build + - source ${CONDA_ROOT}/etc/profile.d/conda.sh + - conda activate base + - python3 ./bob/devtools/build.py -vv --twine-check artifacts: expire_in: 1 week paths: diff --git a/bob/devtools/bootstrap.py b/bob/devtools/bootstrap.py index 96c8e47ac3130356ba0b40fb9020cce532b6be88..585f013218dedb9debc790e82c7f2f315841896b 100644 --- a/bob/devtools/bootstrap.py +++ b/bob/devtools/bootstrap.py @@ -395,6 +395,7 @@ if __name__ == '__main__': 'python', 'conda=%s' % conda_version, 'conda-build=%s' % conda_build_version, + 'twine', #required for checking readme of python (zip) distro ]) elif args.command == 'local': @@ -404,6 +405,7 @@ if __name__ == '__main__': 'python', 'conda=%s' % conda_version, 'conda-build=%s' % conda_build_version, + 'twine', #required for checking readme of python (zip) distro ]) conda_bld_path = os.path.join(args.conda_root, 'conda-bld') run_cmdline([conda_bin, 'index', conda_bld_path]) diff --git a/bob/devtools/build.py b/bob/devtools/build.py index 6c17ac622f95a857a780928f12dc3680d45d6b35..16bfa761477b6dc07f777eed0c14d513f5e47211 100644 --- a/bob/devtools/build.py +++ b/bob/devtools/build.py @@ -433,6 +433,9 @@ if __name__ == '__main__': parser.add_argument('-p', '--python-version', default=os.environ.get('PYTHON_VERSION', '%d.%d' % sys.version_info[:2]), help='The version of python to build for [default: %(default)s]') + parser.add_argument('-T', '--twine-check', action='store_true', + default=False, help='If set, then performs the equivalent of a ' \ + '"twine check" on the generated python package (zip file)') parser.add_argument('--verbose', '-v', action='count', default=0, help='Increases the verbosity level. We always prints error and ' \ 'critical messages. Use a single ``-v`` to enable warnings, ' \ @@ -497,4 +500,17 @@ if __name__ == '__main__': conda_build.api.build(os.path.join(args.work_dir, 'conda'), config=conda_config) + # checks if long_description of python package renders fine + if args.twine_check: + from twine.commands.check import check + package = glob.glob('dist/*.zip') + failed = check(package) + + if failed: + raise RuntimeError('long_description of package %s cannot be ' \ + 'correctly parsed (twine check returned a failure)' % \ + (package[0],)) + else: + logger.info('Package %s\'s long_description: OK', package[0]) + git_clean_build(bootstrap.run_cmdline, verbose=(args.verbose >= 2))