Skip to content

Commit

Permalink
Fix Github Actions CI - introduce codecov (#1844)
Browse files Browse the repository at this point in the history
Co-authored-by: Sviatoslav Sydorenko <[email protected]>
  • Loading branch information
gaborbernat and webknjaz authored Jun 4, 2020
1 parent f72c697 commit 4b146e3
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 29 deletions.
77 changes: 59 additions & 18 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
Expand All @@ -19,7 +18,7 @@ jobs:
- uses: pre-commit/[email protected]

test:
name: ${{ matrix.os }} - ${{ matrix.py }}
name: test ${{ matrix.py }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
Expand All @@ -32,44 +31,84 @@ jobs:
- 3.8
- 3.7
- 3.6
- 3.5
- pypy3
- 2.7
- pypy2
- pypy3

include:
- {os: MacOs, py: brew@py3}
- {os: MacOs, py: brew@py2}
steps:
- uses: actions/checkout@v2
- uses: tox-dev/[email protected]
with:
python-version: ${{ matrix.py }}

- name: install OS dependencies
run: |
${{ runner.os == 'Linux' && 'sudo apt-get update -y && sudo apt-get install fish csh' || true}}
${{ runner.os == 'macOS' && 'brew update -vvv && brew install fish tcsh' || true}}
${{ runner.os == 'Windows' && ( matrix.py == '2.7' || matrix.py == 'pypy2' ) && 'choco install vcpython27 --yes -f' || true }}
shell: bash
- name: setup python for tox
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: install tox
run: python -m pip install tox
- uses: actions/checkout@v2
- name: use local virtualenv for tox
run: python -m pip install ${{ runner.os == 'Windows' && matrix.py == 'pypy3' && 'virtualenv<20' || '.'}}
- name: setup python for test ${{ matrix.py }}
if: "!startsWith(matrix.py,'brew@py')"
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py }}
- name: setup test suite for ${{ matrix.os }}-${{ matrix.py }}
run: tox -vve py --notest
- name: run test suite for ${{ matrix.os }}-${{ matrix.py }}
run: tox -e py
- name: load python from ${{ matrix.py }}
if: startsWith(matrix.py,'brew@py')
run: |
import os; import subprocess
version = "${{matrix.py}}"[-1]
subprocess.check_call(["brew", "install", f"python@{version}"])
print(f'::add-path::/usr/local/opt/python@{version}')
shell: python
- name: pick environment to run
run: |
import subprocess; import json
major, minor, impl = json.loads(subprocess.check_output(["python", "-c", "import json; import sys; import platform; print(json.dumps([sys.version_info[0], sys.version_info[1], platform.python_implementation()]));"], universal_newlines=True))
print('::set-env name=TOXENV::' + ("py" if impl == "CPython" else "pypy") + ("{}{}".format(major, minor) if impl == "CPython" else ("3" if major == 3 else "")))
shell: python
- name: setup test suite
run: tox -vv --notest
- name: run test suite
run: tox
env:
PYTEST_ADDOPTS: "-vv --durations=20"
CI_RUN: 'yes'
DIFF_AGAINST: HEAD
- name: rename coverage report file
run: |
import os; os.rename('.tox/coverage.{}.xml'.format(os.environ['TOXENV']), '.tox/coverage.xml')
shell: python
- uses: codecov/codecov-action@v1
with:
file: ./.tox/coverage.xml
flags: tests
name: ${{ matrix.py }} - ${{ matrix.os }}

