Skip to content

Commit 679935b

Browse files
authored
Merge pull request #494 from hugovk/test-on-github-actions
Test on GitHub Actions
2 parents 88a062a + 96f9aad commit 679935b

File tree

14 files changed

+170
-180
lines changed

14 files changed

+170
-180
lines changed

.github/workflows/examples.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Examples
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
env:
6+
FORCE_COLOR: 1
7+
8+
jobs:
9+
examples:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
python-version: ["pypy-3.7", "3.9"]
15+
target: [
16+
"src-layout",
17+
"adhoc-layout",
18+
]
19+
include:
20+
# Add new helper variables to existing jobs
21+
- {python-version: "pypy-3.7", tox-python-version: "pypy3"}
22+
- {python-version: "3.9", tox-python-version: "py39"}
23+
steps:
24+
- uses: actions/checkout@v2
25+
26+
- name: Set up Python ${{ matrix.python-version }}
27+
uses: actions/setup-python@v2
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
31+
- name: Cache
32+
uses: actions/cache@v2
33+
with:
34+
path: ~/.cache/pip
35+
key:
36+
examples-v1-${{ hashFiles('**/tox.ini') }}
37+
restore-keys: |
38+
examples-v1-
39+
40+
- name: Install dependencies
41+
run: |
42+
python -m pip install -U pip
43+
python -m pip install -U wheel
44+
python -m pip install --progress-bar=off tox -rci/requirements.txt
45+
46+
- name: Examples
47+
run: |
48+
cd examples/${{ matrix.target }}
49+
tox -v -e ${{ matrix.tox-python-version }}

.github/workflows/lint.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Lint
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
env:
6+
FORCE_COLOR: 1
7+
8+
jobs:
9+
lint:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
toxenv: ["check", "docs"]
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: 3.9
23+
24+
- name: Cache
25+
uses: actions/cache@v2
26+
with:
27+
path: ~/.cache/pip
28+
key:
29+
lint-v1-${{ hashFiles('**/tox.ini') }}
30+
restore-keys: |
31+
lint-v1-
32+
33+
- name: Install dependencies
34+
run: |
35+
python -m pip install -U pip
36+
python -m pip install -U wheel
37+
python -m pip install --progress-bar=off tox -rci/requirements.txt
38+
39+
- name: Lint ${{ matrix.toxenv }}
40+
run: |
41+
tox -v -e ${{ matrix.toxenv }}

.github/workflows/test.yml

+54-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,27 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
python-version: ["3.9"]
14+
python-version: ["pypy-3.6", "pypy-3.7", "3.6", "3.7", "3.8", "3.9"]
15+
tox-extra-versions: [
16+
"pytest46-xdist127",
17+
"pytest46-xdist133",
18+
"pytest54-xdist133",
19+
"pytest62-xdist202",
20+
]
21+
include:
22+
# Add new helper variables to existing jobs
23+
- {python-version: "pypy-3.6", tox-python-version: "pypy3"}
24+
- {python-version: "pypy-3.7", tox-python-version: "pypy3"}
25+
- {python-version: "3.6", tox-python-version: "py36"}
26+
- {python-version: "3.7", tox-python-version: "py37"}
27+
- {python-version: "3.8", tox-python-version: "py38"}
28+
- {python-version: "3.9", tox-python-version: "py39"}
29+
exclude:
30+
# Remove some jobs from the matrix
31+
- {tox-extra-versions: "pytest46-xdist127", python-version: "3.8"}
32+
- {tox-extra-versions: "pytest46-xdist127", python-version: "3.9"}
33+
- {tox-extra-versions: "pytest46-xdist133", python-version: "3.9"}
34+
- {tox-extra-versions: "pytest54-xdist133", python-version: "3.9"}
1535

1636
steps:
1737
- uses: actions/checkout@v2
@@ -21,6 +41,37 @@ jobs:
2141
with:
2242
python-version: ${{ matrix.python-version }}
2343

24-
- name: Hello world
44+
- name: Get pip cache dir
45+
id: pip-cache
2546
run: |
26-
echo "hello world"
47+
echo "::set-output name=dir::$(pip cache dir)"
48+
49+
- name: Cache
50+
uses: actions/cache@v2
51+
with:
52+
path: ${{ steps.pip-cache.outputs.dir }}
53+
key:
54+
test-${{ matrix.python-version }}-v1-${{ hashFiles('**/requirements.txt') }}
55+
restore-keys: |
56+
test-${{ matrix.python-version }}-v1-
57+
58+
- name: Install dependencies
59+
run: |
60+
python -m pip install -U pip
61+
python -m pip install -U wheel
62+
python -m pip install --progress-bar=off tox -rci/requirements.txt
63+
virtualenv --version
64+
pip --version
65+
tox --version
66+
67+
- name: Tox tests
68+
run: |
69+
tox -v -e ${{ matrix.tox-python-version }}-${{ matrix.tox-extra-versions }}-coverage55
70+
71+
allgood:
72+
needs: test
73+
runs-on: ubuntu-latest
74+
name: Test successful
75+
steps:
76+
- name: Success
77+
run: echo Test successful

