Skip to content

Commit

Permalink
Merge pull request #494 from hugovk/test-on-github-actions
Browse files Browse the repository at this point in the history
Test on GitHub Actions
  • Loading branch information
ionelmc authored Sep 28, 2021
2 parents 88a062a + 96f9aad commit 679935b
Show file tree
Hide file tree
Showing 14 changed files with 170 additions and 180 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -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 }}
41 changes: 41 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -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 }}
57 changes: 54 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
89 changes: 0 additions & 89 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://travis-ci.com//github/pytest-dev/pytest-cov/pull_requests>`_
.. [1] If you don't have all the necessary Python versions available locally you can rely on GitHub Actions - it will
`run the tests <https://github.com/pytest-dev/pytest-cov/actions>`_
for each change you add in the pull request.
It will be slower though ...
Expand Down
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.*
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand All @@ -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
Expand Down
61 changes: 0 additions & 61 deletions ci/templates/.travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion docs/releasing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The process for releasing should follow these steps:
git push
git push --tags
#. Wait for `AppVeyor <https://ci.appveyor.com/project/pytestbot/pytest-cov>`_
and `Travis <https://travis-ci.org/schlamar/pytest-cov>`_ to give the green builds.
and `GitHub Actions <https://github.com/pytest-dev/pytest-cov/actions>`_ to give the green builds.
#. Check that the docs on `ReadTheDocs <https://readthedocs.org/projects/pytest-cov>`_ 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``)::
Expand Down
2 changes: 1 addition & 1 deletion docs/reporting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
11 changes: 5 additions & 6 deletions examples/adhoc-layout/example/__init__.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
Loading

0 comments on commit 679935b

Please sign in to comment.