check:
name: check ${{ matrix.tox_env }}
runs-on: Ubuntu-latest
name: check ${{ matrix.tox_env }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os:
- Ubuntu
- Windows
tox_env:
- dev
- docs
- readme
- upgrade
- dev
- zipapp
- docs

exclude:
- {os: Windows, tox_env: readme}
- {os: Windows, tox_env: docs}
steps:
- uses: actions/checkout@v2
- name: setup Python 3.8
Expand All @@ -80,3 +119,5 @@ jobs:
run: python -m pip install tox
- name: run check for ${{ matrix.tox_env }}
run: python -m tox -e ${{ matrix.tox_env }}
env:
UPGRADE_ADVISORY: 'yes'
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
[![Gitter Chat](https://img.shields.io/gitter/room/pypa/virtualenv?color=FF004F&style=flat-square)](https://gitter.im/pypa/virtualenv)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/virtualenv?style=flat-square)](https://pypistats.org/packages/virtualenv)
[![PyPI - License](https://img.shields.io/pypi/l/virtualenv?style=flat-square)](https://opensource.org/licenses/MIT)
[![Build Status](https://dev.azure.com/pypa/virtualenv/_apis/build/status/pypa.virtualenv?branchName=master)](https://dev.azure.com/pypa/virtualenv/_build/latest?definitionId=11&branchName=master)
[![Azure DevOps coverage](https://img.shields.io/azure-devops/coverage/pypa/virtualenv/11?style=flat-square)](https://dev.azure.com/pypa/virtualenv/_build?definitionId=11&_a=summary)
[![Build Status](https://github.com/bloomberg/pypa/virtualenv/check/badge.svg)](https://github.com/pypa/virtualenv/actions?query=workflow%3Acheck)
[![codecov](https://codecov.io/gh/pypa/virtualenv/branch/master/graph/badge.svg)](https://codecov.io/gh/pypa/virtualenv)
[![Code style:
black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black)

Expand Down
14 changes: 14 additions & 0 deletions codecov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
coverage:
range: "80...100"
coverage:
status:
patch: false
changes: false
project:
default:
target: '80'

comment:
layout: "diff, files"
behavior: default
require_changes: no
6 changes: 3 additions & 3 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Bugfixes - 20.0.21
- Fix virtualenv fails sometimes when run concurrently, ``--clear-app-data`` conflicts with :option:`clear` flag when
abbreviation is turned on. To bypass this while allowing abbreviated flags on the command line we had to move it to
:option:`reset-app-data` - by :user:`gaborbernat`. (`#1824 <https://github.com/pypa/virtualenv/issues/1824>`_)
- Upgrade embeded ``setuptools`` to ``46.4.0`` from ``46.1.3`` on Python ``3.5+``, and ``pip`` from ``20.1`` to ``20.1.1`` - by :user:`gaborbernat`. (`#1827 <https://github.com/pypa/virtualenv/issues/1827>`_)
- Upgrade embedded ``setuptools`` to ``46.4.0`` from ``46.1.3`` on Python ``3.5+``, and ``pip`` from ``20.1`` to ``20.1.1`` - by :user:`gaborbernat`. (`#1827 <https://github.com/pypa/virtualenv/issues/1827>`_)
- Seeder pip now correctly handles ``--extra-search-dir`` - by :user:`frenzymadness`. (`#1834 <https://github.com/pypa/virtualenv/issues/1834>`_)


Expand Down Expand Up @@ -94,7 +94,7 @@ Features - 20.0.14
~~~~~~~~~~~~~~~~~~
- Remove ``__PYVENV_LAUNCHER__`` on macOs for Python ``3.7.(<8)`` and ``3.8.(<3)`` on interpreter startup via ``pth``
file, this pulls in the `upstream patch <https://github.com/python/cpython/pull/9516>`_ - by :user:`gaborbernat`. (`#1704 <https://github.com/pypa/virtualenv/issues/1704>`_)
- Upgrade embeded setuptools for Python ``3.5+`` to ``46.1.1``, for Python ``2.7`` to ``44.1.0`` - by :user:`gaborbernat`. (`#1745 <https://github.com/pypa/virtualenv/issues/1745>`_)
- Upgrade embedded setuptools for Python ``3.5+`` to ``46.1.1``, for Python ``2.7`` to ``44.1.0`` - by :user:`gaborbernat`. (`#1745 <https://github.com/pypa/virtualenv/issues/1745>`_)

Bugfixes - 20.0.14
~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -193,7 +193,7 @@ Bugfixes - 20.0.8
- Having `distutils configuration <https://docs.python.org/3/install/index.html#distutils-configuration-files>`_
files that set ``prefix`` and ``install_scripts`` cause installation of packages in the wrong location -
by :user:`gaborbernat`. (`#1663 <https://github.com/pypa/virtualenv/issues/1663>`_)
- Fix ``PYTHONPATH`` being overriden on Python 2 — by :user:`jd`. (`#1673 <https://github.com/pypa/virtualenv/issues/1673>`_)
- Fix ``PYTHONPATH`` being overridden on Python 2 — by :user:`jd`. (`#1673 <https://github.com/pypa/virtualenv/issues/1673>`_)
- Fix list configuration value parsing from config file or environment variable - by :user:`gaborbernat`. (`#1674 <https://github.com/pypa/virtualenv/issues/1674>`_)
- Fix Batch activation script shell prompt to display environment name by default - by :user:`spetafree`. (`#1679 <https://github.com/pypa/virtualenv/issues/1679>`_)
- Fix startup on Python 2 is slower for virtualenv - this was due to setuptools calculating it's working set distribution
Expand Down
13 changes: 7 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ passenv = https_proxy http_proxy no_proxy HOME PYTEST_* PIP_* CI_RUN TERM
extras = testing
install_command = python -m pip install {opts} {packages} --disable-pip-version-check
commands =
coverage erase
coverage run -m pytest \
python -m coverage erase
python -m coverage run -m pytest \
--junitxml {toxworkdir}/junit.{envname}.xml \
tests {posargs:--int --timeout 600 -n {env:PYTEST_XDIST:auto}}

coverage combine
coverage report
coverage html -d {envtmpdir}/htmlcov
python -m coverage combine
python -m coverage report
python -m coverage xml -o {toxworkdir}/coverage.{envname}.xml
python -m coverage html -d {envtmpdir}/htmlcov

[testenv:coverage]
description = [run locally after tests]: combine coverage data and create report;
Expand All @@ -57,7 +58,7 @@ commands =
python -m coverage report --show-missing
python -m coverage xml -o {toxworkdir}/coverage.xml
python -m coverage html -d {toxworkdir}/htmlcov
diff-cover --compare-branch {env:DIFF_AGAINST:origin/master} {toxworkdir}/coverage.xml
python -m diff_cover.diff_cover_tool --compare-branch {env:DIFF_AGAINST:origin/master} {toxworkdir}/coverage.xml
depends =
py38,
py37,
Expand Down

0 comments on commit 4b146e3

Please sign in to comment.