Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9625] improve cloud code coverage configuration #1129

Merged
merged 15 commits into from
Apr 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ jobs:
command: |
tox -r -e py27-alldeps-withcov-posix twisted

- run:
name: Upload coverage.
command: |
tox -r -e coverage-prepare,codecov-push,coveralls-push

#
# MacOS with Python3.7 and default reactor.
#
Expand Down Expand Up @@ -175,6 +180,11 @@ jobs:
command: |
tox -r -e py37-alldeps-withcov-posix twisted

- run:
name: Upload coverage.
command: |
tox -r -e coverage-prepare,codecov-push,coveralls-push


# First we run the static checkers, and only if they pass we spin the macOS.
# in this way we should save some macOS minutes as we only have 1000h per month.
Expand Down
1 change: 1 addition & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
repo_token: "JFDTIRUVOQ8jCM3zcajrZALlpKXyiXGAX"
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ matrix:
- docker
env: PIP=pip TOXENV=wheels
- python: 2.7
env: TOXENV=py27-alldeps-withcov-posix,codecov-publish
env: TOXENV=py27-alldeps-withcov-posix,coverage-prepare,codecov-push,coveralls-push
- python: 2.7
env: TOXENV=py27-nodeps-withcov-posix,codecov-publish
env: TOXENV=py27-nodeps-withcov-posix,coverage-prepare,codecov-push,coveralls-push
- python: 3.5
env: TOXENV=py35-alldeps-withcov-posix,codecov-publish
env: TOXENV=py35-alldeps-withcov-posix,coverage-prepare,codecov-push,coveralls-push
- python: 3.6
env: TOXENV=py36-alldeps-withcov-posix,codecov-publish
env: TOXENV=py36-alldeps-withcov-posix,coverage-prepare,codecov-push,coveralls-push
- python: 3.7
env: TOXENV=py37-alldeps-withcov-posix,codecov-publish
env: TOXENV=py37-alldeps-withcov-posix,coverage-prepare,codecov-push,coveralls-push
- python: 3.5
env: TOXENV=lint
# We need a builder without IPv6. This is going to be slower than all the
# others, but that's ok.
- python: 3.6
env: TOXENV=py36-alldeps-withcov-posix,codecov-publish DISABLE_IPV6=yes
env: TOXENV=py36-alldeps-withcov-posix,coverage-prepare,codecov-push,coveralls-push DISABLE_IPV6=yes

addons:
apt:
Expand Down
2 changes: 1 addition & 1 deletion .travis/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if [[ "$(uname -s)" == "Darwin" ]]; then
# Initialize the virtualenv created at install time.
source ~/.venv/bin/activate

if [[ "${TOXENV}" == "py35-alldeps-withcov-macos,codecov-publish" ]]; then
if [[ "${TOXENV}" =~ py35-.* ]]; then
# Add pyenv path
PYENV_ROOT="$HOME/.pyenv";
PATH="$PYENV_ROOT/bin:$PATH";
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ include NEWS.rst README.rst INSTALL.rst CONTRIBUTING LICENSE code_of_conduct.md
exclude pyproject.toml
exclude codecov.yml
exclude appveyor.yml
exclude .coveralls.yml
exclude .circleci
recursive-exclude .circleci *
prune bin
Expand Down
24 changes: 12 additions & 12 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,49 +34,49 @@ environment:
# a later point release.
# See: http://www.appveyor.com/docs/installed-software#python
matrix:
- PYTHON_HOME: C:\\PYTHON36-x64
PYTHON_VERSION: "3.6"
PYTHON_ARCH: "64"
TOXENV: wheels

- PYTHON_HOME: C:\\Python27-x64
PYTHON_VERSION: "2.7"
PYTHON_ARCH: "64"
TOXENV: py27-alldeps-withcov-windows,codecov-publish
TOXENV: py27-alldeps-withcov-windows,coverage-prepare,codecov-push,coveralls-push
TWISTED_REACTOR: "select"
- PYTHON_HOME: C:\\PYTHON36-x64
PYTHON_VERSION: "3.6"
PYTHON_ARCH: "64"
TOXENV: py36-alldeps-withcov-windows,codecov-publish
TOXENV: py36-alldeps-withcov-windows,coverage-prepare,codecov-push,coveralls-push
TWISTED_REACTOR: "select"
- PYTHON_HOME: C:\\PYTHON37-x64
PYTHON_VERSION: "3.7"
PYTHON_ARCH: "64"
TOXENV: py37-alldeps-withcov-windows,codecov-publish
TOXENV: py37-alldeps-withcov-windows,coverage-prepare,codecov-push,coveralls-push
TWISTED_REACTOR: "select"
- PYTHON_HOME: C:\\PYTHON37-x64
PYTHON_VERSION: "3.7"
PYTHON_ARCH: "64"
TOXENV: py37-nodeps-withcov-windows,codecov-publish
TOXENV: py37-nodeps-withcov-windows,coverage-prepare,codecov-push,coveralls-push
TWISTED_REACTOR: "select"

# IOCPReactor tests
- PYTHON_HOME: C:\\Python27-x64
PYTHON_VERSION: "2.7"
PYTHON_ARCH: "64"
TOXENV: py27-alldeps-withcov-windows,codecov-publish
TOXENV: py27-alldeps-withcov-windows,coverage-prepare,codecov-push,coveralls-push
TWISTED_REACTOR: "iocp"
- PYTHON_HOME: C:\\PYTHON36-x64
PYTHON_VERSION: "3.6"
PYTHON_ARCH: "64"
TOXENV: py36-alldeps-withcov-windows,codecov-publish
TOXENV: py36-alldeps-withcov-windows,coverage-prepare,codecov-push,coveralls-push
TWISTED_REACTOR: "iocp"
- PYTHON_HOME: C:\\PYTHON37-x64
PYTHON_VERSION: "3.7"
PYTHON_ARCH: "64"
TOXENV: py37-alldeps-withcov-windows,codecov-publish
TOXENV: py37-alldeps-withcov-windows,coverage-prepare,codecov-push,coveralls-push
TWISTED_REACTOR: "iocp"