.travis.yml

-89
This file was deleted.

CONTRIBUTING.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ For merging, you should:
7373
3. Add a note to ``CHANGELOG.rst`` about the changes.
7474
4. Add yourself to ``AUTHORS.rst``.
7575

76-
.. [1] If you don't have all the necessary python versions available locally you can rely on Travis - it will
77-
`run the tests <https://travis-ci.com//github/pytest-dev/pytest-cov/pull_requests>`_
76+
.. [1] If you don't have all the necessary Python versions available locally you can rely on GitHub Actions - it will
77+
`run the tests <https://github.com/pytest-dev/pytest-cov/actions>`_
7878
for each change you add in the pull request.
7979
8080
It will be slower though ...

MANIFEST.in

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ prune examples/*/*/htmlcov
66
prune examples/adhoc-layout/*.egg-info
77
prune examples/src-layout/src/*.egg-info
88

9+
graft .github/workflows
910
graft src
1011
graft ci
1112
graft tests
@@ -21,6 +22,6 @@ include CONTRIBUTING.rst
2122
include LICENSE
2223
include README.rst
2324

24-
include tox.ini .travis.yml .appveyor.yml .readthedocs.yml .pre-commit-config.yaml
25+
include tox.ini .appveyor.yml .readthedocs.yml .pre-commit-config.yaml
2526

2627
global-exclude *.py[cod] __pycache__/* *.so *.dylib .coverage .coverage.*

README.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Overview
1010
* - docs
1111
- |docs|
1212
* - tests
13-
- | |travis| |appveyor| |requires|
13+
- | |github-actions| |appveyor| |requires|
1414
* - package
1515
- | |version| |conda-forge| |wheel| |supported-versions| |supported-implementations|
1616
| |commits-since|
@@ -19,9 +19,9 @@ Overview
1919
:target: https://readthedocs.org/projects/pytest-cov
2020
:alt: Documentation Status
2121

22-
.. |travis| image:: https://api.travis-ci.com/pytest-dev/pytest-cov.svg?branch=master
23-
:alt: Travis-CI Build Status
24-
:target: https://travis-ci.com/github/pytest-dev/pytest-cov
22+
.. |github-actions| image:: https://github.com/pytest-dev/pytest-cov/actions/workflows/test.yml/badge.svg
23+
:alt: GitHub Actions Status
24+
:target: https://github.com/pytest-dev/pytest-cov/actions
2525

2626
.. |appveyor| image:: https://ci.appveyor.com/api/projects/status/github/pytest-dev/pytest-cov?branch=master&svg=true
2727
:alt: AppVeyor Build Status

ci/templates/.travis.yml

-61
This file was deleted.

docs/releasing.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The process for releasing should follow these steps:
1616
git push
1717
git push --tags
1818
#. Wait for `AppVeyor <https://ci.appveyor.com/project/pytestbot/pytest-cov>`_
19-
and `Travis <https://travis-ci.org/schlamar/pytest-cov>`_ to give the green builds.
19+
and `GitHub Actions <https://github.com/pytest-dev/pytest-cov/actions>`_ to give the green builds.
2020
#. Check that the docs on `ReadTheDocs <https://readthedocs.org/projects/pytest-cov>`_ are built.
2121
#. Make sure you have a clean checkout, run ``git status`` to verify.
2222
#. Manually clean temporary files (that are ignored and won't show up in ``git status``)::

docs/reporting.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ The final report option can also suppress printing to the terminal::
7171

7272
This mode can be especially useful on continuous integration servers, where a coverage file
7373
is needed for subsequent processing, but no local report needs to be viewed. For example,
74-
tests run on Travis-CI could produce a .coverage file for use with Coveralls.
74+
tests run on GitHub Actions could produce a .coverage file for use with Coveralls.

examples/adhoc-layout/example/__init__.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import sys
1+
import platform
22

3-
PY2 = sys.version_info[0] == 2
4-
5-
6-
if PY2:
3+
# test merging multiple tox runs with a platform
4+
# based branch
5+
if platform.python_implementation() == "PyPy":
76
def add(a, b):
8-
return b + a
7+
return a + b
98

109
else:
1110
def add(a, b):

0 commit comments

Comments
 (0)