Skip to content

Commit

Permalink
Move coverage reporting outside of tox.
Browse files Browse the repository at this point in the history
  • Loading branch information
adiroiban committed Mar 28, 2021
1 parent 083c1c3 commit 5badeba
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 39 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
runs-on: ubuntu-20.04
env:
TOXENV: "${{ matrix.tox-env }}"
CODECOV_OPTIONS: "-n 'lnx-${{ matrix.python-version }}-${{ matrix.tox-env }}${{ matrix.noipv6 }}'"
TRIAL_ARGS: "${{ matrix.trial-args }}"
name: ${{ matrix.python-version }}${{ matrix.noipv6 }}-${{ matrix.tox-env }}
strategy:
Expand Down Expand Up @@ -99,7 +98,7 @@ jobs:
- uses: twisted/python-info-action@v1
- name: Install dependencies
run: |
python -m pip install --upgrade pip tox
python -m pip install --upgrade pip tox codecov coveralls
tox --notest
- name: Test
Expand All @@ -110,7 +109,10 @@ jobs:
- name: Publish coverage
# We want to publish coverage even on failure.
if: contains(matrix['tox-env'], 'withcov') || failure()
run: tox -e coverage-prepare,codecov-push,coveralls-push
run: |
python -m coverage xml -o coverage.xml -i
python -m codecov -n 'lnx-${{ matrix.python-version }}-${{ matrix.tox-env }}${{ matrix.noipv6 }}' -X search -X gcov -f coverage.xml
python -m coveralls
pypi-publish:
Expand Down
6 changes: 3 additions & 3 deletions azure-pipelines/run_test_steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ steps:
python -c "import os; [ print(e,v) for (e,v) in os.environ.items() ]"
displayName: 'Get Python Information'

- script: 'python -m pip install -U pip setuptools tox'
- script: 'python -m pip install -U pip setuptools tox coveralls'
displayName: 'Update pip & install tox'

- ${{ if eq(parameters.platform, 'macos') }}:
Expand All @@ -63,6 +63,6 @@ steps:
TWISTED_REACTOR: ${{ parameters.windowsReactor }}

- bash: |
python -m tox -e coverage-prepare,coveralls-push
bash <(curl -s https://codecov.io/bash) -n "${{ parameters.platform }}-${{ parameters.pythonVersion }}-alldeps-withcov"
bash <(curl -s https://codecov.io/bash) -v -n "${{ parameters.platform }}-${{ parameters.pythonVersion }}-alldeps-withcov"
python -m coveralls
displayName: 'Report coverage'
Empty file.
35 changes: 2 additions & 33 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@
;
; See README.rst for example tox commands.
;
; There are also various non-default environments used by the continuous
; integration system: the `codecov-push` and `coveralls-push` 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 infrastructure, `codecov-publish`
; combines `coverage-prepare` and `codecov-push` into a single step.
;
[tox]
minversion=3.21.4
requires=
Expand Down Expand Up @@ -60,20 +51,10 @@ extras =

serial: serial

{withcov,coverage-prepare,codecov-publish}: dev
{withcov}: dev

;; dependencies that are not specified as extras
deps =
; We end up with a bit of deps duplication as we can't install
; coverage deps via `extras` as we run them with `skip_install`.
{coverage-prepare,codecov-publish}: coverage ~= 5.5

{codecov-push,codecov-publish}: codecov ~= 2.1

coveralls-push: coveralls
coveralls-push: PyYAML


lint: pre-commit

; All environment variables are passed.
Expand All @@ -90,9 +71,6 @@ setenv =
{windows,serial}: TWISTED_FORCE_SERIAL_TESTS = 1

skip_install =
coverage-prepare: True
codecov: True
coveralls: True
lint: True

commands =
Expand All @@ -111,16 +89,7 @@ commands =
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 --temp-directory={envtmpdir}/_trial_temp --reactor={env:TWISTED_REACTOR:default} --reporter={env:TRIAL_REPORTER:verbose} {env:TRIAL_ARGS:} {posargs:twisted}

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

; 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
withcov: coverage combine

lint: pre-commit {posargs:run --all-files --show-diff-on-failure}

Expand Down

0 comments on commit 5badeba

Please sign in to comment.