From 1d3afb2b783f9888e0c6022d5ad2bf4c8b1b104e Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Thu, 17 May 2018 21:24:39 +0200 Subject: [PATCH] Travis CI migration and packaging improvements (#2990) * Opt-in to use edge Travis CI config parser * Drop outdated comment from Travis CI config * Turn env vars in Travis CI config to key-value * Move towncrier linter into its own job * Upgrade refs across repo to point to travis-ci.com * Make run_docker script saver to maintain * Announce support for Python 3.7 * Use pytest-runner in dist setup * Don't install mypy under PyPy * Don't install uvloop under 3.7 * Run pytest directly in AppVeyor CI --- .appveyor.yml | 2 +- .travis.yml | 19 ++++++++++++------- README.rst | 4 ++-- docs/conf.py | 4 ++-- docs/index.rst | 2 +- requirements/ci-wheel.txt | 2 +- requirements/ci.txt | 2 +- setup.cfg | 3 +++ setup.py | 34 ++++++++++++++++++++-------------- tools/run_docker.sh | 5 ++++- 10 files changed, 47 insertions(+), 30 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 5bce5e92afe..06be853e58d 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -14,7 +14,7 @@ install: build: false test_script: - - "tools/build.cmd %PYTHON%\\python.exe setup.py test" + - "tools/build.cmd %PYTHON%\\python.exe -m pytest tests" after_test: - "tools/build.cmd %PYTHON%\\python.exe setup.py sdist bdist_wheel" diff --git a/.travis.yml b/.travis.yml index ee872faaed4..7952e0b2c3c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ +version: "= 0" + sudo: false language: python @@ -123,8 +125,6 @@ _helpers: - *env_pyenv - *env_path -# doesn't work on MacOSX out of the box -- the system has no Python installed -# there's a workaround to use `language: generic` and install it, but it's slow os: linux jobs: @@ -136,20 +136,25 @@ jobs: include: - <<: *_doc_base env: - - docs + - TARGET=docs script: - - towncrier --yes - make doc-spelling + - <<: *_doc_base + env: + - TARGET=towncrier + script: + - towncrier --yes + - <<: *_lint_base env: - - flake8 + - TARGET=flake8 script: - flake8 aiohttp examples tests - <<: *_lint_base env: - - dist setup check + - TARGET="dist setup check" install: - *upgrade_python_toolset - pip install -r requirements/doc.txt @@ -185,7 +190,7 @@ jobs: # Build and deploy manylinux1 binary wheels and source distribution - <<: *generic_deploy_base <<: *_reset_steps - env: Build and deploy to PYPI of manylinux1 binary wheels for all supported Pythons and source distribution + env: Build and deploy to PYPI of manylinux1 binary wheels for all supported Pythons and source distribution= dist: trusty group: edge services: diff --git a/README.rst b/README.rst index bbc659ce6d6..4d8982f0310 100644 --- a/README.rst +++ b/README.rst @@ -9,8 +9,8 @@ Async http client/server framework | -.. image:: https://travis-ci.org/aio-libs/aiohttp.svg?branch=master - :target: https://travis-ci.org/aio-libs/aiohttp +.. image:: https://travis-ci.com/aio-libs/aiohttp.svg?branch=master + :target: https://travis-ci.com/aio-libs/aiohttp :align: right :alt: Travis status for master branch diff --git a/docs/conf.py b/docs/conf.py index 6bf922c303c..1cae82bcf30 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -165,8 +165,8 @@ 'github_button': True, 'github_type': 'star', 'github_banner': True, - 'badges': [{'image': 'https://secure.travis-ci.org/aio-libs/aiohttp.svg?branch=master', - 'target': 'https://travis-ci.org/aio-libs/aiohttp', + 'badges': [{'image': 'https://travis-ci.com/aio-libs/aiohttp.svg?branch=master', + 'target': 'https://travis-ci.com/aio-libs/aiohttp', 'height': '20', 'alt': 'Travis CI status'}, {'image': 'https://codecov.io/github/aio-libs/aiohttp/coverage.svg?branch=master', diff --git a/docs/index.rst b/docs/index.rst index 7734a434779..dcaaafa677c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -110,7 +110,7 @@ Please feel free to file an issue on the `bug tracker `_ if you have found a bug or have some suggestion in order to improve the library. -The library uses `Travis `_ for +The library uses `Travis `_ for Continuous Integration. diff --git a/requirements/ci-wheel.txt b/requirements/ci-wheel.txt index dba87656656..29b90de74f2 100644 --- a/requirements/ci-wheel.txt +++ b/requirements/ci-wheel.txt @@ -23,5 +23,5 @@ yarl==1.2.4 # Using PEP 508 env markers to control dependency on runtimes: aiodns==1.1.1; platform_system!="Windows" # required c-ares will not build on windows codecov==2.0.15; platform_system!="Windows" # We only use it in Travis CI -uvloop==0.9.1; platform_system!="Windows" and implementation_name=="cpython" # MagicStack/uvloop#14 +uvloop==0.9.1; platform_system!="Windows" and implementation_name=="cpython" and python_version<"3.7" # MagicStack/uvloop#14 idna-ssl==1.0.1; python_version<"3.7" diff --git a/requirements/ci.txt b/requirements/ci.txt index 95cd14cb09e..4fe412aa523 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -1,5 +1,5 @@ setuptools-git==1.2 -mypy==0.600 +mypy==0.600; implementation_name=="cpython" -r doc.txt -r ci-wheel.txt diff --git a/setup.cfg b/setup.cfg index 2fee2228b30..50c48cca1c5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,6 @@ +[aliases] +test = pytest + [metadata] license_file = LICENSE.txt diff --git a/setup.py b/setup.py index 3263977ff2c..a83df0cdb4c 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,6 @@ DistutilsPlatformError) from setuptools import Extension, setup -from setuptools.command.test import test as TestCommand if sys.version_info < (3, 5, 3): @@ -85,17 +84,11 @@ def read(f): return (here / f).read_text('utf-8').strip() -class PyTest(TestCommand): - user_options = [] +NEEDS_PYTEST = {'pytest', 'test'}.intersection(sys.argv) +pytest_runner = ['pytest-runner'] if NEEDS_PYTEST else [] - def run(self): - import subprocess - errno = subprocess.call([sys.executable, '-m', 'pytest', 'tests']) - raise SystemExit(errno) - - -tests_require = install_requires + ['pytest', 'gunicorn', - 'pytest-timeout', 'async-generator'] +tests_require = ['pytest', 'gunicorn', + 'pytest-timeout', 'async-generator'] args = dict( @@ -110,6 +103,7 @@ def run(self): 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'Development Status :: 5 - Production/Stable', 'Operating System :: POSIX', 'Operating System :: MacOS :: MacOS X', @@ -122,16 +116,28 @@ def run(self): maintainer=', '.join(('Nikolay Kim ', 'Andrew Svetlov ')), maintainer_email='aio-libs@googlegroups.com', - url='https://github.com/aio-libs/aiohttp/', + url='https://github.com/aio-libs/aiohttp', + project_urls={ + 'Chat: Gitter': 'https://gitter.im/aio-libs/Lobby', + 'CI: AppVeyor': 'https://ci.appveyor.com/project/asvetlov/aiohttp', # FIXME: move under aio-libs/* slug + 'CI: Circle': 'https://circleci.com/gh/aio-libs/aiohttp', + 'CI: Shippable': 'https://app.shippable.com/github/aio-libs/aiohttp', + 'CI: Travis': 'https://travis-ci.com/aio-libs/aiohttp', + 'Coverage: codecov': 'https://codecov.io/github/aio-libs/aiohttp', + 'Docs: RTD': 'https://docs.aiohttp.org', + 'GitHub: issues': 'https://github.com/aio-libs/aiohttp/issues', + 'GitHub: repo': 'https://github.com/aio-libs/aiohttp', + }, license='Apache 2', packages=['aiohttp'], python_requires='>=3.5.3', install_requires=install_requires, tests_require=tests_require, + setup_requires=pytest_runner, include_package_data=True, ext_modules=extensions, - cmdclass=dict(build_ext=ve_build_ext, - test=PyTest)) + cmdclass=dict(build_ext=ve_build_ext), +) try: setup(**args) diff --git a/tools/run_docker.sh b/tools/run_docker.sh index b41881366fc..83f5fa5974b 100755 --- a/tools/run_docker.sh +++ b/tools/run_docker.sh @@ -1,5 +1,6 @@ #!/bin/bash -set -e + +set -euo pipefail package_name="$1" if [ -z "$package_name" ] @@ -35,3 +36,5 @@ do dock_ext_args="" # Reset docker args, just in case done + +set +u