Add codecov support to AppVeyor and remove coveralls

This commit is contained in:
Bruno Oliveira 2018-09-02 10:22:20 -03:00
parent 410d5762c0
commit ec6fca4aa7
8 changed files with 46 additions and 45 deletions

2
.gitattributes vendored
View File

@ -1 +1 @@
CHANGELOG merge=union *.bat text eol=crlf

2
.gitignore vendored
View File

@ -35,6 +35,8 @@ env/
.cache .cache
.pytest_cache .pytest_cache
.coverage .coverage
.coverage.*
coverage.xml
.ropeproject .ropeproject
.idea .idea
.hypothesis .hypothesis

View File

@ -82,7 +82,9 @@ jobs:
before_script: before_script:
- | - |
if [[ "$PYTEST_NO_COVERAGE" != 1 ]]; then if [[ "$PYTEST_NO_COVERAGE" != 1 ]]; then
export _PYTEST_TOX_COVERAGE_RUN="env COVERAGE_FILE=$PWD/.coverage COVERAGE_PROCESS_START=$PWD/.coveragerc coverage run --source {envsitepackagesdir}/_pytest/,$PWD/testing -m" export COVERAGE_FILE="$PWD/.coverage"
export COVERAGE_PROCESS_START="$PWD/.coveragerc"
export _PYTEST_TOX_COVERAGE_RUN="coverage run --source {envsitepackagesdir}/_pytest/,{toxinidir}/testing -m"
export _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess export _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess
fi fi
@ -94,9 +96,9 @@ after_success:
set -e set -e
pip install codecov pip install codecov
coverage combine coverage combine
coverage xml coverage xml --ignore-errors
coverage report -m coverage report -m --ignore-errors
codecov --required -X gcov pycov search -f coverage.xml --flags ${TOXENV//-/ } codecov --required -X gcov pycov search -f coverage.xml --flags ${TOXENV//-/ } linux
# Coveralls does not support merged reports. # Coveralls does not support merged reports.
if [[ "$TOXENV" = py37 ]]; then if [[ "$TOXENV" = py37 ]]; then

View File

@ -1,27 +1,18 @@
environment: environment:
COVERALLS_REPO_TOKEN:
secure: 2NJ5Ct55cHJ9WEg3xbSqCuv0rdgzzb6pnzOIG5OkMbTndw3wOBrXntWFoQrXiMFi
# this is pytest's token in coveralls.io, encrypted
# using pytestbot account as detailed here:
# https://www.appveyor.com/docs/build-configuration#secure-variables
matrix: matrix:
# coveralls is not in the default env list
- TOXENV: "coveralls"
# note: please use "tox --listenvs" to populate the build matrix below
- TOXENV: "linting" - TOXENV: "linting"
PYTEST_NO_COVERAGE: "1"
- TOXENV: "py27" - TOXENV: "py27"
- TOXENV: "py34" - TOXENV: "py34"
- TOXENV: "py35" - TOXENV: "py35"
- TOXENV: "py36" - TOXENV: "py36"
- TOXENV: "py37" - TOXENV: "py37"
- TOXENV: "pypy" - TOXENV: "pypy"
- TOXENV: "py27-pexpect" PYTEST_NO_COVERAGE: "1"
- TOXENV: "py27-xdist" - TOXENV: "py27-xdist"
- TOXENV: "py27-trial" - TOXENV: "py27-trial"
- TOXENV: "py27-numpy" - TOXENV: "py27-numpy"
- TOXENV: "py27-pluggymaster" - TOXENV: "py27-pluggymaster"
- TOXENV: "py36-pexpect"
- TOXENV: "py36-xdist" - TOXENV: "py36-xdist"
- TOXENV: "py36-trial" - TOXENV: "py36-trial"
- TOXENV: "py36-numpy" - TOXENV: "py36-numpy"
@ -29,7 +20,9 @@ environment:
- TOXENV: "py27-nobyte" - TOXENV: "py27-nobyte"
- TOXENV: "doctesting" - TOXENV: "doctesting"
- TOXENV: "py36-freeze" - TOXENV: "py36-freeze"
PYTEST_NO_COVERAGE: "1"
- TOXENV: "docs" - TOXENV: "docs"
PYTEST_NO_COVERAGE: "1"
install: install:
- echo Installed Pythons - echo Installed Pythons
@ -37,12 +30,19 @@ install:
- if "%TOXENV%" == "pypy" call scripts\install-pypy.bat - if "%TOXENV%" == "pypy" call scripts\install-pypy.bat
- C:\Python36\python -m pip install --upgrade pip
- C:\Python36\python -m pip install --upgrade --pre tox - C:\Python36\python -m pip install --upgrade --pre tox
build: false # Not a C# project, build stuff at the test step instead. build: false # Not a C# project, build stuff at the test step instead.
before_test:
- call scripts\prepare-coverage.bat
test_script: test_script:
- call scripts\call-tox.bat - C:\Python36\python -m tox
on_success:
- call scripts\upload-coverage.bat
cache: cache:
- '%LOCALAPPDATA%\pip\cache' - '%LOCALAPPDATA%\pip\cache'

View File

@ -1,8 +0,0 @@
REM skip "coveralls" run in PRs or forks
if "%TOXENV%" == "coveralls" (
if not defined COVERALLS_REPO_TOKEN (
echo skipping coveralls run because COVERALLS_REPO_TOKEN is not defined
exit /b 0
)
)
C:\Python36\python -m tox

View File

@ -0,0 +1,10 @@
REM scripts called by AppVeyor to setup the environment variables to enable coverage
if not defined PYTEST_NO_COVERAGE (
set "COVERAGE_FILE=%CD%\.coverage"
set "COVERAGE_PROCESS_START=%CD%\.coveragerc"
set "_PYTEST_TOX_COVERAGE_RUN=coverage run --source {envsitepackagesdir}/_pytest/,{toxinidir}/testing -m"
set "_PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess"
echo Coverage setup completed
) else (
echo Skipping coverage setup, PYTEST_NO_COVERAGE is set
)

View File

@ -0,0 +1,11 @@
REM script called by AppVeyor to combine and upload coverage information to codecov
if not defined PYTEST_NO_COVERAGE (
echo Prepare to upload coverage information
C:\Python36\Scripts\pip install codecov
C:\Python36\Scripts\coverage combine
C:\Python36\Scripts\coverage xml --ignore-errors
C:\Python36\Scripts\coverage report -m --ignore-errors
C:\Python36\Scripts\codecov --required -X gcov pycov search -f coverage.xml --flags %TOXENV:-= % windows
) else (
echo Skipping coverage upload, PYTEST_NO_COVERAGE is set
)

24
tox.ini
View File

@ -18,14 +18,14 @@ envlist =
[testenv] [testenv]
commands = commands =
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest --lsof -ra {env:_PYTEST_TEST_OPTS:} {posargs:testing} {env:_PYTEST_TOX_COVERAGE_RUN:} pytest --lsof -ra {posargs:testing}
coverage: coverage report -m --skip-covered passenv = USER USERNAME
setenv = setenv =
# configuration if a user runs tox with a "coverage" factor, for example "tox -e py36-coverage"
coverage: _PYTEST_TOX_COVERAGE_RUN=coverage run -m coverage: _PYTEST_TOX_COVERAGE_RUN=coverage run -m
coverage: _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess coverage: _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess
coverage: COVERAGE_FILE={toxinidir}/.coverage coverage: COVERAGE_FILE={toxinidir}/.coverage
coverage: COVERAGE_PROCESS_START={toxinidir}/.coveragerc coverage: COVERAGE_PROCESS_START={toxinidir}/.coveragerc
passenv = USER USERNAME
deps = deps =
hypothesis>=3.56 hypothesis>=3.56
nose nose
@ -56,9 +56,8 @@ deps =
nose nose
hypothesis>=3.56 hypothesis>=3.56
{env:_PYTEST_TOX_EXTRA_DEP:} {env:_PYTEST_TOX_EXTRA_DEP:}
changedir=testing
commands = commands =
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -n8 -ra {posargs:.} {env:_PYTEST_TOX_COVERAGE_RUN:} pytest -n8 -ra {posargs:testing}
[testenv:py36-xdist] [testenv:py36-xdist]
deps = {[testenv:py27-xdist]deps} deps = {[testenv:py27-xdist]deps}
@ -177,21 +176,6 @@ commands =
{envpython} create_executable.py {envpython} create_executable.py
{envpython} tox_run.py {envpython} tox_run.py
[testenv:coveralls]
passenv = CI TRAVIS TRAVIS_* COVERALLS_REPO_TOKEN
usedevelop = True
changedir = .
deps =
{[testenv]deps}
coveralls
codecov
commands =
coverage run -m pytest testing
coverage report -m
coveralls
codecov
[testenv:release] [testenv:release]
decription = do a release, required posarg of the version number decription = do a release, required posarg of the version number
basepython = python3.6 basepython = python3.6