diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml new file mode 100644 index 00000000..dbd62a6c --- /dev/null +++ b/.github/workflows/examples.yml @@ -0,0 +1,49 @@ +name: Examples + +on: [push, pull_request, workflow_dispatch] + +env: + FORCE_COLOR: 1 + +jobs: + examples: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["pypy-3.7", "3.9"] + target: [ + "src-layout", + "adhoc-layout", + ] + include: + # Add new helper variables to existing jobs + - {python-version: "pypy-3.7", tox-python-version: "pypy3"} + - {python-version: "3.9", tox-python-version: "py39"} + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Cache + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: + examples-v1-${{ hashFiles('**/tox.ini') }} + restore-keys: | + examples-v1- + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U wheel + python -m pip install --progress-bar=off tox -rci/requirements.txt + + - name: Examples + run: | + cd examples/${{ matrix.target }} + tox -v -e ${{ matrix.tox-python-version }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..001ccfee --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,41 @@ +name: Lint + +on: [push, pull_request, workflow_dispatch] + +env: + FORCE_COLOR: 1 + +jobs: + lint: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + toxenv: ["check", "docs"] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + + - name: Cache + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: + lint-v1-${{ hashFiles('**/tox.ini') }} + restore-keys: | + lint-v1- + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U wheel + python -m pip install --progress-bar=off tox -rci/requirements.txt + + - name: Lint ${{ matrix.toxenv }} + run: | + tox -v -e ${{ matrix.toxenv }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b92a0fa3..a60cbd96 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,27 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9"] + python-version: ["pypy-3.6", "pypy-3.7", "3.6", "3.7", "3.8", "3.9"] + tox-extra-versions: [ + "pytest46-xdist127", + "pytest46-xdist133", + "pytest54-xdist133", + "pytest62-xdist202", + ] + include: + # Add new helper variables to existing jobs + - {python-version: "pypy-3.6", tox-python-version: "pypy3"} + - {python-version: "pypy-3.7", tox-python-version: "pypy3"} + - {python-version: "3.6", tox-python-version: "py36"} + - {python-version: "3.7", tox-python-version: "py37"} + - {python-version: "3.8", tox-python-version: "py38"} + - {python-version: "3.9", tox-python-version: "py39"} + exclude: + # Remove some jobs from the matrix + - {tox-extra-versions: "pytest46-xdist127", python-version: "3.8"} + - {tox-extra-versions: "pytest46-xdist127", python-version: "3.9"} + - {tox-extra-versions: "pytest46-xdist133", python-version: "3.9"} + - {tox-extra-versions: "pytest54-xdist133", python-version: "3.9"} steps: - uses: actions/checkout@v2 @@ -21,6 +41,37 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Hello world + - name: Get pip cache dir + id: pip-cache run: | - echo "hello world" + echo "::set-output name=dir::$(pip cache dir)" + + - name: Cache + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: + test-${{ matrix.python-version }}-v1-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + test-${{ matrix.python-version }}-v1- + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U wheel + python -m pip install --progress-bar=off tox -rci/requirements.txt + virtualenv --version + pip --version + tox --version + + - name: Tox tests + run: | + tox -v -e ${{ matrix.tox-python-version }}-${{ matrix.tox-extra-versions }}-coverage55 + + allgood: + needs: test + runs-on: ubuntu-latest + name: Test successful + steps: + - name: Success + run: echo Test successful diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a9cafa4e..00000000 --- a/.travis.yml +++ /dev/null @@ -1,89 +0,0 @@ -# NOTE: this file is auto-generated via ci/bootstrap.py (ci/templates/.travis.yml). -dist: xenial -language: python -cache: false -env: - global: - - LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so - - SEGFAULT_SIGNALS=all -stages: - - lint - - examples - - tests -jobs: - fast_finish: true - allow_failures: - - python: '3.8' - include: - - stage: lint - env: TOXENV=check - - env: TOXENV=docs - - - stage: tests - env: TOXENV=py27-pytest46-xdist127-coverage55 - python: '2.7' - - env: TOXENV=py35-pytest46-xdist127-coverage55 - python: '3.5' - - env: TOXENV=py36-pytest46-xdist127-coverage55 - python: '3.6' - - env: TOXENV=py37-pytest46-xdist127-coverage55 - python: '3.7' - - env: TOXENV=pypy-pytest46-xdist127-coverage55 - python: 'pypy' - - env: TOXENV=pypy3-pytest46-xdist127-coverage55 - python: 'pypy3' - - env: TOXENV=py36-pytest46-xdist133-coverage55 - python: '3.6' - - env: TOXENV=py36-pytest54-xdist133-coverage55 - python: '3.6' - - env: TOXENV=py37-pytest46-xdist133-coverage55 - python: '3.7' - - env: TOXENV=py37-pytest54-xdist133-coverage55 - python: '3.7' - - env: TOXENV=py38-pytest46-xdist133-coverage55 - python: '3.8' - - env: TOXENV=py38-pytest54-xdist133-coverage55 - python: '3.8' - - env: TOXENV=pypy3-pytest46-xdist133-coverage55 - python: 'pypy3' - - env: TOXENV=pypy3-pytest54-xdist133-coverage55 - python: 'pypy3' - - env: TOXENV=py36-pytest62-xdist202-coverage55 - python: '3.6' - - env: TOXENV=py37-pytest62-xdist202-coverage55 - python: '3.7' - - env: TOXENV=py38-pytest62-xdist202-coverage55 - python: '3.8' - - env: TOXENV=py39-pytest62-xdist202-coverage55 - python: '3.9' - - env: TOXENV=pypy3-pytest62-xdist202-coverage55 - python: 'pypy3' - - - stage: examples - python: '3.8' - script: cd $TARGET; tox -v - env: - - TARGET=examples/src-layout - - python: '3.8' - script: cd $TARGET; tox -v - env: - - TARGET=examples/adhoc-layout -before_install: - - python --version - - uname -a - - lsb_release -a -install: - - python -mpip install --progress-bar=off tox -rci/requirements.txt - - virtualenv --version - - easy_install --version - - pip --version - - tox --version -script: - - tox -v -after_failure: - - more .tox/log/* | cat - - more .tox/*/log/* | cat -notifications: - email: - on_success: never - on_failure: always diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index f02562eb..e742be47 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -73,8 +73,8 @@ For merging, you should: 3. Add a note to ``CHANGELOG.rst`` about the changes. 4. Add yourself to ``AUTHORS.rst``. -.. [1] If you don't have all the necessary python versions available locally you can rely on Travis - it will - `run the tests `_ +.. [1] If you don't have all the necessary Python versions available locally you can rely on GitHub Actions - it will + `run the tests `_ for each change you add in the pull request. It will be slower though ... diff --git a/MANIFEST.in b/MANIFEST.in index 6db46114..af1581be 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,6 +6,7 @@ prune examples/*/*/htmlcov prune examples/adhoc-layout/*.egg-info prune examples/src-layout/src/*.egg-info +graft .github/workflows graft src graft ci graft tests @@ -21,6 +22,6 @@ include CONTRIBUTING.rst include LICENSE include README.rst -include tox.ini .travis.yml .appveyor.yml .readthedocs.yml .pre-commit-config.yaml +include tox.ini .appveyor.yml .readthedocs.yml .pre-commit-config.yaml global-exclude *.py[cod] __pycache__/* *.so *.dylib .coverage .coverage.* diff --git a/README.rst b/README.rst index 149594fd..fa49179e 100644 --- a/README.rst +++ b/README.rst @@ -10,7 +10,7 @@ Overview * - docs - |docs| * - tests - - | |travis| |appveyor| |requires| + - | |github-actions| |appveyor| |requires| * - package - | |version| |conda-forge| |wheel| |supported-versions| |supported-implementations| | |commits-since| @@ -19,9 +19,9 @@ Overview :target: https://readthedocs.org/projects/pytest-cov :alt: Documentation Status -.. |travis| image:: https://api.travis-ci.com/pytest-dev/pytest-cov.svg?branch=master - :alt: Travis-CI Build Status - :target: https://travis-ci.com/github/pytest-dev/pytest-cov +.. |github-actions| image:: https://github.com/pytest-dev/pytest-cov/actions/workflows/test.yml/badge.svg + :alt: GitHub Actions Status + :target: https://github.com/pytest-dev/pytest-cov/actions .. |appveyor| image:: https://ci.appveyor.com/api/projects/status/github/pytest-dev/pytest-cov?branch=master&svg=true :alt: AppVeyor Build Status diff --git a/ci/templates/.travis.yml b/ci/templates/.travis.yml deleted file mode 100644 index 8c7e3b93..00000000 --- a/ci/templates/.travis.yml +++ /dev/null @@ -1,61 +0,0 @@ -dist: xenial -language: python -cache: false -env: - global: - - LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so - - SEGFAULT_SIGNALS=all -stages: - - lint - - examples - - tests -jobs: - fast_finish: true - allow_failures: - - python: '3.8' - include: - - stage: lint - env: TOXENV=check - - env: TOXENV=docs - - - stage: tests -{% for env in tox_environments %} - {%+ if not loop.first %}- {% else %} {% endif -%} - env: TOXENV={{ env }} - {% if env.startswith("pypy-") %} - python: 'pypy' - {% elif env.startswith("pypy3-") %} - python: 'pypy3' - {% else %} - python: '{{ "{0[2]}.{0[3]}".format(env) }}' - {% endif -%} -{% endfor %} - - - stage: examples -{%- for example in ['src', 'adhoc'] %}{{ '' }} - {%+ if not loop.first %}- {% else %} {% endif -%} - python: '3.8' - script: cd $TARGET; tox -v - env: - - TARGET=examples/{{ example }}-layout -{%- endfor %} - -before_install: - - python --version - - uname -a - - lsb_release -a -install: - - python -mpip install --progress-bar=off tox -rci/requirements.txt - - virtualenv --version - - easy_install --version - - pip --version - - tox --version -script: - - tox -v -after_failure: - - more .tox/log/* | cat - - more .tox/*/log/* | cat -notifications: - email: - on_success: never - on_failure: always diff --git a/docs/releasing.rst b/docs/releasing.rst index 245dca54..ae78228d 100644 --- a/docs/releasing.rst +++ b/docs/releasing.rst @@ -16,7 +16,7 @@ The process for releasing should follow these steps: git push git push --tags #. Wait for `AppVeyor `_ - and `Travis `_ to give the green builds. + and `GitHub Actions `_ to give the green builds. #. Check that the docs on `ReadTheDocs `_ are built. #. Make sure you have a clean checkout, run ``git status`` to verify. #. Manually clean temporary files (that are ignored and won't show up in ``git status``):: diff --git a/docs/reporting.rst b/docs/reporting.rst index e9e4b06b..eaa99ad3 100644 --- a/docs/reporting.rst +++ b/docs/reporting.rst @@ -71,4 +71,4 @@ The final report option can also suppress printing to the terminal:: This mode can be especially useful on continuous integration servers, where a coverage file is needed for subsequent processing, but no local report needs to be viewed. For example, -tests run on Travis-CI could produce a .coverage file for use with Coveralls. +tests run on GitHub Actions could produce a .coverage file for use with Coveralls. diff --git a/examples/adhoc-layout/example/__init__.py b/examples/adhoc-layout/example/__init__.py index 8a6dfd5e..684905a1 100644 --- a/examples/adhoc-layout/example/__init__.py +++ b/examples/adhoc-layout/example/__init__.py @@ -1,11 +1,10 @@ -import sys +import platform -PY2 = sys.version_info[0] == 2 - - -if PY2: +# test merging multiple tox runs with a platform +# based branch +if platform.python_implementation() == "PyPy": def add(a, b): - return b + a + return a + b else: def add(a, b): diff --git a/examples/adhoc-layout/tox.ini b/examples/adhoc-layout/tox.ini index 6e299f24..e855c315 100644 --- a/examples/adhoc-layout/tox.ini +++ b/examples/adhoc-layout/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,py38,report +envlist = pypy3,py39,report [tool:pytest] addopts = @@ -7,7 +7,7 @@ addopts = [testenv] setenv = - py{27,38}: COVERAGE_FILE = .coverage.{envname} + py{py3,39}: COVERAGE_FILE = .coverage.{envname} commands = pytest --cov --cov-config={toxinidir}/.coveragerc {posargs:-vv} deps = pytest @@ -19,7 +19,7 @@ deps = ../.. depends = - report: py27,py38 + report: pypy3,py39 # note that this is necessary to prevent the tests importing the code from your badly laid project changedir = tests diff --git a/examples/src-layout/src/example/__init__.py b/examples/src-layout/src/example/__init__.py index 8a6dfd5e..684905a1 100644 --- a/examples/src-layout/src/example/__init__.py +++ b/examples/src-layout/src/example/__init__.py @@ -1,11 +1,10 @@ -import sys +import platform -PY2 = sys.version_info[0] == 2 - - -if PY2: +# test merging multiple tox runs with a platform +# based branch +if platform.python_implementation() == "PyPy": def add(a, b): - return b + a + return a + b else: def add(a, b): diff --git a/examples/src-layout/tox.ini b/examples/src-layout/tox.ini index 6be8e73d..94b72730 100644 --- a/examples/src-layout/tox.ini +++ b/examples/src-layout/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,py38,report +envlist = pypy3,py39,report [tool:pytest] testpaths = tests @@ -8,7 +8,7 @@ addopts = [testenv] setenv = - py{27,38}: COVERAGE_FILE = .coverage.{envname} + py{py3,39}: COVERAGE_FILE = .coverage.{envname} commands = pytest --cov {posargs:-vv} deps = pytest @@ -20,7 +20,7 @@ deps = ../.. depends = - report: py27,py38 + report: pypy3,py39 [testenv:report] skip_install = true