From e78cfe5d2916541a66e0320e63c09d59da901245 Mon Sep 17 00:00:00 2001 From: Sergey Shepelev Date: Wed, 9 Dec 2020 20:18:42 +0300 Subject: replace Travis with Github (actions) CI --- .github/workflows/style.yaml | 19 ++++++++++++ .github/workflows/test.yaml | 71 ++++++++++++++++++++++++++++++++++++++++++++ .travis.yml | 68 ------------------------------------------ README.rst | 4 +-- tests/__init__.py | 4 +-- tox.ini | 16 +++++----- 6 files changed, 103 insertions(+), 79 deletions(-) create mode 100644 .github/workflows/style.yaml create mode 100644 .github/workflows/test.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/style.yaml b/.github/workflows/style.yaml new file mode 100644 index 0000000..6883538 --- /dev/null +++ b/.github/workflows/style.yaml @@ -0,0 +1,19 @@ +name: style +on: + push: + pull_request: +jobs: + style: + runs-on: ubuntu-latest + timeout-minutes: 5 + + steps: + - uses: actions/checkout@v1 + - name: setup python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: 3.x + - name: install tox + run: pip install tox + - name: run tests + run: tox --verbose -e pep8 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..7fed531 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,71 @@ +name: test +on: + push: + pull_request: + schedule: + - cron: "43 7 */14 * *" # every two weeks, time chosen by RNG +jobs: + tox: + continue-on-error: ${{ matrix.ignore-error }} + runs-on: ubuntu-latest + timeout-minutes: 10 + services: + mysql: + image: mysql:5.7 + env: { MYSQL_ALLOW_EMPTY_PASSWORD: yes } + ports: ["3306:3306"] + options: --health-cmd="mysqladmin ping" --health-timeout=5s --health-retries=5 --health-interval=5s + postgres: + image: postgres:13 + env: { POSTGRES_PASSWORD: "secret" } + ports: ["5432:5432"] + options: --health-cmd pg_isready --health-timeout 5s --health-retries 5 --health-interval 5s + env: + EVENTLET_DB_TEST_AUTH: '{"psycopg2": {"host": "localhost", "user": "postgres", "password": "secret"}, "MySQLdb": {"passwd": "", "host": "localhost", "user": "root"}}' + strategy: + fail-fast: false + matrix: + include: + - { py: 2.7, toxenv: py27-epolls, ignore-error: false } + - { py: 2.7, toxenv: py27-poll, ignore-error: false } + - { py: 2.7, toxenv: py27-selects, ignore-error: false } + - { py: 3.5, toxenv: py35-epolls, ignore-error: false } + - { py: 3.5, toxenv: py35-poll, ignore-error: false } + - { py: 3.5, toxenv: py35-selects, ignore-error: false } + - { py: 3.6, toxenv: py36-epolls, ignore-error: false } + - { py: 3.6, toxenv: py36-poll, ignore-error: false } + - { py: 3.6, toxenv: py36-selects, ignore-error: false } + - { py: 3.7, toxenv: py37-epolls, ignore-error: false } + - { py: 3.7, toxenv: py37-poll, ignore-error: false } + - { py: 3.7, toxenv: py37-selects, ignore-error: false } + - { py: 3.8, toxenv: py38-epolls, ignore-error: false } + - { py: 3.8, toxenv: py38-poll, ignore-error: false } + - { py: 3.8, toxenv: py38-selects, ignore-error: false } + - { py: 3.9, toxenv: py39-epolls, ignore-error: false } + - { py: 3.9, toxenv: py39-poll, ignore-error: false } + - { py: 3.9, toxenv: py39-selects, ignore-error: false } + - { py: 3.x, toxenv: ipv6, ignore-error: false } + - { py: pypy2, toxenv: pypy2-epolls, ignore-error: true } + - { py: pypy3, toxenv: pypy3-epolls, ignore-error: true } + + steps: + - name: install system packages + run: sudo apt install -y --no-install-recommends ccache libffi-dev libmysqlclient-dev libpq-dev libssl-dev libzmq3-dev + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + - name: setup python ${{ matrix.py }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.py }} + - name: install tox + # TODO is it redundant? + # python -m pip install --upgrade pip + run: | + pip install codecov tox + - run: env + - run: python -c 'import json,os;print(json.loads(os.environ["EVENTLET_DB_TEST_AUTH"]))' + - name: run tests + run: tox --verbose --verbose -e ${{ matrix.toxenv }} + - name: codecov + run: codecov --flags=$(echo ${{ matrix.toxenv }} |tr -d -- '-.') diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2c9bc22..0000000 --- a/.travis.yml +++ /dev/null @@ -1,68 +0,0 @@ -os: linux -dist: xenial -language: python - -jobs: - fast_finish: true - include: - - {python: 3.6, env: TOXENV=pep8} - - - {python: 2.7, env: TOXENV=py27-epolls} - - {python: 2.7, env: TOXENV=py27-poll} - - {python: 2.7, env: TOXENV=py27-selects} - - - {python: 3.5, env: TOXENV=py35-epolls} - - {python: 3.5, env: TOXENV=py35-poll} - - {python: 3.5, env: TOXENV=py35-selects} - - - {python: 3.6, env: TOXENV=py36-epolls} - - {python: 3.6, env: TOXENV=py36-poll} - - {python: 3.6, env: TOXENV=py36-selects} - - - {python: 3.7, env: TOXENV=py37-epolls} - - {python: 3.7, env: TOXENV=py37-poll} - - {python: 3.7, env: TOXENV=py37-selects} - - - {python: 3.8, env: TOXENV=py38-epolls} - - {python: 3.8, env: TOXENV=py38-poll} - - {python: 3.8, env: TOXENV=py38-selects} - - - {python: pypy, env: TOXENV=pypy-epolls} - - {python: pypy, env: TOXENV=pypy-poll} - - {python: pypy, env: TOXENV=pypy-selects} - - - {python: 3.6, env: TOXENV=ipv6} - - {python: 3.8, env: TOXENV=py38-openssl} - allow_failures: - - python: 3.7-dev - - python: pypy - -cache: - apt: true - ccache: true - pip: true - directories: - - $HOME/.cache -addons: - apt_packages: - - ccache - - libffi-dev - - libmysqlclient-dev - - libpq-dev - - libssl-dev - - libzmq3-dev - -install: - - pip install --upgrade pip setuptools tox virtualenv codecov -before_script: - - "export EVENTLET_DB_TEST_AUTH='{\"psycopg2\": {\"user\": \"postgres\"}, \"MySQLdb\": {\"passwd\": \"\", \"host\": \"localhost\", \"user\": \"root\"}}'" - - "export PATH=/usr/lib/ccache:$PATH" - # Add an IPv6 config - see the corresponding Travis issue - # https://github.com/travis-ci/travis-ci/issues/8361 - - if [[ "${TRAVIS_OS_NAME}" == "linux" ]] ; then sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6' ; fi -script: - - tox -v -v - - codecov --flags=$(echo $TOXENV |tr -d -- '-.') -after_failure: - - for X in .tox/$TOXENV/log/*; do echo "$X\n"; cat "$X"; echo "\n\n"; done - - echo "pip.log\n"; cat $HOME/.pip/pip.log diff --git a/README.rst b/README.rst index 4b4b908..d5379f2 100644 --- a/README.rst +++ b/README.rst @@ -73,8 +73,8 @@ Flair .. image:: https://img.shields.io/pypi/v/eventlet :target: https://pypi.org/project/eventlet/ -.. image:: https://travis-ci.org/eventlet/eventlet.svg?branch=master - :target: https://travis-ci.org/eventlet/eventlet +.. image:: https://img.shields.io/github/workflow/status/eventlet/eventlet/test/master + :target: https://github.com/eventlet/eventlet/actions?query=workflow%3Atest+branch%3Amaster .. image:: https://codecov.io/gh/eventlet/eventlet/branch/master/graph/badge.svg :target: https://codecov.io/gh/eventlet/eventlet diff --git a/tests/__init__.py b/tests/__init__.py index 82cd247..c0b64fd 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -232,10 +232,10 @@ def check_idle_cpu_usage(duration, allowed_part): utime = r2.ru_utime - r1.ru_utime stime = r2.ru_stime - r1.ru_stime - # This check is reliably unreliable on Travis, presumably because of CPU + # This check is reliably unreliable on Travis/Github Actions, presumably because of CPU # resources being quite restricted by the build environment. The workaround # is to apply an arbitrary factor that should be enough to make it work nicely. - if os.environ.get('TRAVIS') == 'true': + if os.environ.get('CI') == 'true': allowed_part *= 5 assert utime + stime < duration * allowed_part, \ diff --git a/tox.ini b/tox.ini index ce2fd39..19caacc 100644 --- a/tox.ini +++ b/tox.ini @@ -16,7 +16,7 @@ statistics = 1 [tox] minversion=2.5 envlist = - ipv6, pep8, py{27,35,36,37,38,py}-{selects,poll,epolls}, py38-openssl + ipv6, pep8, py{27,35,36,37,38,39,py2,py3}-{selects,poll,epolls}, py38-openssl [testenv:ipv6] basepython = python @@ -43,7 +43,7 @@ commands = pep8 benchmarks/ eventlet/ tests/ [testenv] -passenv = CI TRAVIS* +passenv = CI setenv = PYTHONDONTWRITEBYTECODE = 1 selects: EVENTLET_HUB = selects @@ -56,19 +56,21 @@ basepython = py36: python3.6 py37: python3.7 py38: python3.8 - pypy: pypy + py39: python3.9 + pypy2: pypy2 + pypy3: pypy3 deps = coverage==4.5.1 nose==1.3.7 py27-{selects,poll,epolls}: MySQL-python==1.2.5 py27: subprocess32==3.2.7 - pypy: psycopg2cffi-compat==1.1 + pypy{2,3}: psycopg2cffi-compat==1.1 py{27,35,36,37}: psycopg2-binary==2.7.4 - py38: psycopg2-binary==2.8.4 + py{38,39}: psycopg2-binary==2.8.4 py38-openssl: pyopenssl==20.0.0 - py27-{selects,poll,epolls}: pyopenssl==17.3.0 + py27-{selects,poll,epolls}: pyopenssl==19.1.0 setuptools==38.5.1 - {selects,poll,epolls}: pyzmq==17.0.0 + {selects,poll,epolls}: pyzmq==19.0.2 commands = nosetests --verbose {env:tox_cover_args} {posargs:tests/} coverage xml -i -- cgit v1.2.1