Skip to content

Commit

Permalink
Codecov integration
Browse files Browse the repository at this point in the history
  • Loading branch information
wbond committed Dec 7, 2016
1 parent bf37022 commit 1b72ccc
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 46 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ tests/output/
oscrypto.sublime-project
oscrypto.sublime-workspace
.coverage
.tox
.tox
coverage.xml
100 changes: 71 additions & 29 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,96 +7,138 @@ matrix:
include:
- os: osx
python: "2.6"
env: TRAVIS_PYTHON_VERSION=2.6
env:
PYTHON_VERSION=2.6
PLATFORM=osx
- os: osx
python: "2.7"
env: TRAVIS_PYTHON_VERSION=2.7
env:
PYTHON_VERSION=2.7
PLATFORM=osx-10.11
- os: osx
osx_image: xcode7.1
osx_image: xcode6.4
python: "2.7"
env: TRAVIS_PYTHON_VERSION=2.7
env:
PYTHON_VERSION=2.7
PLATFORM=osx-10.10
- os: osx
osx_image: xcode7.3
osx_image: xcode8.1
python: "2.7"
env: TRAVIS_PYTHON_VERSION=2.7
env:
PYTHON_VERSION=2.7
PLATFORM=osx-10.12
- os: osx
python: "3.5"
env: TRAVIS_PYTHON_VERSION=3.5
env:
PYTHON_VERSION=3.5
PLATFORM=osx
- os: osx
python: "pypy"
env: TRAVIS_PYTHON_VERSION=pypy
env:
PYTHON_VERSION=pypy
PLATFORM=osx
- os: linux
language: python
python: "2.6"
env:
PYTHON_VERSION=2.6
PLATFORM=linux
- os: linux
language: python
python: "2.7"
env:
PYTHON_VERSION=2.7
PLATFORM=linux
- os: linux
language: python
python: "3.2"
env:
PYTHON_VERSION=3.2
PLATFORM=linux
- os: linux
language: python
python: "3.3"
env:
PYTHON_VERSION=3.3
PLATFORM=linux
- os: linux
language: python
python: "3.4"
env:
PYTHON_VERSION=3.4
PLATFORM=linux
- os: linux
language: python
python: "3.5"
env:
PYTHON_VERSION=3.5
PLATFORM=linux
- os: linux
language: python
python: "pypy"
env:
PYTHON_VERSION=pypy
PLATFORM=linux
install:
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
if [ "$TRAVIS_PYTHON_VERSION" == "pypy" ]; then
if [ "$PYTHON_VERSION" == "pypy" ]; then
echo "Updating homebrew";
brew update;
echo "Installing pypy";
brew install pypy;
echo "Installing flake8";
/usr/local/bin/pip_pypy install flake8;
echo "Installing flake8 and coverage";
/usr/local/bin/pip_pypy install flake8 coverage;
echo "Installing asn1crypto";
/usr/local/bin/pip_pypy install https://github.com/wbond/asn1crypto/archive/master.zip;
export PYTHON_BIN=/usr/local/bin/pypy;
else
if [ "$TRAVIS_PYTHON_VERSION" == "3.5" ]; then
if [ "$PYTHON_VERSION" == "3.5" ]; then
echo "Updating homebrew";
brew update;
echo "Installing python3";
brew install python3;
echo "Installing flake8";
/usr/local/bin/pip3 install flake8;
echo "Installing flake8 and coverage";
/usr/local/bin/pip3 install flake8 coverage;
echo "Installing asn1crypto";
/usr/local/bin/pip3 install https://github.com/wbond/asn1crypto/archive/master.zip;
export PYTHON_BIN=/usr/local/bin/python3;
else
if [ "$TRAVIS_PYTHON_VERSION" == "2.7" ]; then
if [ "$PYTHON_VERSION" == "2.7" ]; then
echo "Installing pip";
curl --silent --show-error https://bootstrap.pypa.io/get-pip.py | sudo /usr/bin/python2.7;
echo "Installing flake8";
sudo /usr/bin/python2.7 -W ignore -c "import pip; pip.main(['--disable-pip-version-check', '--quiet', 'install', 'flake8'])";
echo "Installing flake8 and coverage";
sudo /usr/bin/python2.7 -W ignore -c "import pip; pip.main(['--disable-pip-version-check', '--quiet', 'install', 'flake8', 'coverage'])";
echo "Installing asn1crypto";
sudo /usr/bin/python2.7 -W ignore -c "import pip; pip.main(['--disable-pip-version-check', '--quiet', 'install', 'https://github.com/wbond/asn1crypto/archive/master.zip'])";
export PYTHON_BIN=/usr/bin/python2.7;
else
echo "Installing pip";
curl --silent --show-error https://bootstrap.pypa.io/get-pip.py | sudo /usr/bin/python2.6 -W ignore;
echo "Installing coverage";
sudo /usr/bin/python2.6 -W ignore -c "import pip; pip.main(['--disable-pip-version-check', '--quiet', 'install', 'coverage'])";
echo "Installing asn1crypto";
curl --silent --show-error --location -o asn1crypto-master.zip https://github.com/wbond/asn1crypto/archive/master.zip;
unzip asn1crypto-master.zip;
cd asn1crypto-master;
sudo /usr/bin/python2.6 setup.py install clean;
cd ..;
sudo /usr/bin/python2.6 -W ignore -c "import pip; pip.main(['--disable-pip-version-check', '--quiet', 'install', 'https://github.com/wbond/asn1crypto/archive/master.zip'])";
export PYTHON_BIN=/usr/bin/python2.6;
fi
fi
fi
fi;
fi;
fi;
else
echo "Upgrading pip";
python -c "import sys,pip; pip.main(['install', '--upgrade', 'pip' + ('==7.1.2' if sys.version_info[0:2] == (3, 2) else '')])";
echo "Installing flake8";
pip install flake8;
if [ "$PYTHON_VERSION" == "3.2" ]; then
echo "Upgrading pip";
python -c "import sys,pip; pip.main(['install', '--upgrade', 'pip==7.1.2'])";
echo "Installing flake8";
pip install flake8;
else
echo "Upgrading pip";
python -c "import sys,pip; pip.main(['install', '--upgrade', 'pip'])";
echo "Installing flake8 and coverage";
pip install flake8 coverage;
fi;
echo "Installing asn1crypto";
pip install https://github.com/wbond/asn1crypto/archive/master.zip;
export PYTHON_BIN=python;
fi
script:
- $PYTHON_BIN run.py ci
after_success:
- bash <(curl -s https://codecov.io/bash) -X gcov -f coverage.xml -e PYTHON_VERSION,PLATFORM
36 changes: 27 additions & 9 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,38 @@ environment:
- PYTHON: "C:\\Python26"
PYTHON_ID: "26"
PYTHON_EXE: python
PYTHON_VERSION: "2.6"
PLATFORM: win-x32
- PYTHON: "C:\\Python26-x64"
PYTHON_ID: "26-x64"
PYTHON_EXE: python
PYTHON_VERSION: "2.6"
PLATFORM: win-x64
- PYTHON: "C:\\Python27"
PYTHON_ID: "27"
PYTHON_EXE: python
PYTHON_VERSION: "2.7"
PLATFORM: win-x32
- PYTHON: "C:\\Python27-x64"
PYTHON_ID: "27-x64"
PYTHON_EXE: python
PYTHON_VERSION: "2.7"
PLATFORM: win-x64
- PYTHON: "C:\\Python33"
PYTHON_ID: "33"
PYTHON_EXE: python
PYTHON_VERSION: "3.3"
PLATFORM: win-x32
- PYTHON: "C:\\Python33-x64"
PYTHON_ID: "33-x64"
PYTHON_EXE: python
PYTHON_VERSION: "3.3"
PLATFORM: win-x64
- PYTHON: "C:\\pypy2-v5.3.1-win32"
PYTHON_ID: "pypy"
PYTHON_EXE: pypy
PYTHON_VERSION: "pypy"
PLATFORM: win-x32
install:
- ps: |-
$env:PYTMP = "${env:TMP}\py";
Expand All @@ -39,25 +53,29 @@ install:
(New-Object Net.WebClient).DownloadFile('https://bootstrap.pypa.io/get-pip.py', "${env:PYTMP}\get-pip.py");
}
& "${env:PYTHON}\pypy.exe" "${env:PYTMP}\get-pip.py";
& "${env:PYTHON}\bin\pip.exe" --disable-pip-version-check --quiet install flake8;
& "${env:PYTHON}\bin\pip.exe" --disable-pip-version-check --quiet install flake8 coverage;
& "${env:PYTHON}\bin\pip.exe" --disable-pip-version-check --quiet install https://github.com/wbond/asn1crypto/archive/master.zip;
} elseif ("${env:PYTHON_ID}" -eq "26" -or "${env:PYTHON_ID}" -eq "26-x64") {
# Skip flake8 for 2.6 since pip, flake8 and pycodestyle have all deprecated support for it
(New-Object Net.WebClient).DownloadFile('https://github.com/wbond/asn1crypto/archive/master.zip', "${env:TMP}\asn1crypto-master.zip");
7z x -y "${env:TMP}\asn1crypto-master.zip" -o"${env:TMP}\" | Out-Null;
$origDir = "$pwd";
cd "${env:TMP}\asn1crypto-master\";
& "${env:PYTHON}\python.exe" setup.py install clean;
cd "$origDir";
if (!(Test-Path "${env:PYTMP}\get-pip.py")) {
(New-Object Net.WebClient).DownloadFile('https://bootstrap.pypa.io/get-pip.py', "${env:PYTMP}\get-pip.py");
}
& "${env:PYTHON}\python.exe" -W ignore "${env:PYTMP}\get-pip.py";
# Skip flake8 for 2.6 since flake8 and pycodestyle have deprecated support for it
& "${env:PYTHON}\python.exe" -W ignore -c "import pip; pip.main(['--disable-pip-version-check', '--quiet', 'install', 'coverage'])";
& "${env:PYTHON}\python.exe" -W ignore -c "import pip; pip.main(['--disable-pip-version-check', '--quiet', 'install', 'https://github.com/wbond/asn1crypto/archive/master.zip'])";
} else {
& "${env:PYTHON}\Scripts\pip.exe" --disable-pip-version-check --quiet install flake8;
& "${env:PYTHON}\Scripts\pip.exe" --disable-pip-version-check --quiet install flake8 coverage;
& "${env:PYTHON}\Scripts\pip.exe" --disable-pip-version-check --quiet install https://github.com/wbond/asn1crypto/archive/master.zip;
}
& "C:\Python27-x64\Scripts\pip.exe" --disable-pip-version-check --quiet install https://github.com/codecov/codecov-python/archive/v2.0.6.zip;
- "SET PATH=%PYTHON%;%PATH%"
cache:
- '%TMP%\py\'
build: off
test_script:
- cmd: "%PYTHON_EXE% run.py ci"
after_test:
- C:\Python27-x64\Scripts\codecov -X gcov -f coverage.xml -e PYTHON_VERSION PLATFORM
17 changes: 13 additions & 4 deletions dev/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@