- PYTHON_HOME: C:\\PYTHON36-x64
PYTHON_VERSION: "3.6"
PYTHON_ARCH: "64"
TOXENV: wheels


install:
# Install OpenSSH through chocolatey
Expand Down
4 changes: 1 addition & 3 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ coverage:
default:
target: 100%

comment:
layout: "header, diff, uncovered"
behavior: default
comment: off
Empty file.
66 changes: 42 additions & 24 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,13 @@
; * macos1010 - prepare the tests to be run in a macOS 10.10 environment (superset of posix)
; * windows - prepare the tests to be executed under Windows.
;
; Some tags are defined only while transitioning to an updated Buildbot and
; should be removed after the transition.
; See: https://github.com/twisted-infra/braid/issues/222
;
; * tests - similar to alldeps
; * coverage - similar to withcov and alldeps
; * nomodules - similar to nodeps
;
; There is a non-default `codecov-publish` environment used to publish the
; coverage results to codecov.io. It should be called after running the
; standard coverage environment.
; There is are non-default `codecov-push` and `coveralls-push` environments
; used to push the coverage results to codecov.io and coveralls.io,
; respectively. They should be called after running both some number of
; `-withcov` environments and also `coverage-prepare`.

; For compatibility with the current buildbot infrastructure, `codecov-publish`
; combines `coverage-prepare` and `codecov-push` into a single step.
;
; A non-default `txchecker-travis` environment is used to run twistedchecker
; on travis in --diff mode
Expand All @@ -37,22 +33,27 @@ envlist=lint,pyflakes,apidocs,narrativedocs,newsfragment,manifest-checker,py27-a
[testenv]
;; dependencies managed by extras in t.p._setup.py._EXTRAS_REQUIRE
extras =
{alldeps,tests,coverage}: all_non_platform
alldeps: all_non_platform

windows: windows_platform

{alldeps,tests}-macos: osx_platform
alldeps-macos: osx_platform

; Documentation needs Twisted install to get the version.
narrativedocs: dev

;; dependencies that are not specified as extras
deps =
py27-{alldeps,tests,coverage}-{posix,macos}: pysqlite
py27-alldeps-{posix,macos}: pysqlite

{withcov,coverage}: coverage
{withcov}: coverage

codecov-publish: codecov==2.0.5
{coverage-prepare,codecov-publish}: coverage

{codecov-push,codecov-publish}: codecov

coveralls-push: coveralls
coveralls-push: PyYAML

wheel: wheel

Expand Down Expand Up @@ -99,17 +100,22 @@ commands =
apidocs: pip install --no-deps epydoc pydoctor

; Run tests without wrapping them using coverage.
{nocov,nomodules,tests}: python -m twisted.trial --reactor={env:TWISTED_REACTOR:default} --reporter={env:TRIAL_REPORTER:verbose} {posargs:twisted}
nocov: python -m twisted.trial --reactor={env:TWISTED_REACTOR:default} --reporter={env:TRIAL_REPORTER:verbose} {posargs:twisted}

; Run the tests wrapped using coverage.
{withcov,coverage}: python {toxinidir}/admin/_copy.py {toxinidir}/admin/zz_coverage.pth {envsitepackagesdir}/zz_coverage.pth
{withcov,coverage}: coverage erase
{withcov,coverage}: coverage run -p --rcfile={toxinidir}/.coveragerc -m twisted.trial --reactor={env:TWISTED_REACTOR:default} --reporter={env:TRIAL_REPORTER:verbose} {posargs:twisted}
withcov: python {toxinidir}/admin/_copy.py {toxinidir}/admin/zz_coverage.pth {envsitepackagesdir}/zz_coverage.pth
withcov: coverage erase
withcov: coverage run -p --rcfile={toxinidir}/.coveragerc -m twisted.trial --reactor={env:TWISTED_REACTOR:default} --reporter={env:TRIAL_REPORTER:verbose} {posargs:twisted}

; Prepare coverage reports for publication.
{coverage-prepare,codecov-publish}: coverage combine
{coverage-prepare,codecov-publish}: coverage xml -o coverage.xml -i

; Publish the coverage reports to codecov.io
codecov-publish: coverage combine
codecov-publish: coverage xml -o coverage.xml -i
codecov-publish: codecov {env:CODECOV_OPTIONS:} -X search -X gcov -f coverage.xml
; Publish coverage reports to codecov.
{codecov-push,codecov-publish}: codecov {env:CODECOV_OPTIONS:} -X search -X gcov -f coverage.xml

; Publish coverage reports to coveralls.
coveralls-push: coveralls

; Build in a root folder so that buildbot can pick the result
wheel: python setup.py bdist_wheel --dist-dir {toxinidir}/dist
Expand Down Expand Up @@ -140,3 +146,15 @@ skip_install = true
[testenv:lint]
basepython=python3.5
usedevelop=True

[testenv:coverage-prepare]
skip_install=True

[testenv:codecov-publish]
skip_install=True

[testenv:codecov-push]
skip_install=True

[testenv:coveralls-push]
skip_install=True