import sys

from .tests import run as run_tests
if sys.version_info >= (2, 7):
from .lint import run as run_lint
if sys.version_info < (3, 0) or sys.version_info >= (3, 3):
from .coverage import run as run_coverage
else:
from .tests import run as run_tests


def run():
Expand All @@ -22,8 +25,14 @@ def run():
lint_result = run_lint()
else:
lint_result = True
print('\nRunning tests')
sys.stdout.flush()
tests_result = run_tests()

if sys.version_info < (3, 0) or sys.version_info >= (3, 3):
print('\nRunning tests (via coverage.py)')
sys.stdout.flush()
tests_result = run_coverage(write_xml=True)
else:
print('\nRunning tests')
sys.stdout.flush()
tests_result = run_tests()

return lint_result and tests_result
4 changes: 3 additions & 1 deletion dev/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import coverage


def run():
def run(write_xml=False):
"""
Runs the tests while measuring coverage
Expand All @@ -23,5 +23,7 @@ def run():
cov.save()

cov.report(show_missing=False)
if write_xml:
cov.xml_report()

return result
23 changes: 21 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,27 @@
envlist = py26,py27,py32,py33,py34,py35,pypy

[testenv]
deps = asn1crypto
flake8
deps =
asn1crypto
py26:
coverage
py27:
flake8
coverage
py32:
flake8
py33:
flake8
coverage
py34:
flake8
coverage
py35:
flake8
coverage
pypy:
flake8
coverage
commands = {envpython} run.py ci

[pep8]
Expand Down

0 comments on commit 1b72ccc

Please sign in to comment.