Skip to content

Commit 34f30d8

Browse files
committed
move to coveralls from codecov
1 parent 701dab6 commit 34f30d8

File tree

10 files changed

+227
-170
lines changed

10 files changed

+227
-170
lines changed

.codecov.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
rtd:
2+
project: tox

.travis.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

README.rst

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@
77
.. image:: https://dev.azure.com/toxdev/tox/_apis/build/status/tox%20ci?branchName=master
88
:target: https://dev.azure.com/toxdev/tox/_build/latest?definitionId=9&branchName=master
99
:alt: Azure Pipelines build status
10-
.. image:: https://travis-ci.org/tox-dev/tox.svg?branch=master
11-
:target: https://travis-ci.org/tox-dev/tox
12-
:alt: Travis-CI build status
13-
.. image:: https://codecov.io/gh/tox-dev/tox/branch/master/graph/badge.svg
14-
:target: https://codecov.io/gh/tox-dev/tox
15-
:alt: Code coverage Status
16-
.. image:: https://readthedocs.org/projects/tox/badge/?version=latest
10+
.. image:: https://api.codeclimate.com/v1/badges/425c19ab2169a35e1c16/test_coverage
11+
:target: https://codeclimate.com/github/tox-dev/tox/test_coverage
12+
:alt: Test Coverage
13+
.. image:: https://readthedocs.org/projects/tox/badge/?version=latest&style=flat-square
1714
:target: https://tox.readthedocs.io/en/latest/?badge=latest
1815
:alt: Documentation status
1916
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg

azure-pipelines.yml

Lines changed: 132 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ name: $(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.rr)
22

33
variables:
44
"System.PreferGit": true
5+
CI_NAME: Azure Pipelines
6+
CI_BUILD_ID: $(Build.BuildId)
7+
CI_BUILD_URL: "https://toxdev.visualstudio.com/tox/_build/results?buildId=$(Build.BuildId)"
8+
GIT_BRANCH: $(Build.SourceBranch)
9+
GIT_COMMIT_SHA: $(Build.SourceVersion)
10+
PYTEST_ADDOPTS: "-vra --showlocals"
511

612
trigger:
713
batch: true
@@ -23,63 +29,155 @@ trigger:
2329
- tasks/*
2430

2531
jobs:
32+
- job: notify_build_start
33+
pool: {vmImage: 'Ubuntu 16.04'}
34+
steps:
35+
- script: |
36+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter && \
37+
chmod +x ./cc-test-reporter && \
38+
./cc-test-reporter before-build
39+
displayName: notify code climate of new build
40+
2641
- template: azure-run-tox-env.yml
27-
parameters: {name: check_code_style, tox: "fix-lint", python: '3.7', image: 'Ubuntu 16.04'}
42+
parameters: {tox: fix_lint, python: 3.7}
43+
- template: azure-run-tox-env.yml
44+
parameters: {tox: docs, python: 3.7}
45+
- template: azure-run-tox-env.yml
46+
parameters: {tox: package_description, python: 3.7}
47+
2848
- template: azure-run-tox-env.yml
29-
parameters: {name: generate_docs, tox: docs, python: '3.7', image: 'Ubuntu 16.04'}
49+
parameters: {tox: pypy, python: pypy, os: linux}
3050
- template: azure-run-tox-env.yml
31-
parameters: {name: check_package_long_description, tox: "package-description", python: '3.7', image: 'Ubuntu 16.04'}
51+
parameters: {tox: pypy3, python: pypy3, os: linux}
3252

3353
- template: azure-run-tox-env.yml
34-
parameters: {name: windows_37, python: '3.7', image: 'vs2017-win2016'}
54+
parameters: {tox: py37, python: 3.7, os: windows}
3555
- template: azure-run-tox-env.yml
36-
parameters: {name: windows_36, python: '3.6', image: 'vs2017-win2016'}
56+
parameters: {tox: py36, python: 3.6, os: windows}
3757
- template: azure-run-tox-env.yml
38-
parameters: {name: windows_35, python: '3.5', image: 'vs2017-win2016'}
58+
parameters: {tox: py35, python: 3.5, os: windows}
3959
- template: azure-run-tox-env.yml
40-
parameters: {name: windows_34, python: '3.4', image: 'vs2017-win2016'}
60+
parameters: {tox: py34, python: 3.4, os: windows}
4161
- template: azure-run-tox-env.yml
42-
parameters: {name: windows_27, python: '2.7', image: 'vs2017-win2016'}
62+
parameters: {tox: py27, python: 2.7, os: windows}
4363

4464
- template: azure-run-tox-env.yml
45-
parameters: {name: linux_37, python: '3.7', image: 'Ubuntu 16.04'}
65+
parameters: {tox: py37, python: 3.7, os: linux}
4666
- template: azure-run-tox-env.yml
47-
parameters: {name: linux_36, python: '3.6', image: 'Ubuntu 16.04'}
67+
parameters: {tox: py36, python: 3.6, os: linux}
4868
- template: azure-run-tox-env.yml
49-
parameters: {name: linux_35, python: '3.5', image: 'Ubuntu 16.04'}
69+
parameters: {tox: py35, python: 3.5, os: linux}
5070
- template: azure-run-tox-env.yml
51-
parameters: {name: linux_34, python: '3.4', image: 'Ubuntu 16.04'}
71+
parameters: {tox: py34, python: 3.4, os: linux}
5272
- template: azure-run-tox-env.yml
53-
parameters: {name: linux_27, python: '2.7', image: 'Ubuntu 16.04'}
73+
parameters: {tox: py27, python: 2.7, os: linux}
5474

5575
- template: azure-run-tox-env.yml
56-
parameters: {name: macOS_36, python: '3.6', image: 'macOS 10.13'}
76+
parameters: {tox: py36, python: 3.6, os: macOs}
5777

58-
- job: tests_done
78+
- job: report_coverage
5979
pool: {vmImage: 'Ubuntu 16.04'}
60-
condition: always()
80+
condition: and( always(), eq(variables['system.pullrequest.isfork'], false) )
6181
dependsOn:
62-
- windows_37
63-
- windows_36
64-
- windows_35
65-
- windows_34
66-
- windows_27
67-
- linux_37
68-
- linux_36
69-
- linux_35
70-
- linux_34
71-
- linux_27
72-
- macOS_36
82+
- windows_py37
83+
- windows_py36
84+
- windows_py35
85+
- windows_py34
86+
- windows_py27
87+
- linux_py37
88+
- linux_py36
89+
- linux_py35
90+
- linux_py34
91+
- linux_py27
92+
- linux_pypy3
93+
- linux_pypy
94+
- macOS_py36
7395
steps:
74-
- script: echo "done"
75-
displayName: running tests done
96+
- task: DownloadBuildArtifacts@0
97+
displayName: download coverage files for run
98+
inputs:
99+
buildType: current
100+
downloadType: specific
101+
itemPattern: coverage-*/*
102+
downloadPath: $(Build.StagingDirectory)
103+
104+
- task: UsePythonVersion@0
105+
displayName: setup python
106+
inputs:
107+
versionSpec: 3.7
108+
109+
- script: |
110+
python -c '
111+
from pathlib import Path
112+
import shutil
113+
114+
from_folder = Path("$(Build.StagingDirectory)")
115+
destination_folder = Path("$(System.DefaultWorkingDirectory)") / ".tox"
116+
destination_folder.mkdir()
117+
for coverage_file in from_folder.glob("*/.coverage"):
118+
destination = destination_folder / f".coverage.{coverage_file.parent.name[9:]}"
119+
print(f"{coverage_file} copy to {destination}")
120+
shutil.copy(str(coverage_file), str(destination))'
121+
displayName: move coverage files into .tox
122+
123+
- script: 'python -m pip install -U tox --pre'
124+
displayName: install tox
125+
126+
- script: 'python -m tox -e py --sdistonly'
127+
displayName: generate version.py
128+
129+
- script: 'python -m tox -e coverage'
130+
displayName: create coverag report via tox
131+
132+
- task: PublishCodeCoverageResults@1
133+
displayName: publish overall coverage report to Azure
134+
inputs:
135+
codeCoverageTool: 'cobertura'
136+
summaryFileLocation: '$(System.DefaultWorkingDirectory)/.tox/coverage.xml'
137+
reportDirectory: '$(System.DefaultWorkingDirectory)/.tox/htmlcov'
138+
failIfCoverageEmpty: true
139+
140+
- script: |
141+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter && \
142+
chmod +x ./cc-test-reporter
143+
displayName: get code climate binary
144+
145+
- script: |
146+
python -c '
147+
from xml.etree import ElementTree as et
148+
from pathlib import Path
149+
import subprocess
150+
151+
from_folder = Path("$(Build.StagingDirectory)")
152+
for counter, coverage_file in enumerate(from_folder.glob("*/coverage.xml")):
153+
key = coverage_file.parent.name[9:]
154+
print(f"{counter}){coverage_file}")
155+
156+
# first we need to fix the root file
157+
tree = et.parse(str(coverage_file))
158+
tree.getroot().find('sources/source').text = "$(System.DefaultWorkingDirectory)"
159+
tree.write(str(coverage_file))
160+
161+
cmd = ["$(System.DefaultWorkingDirectory)/cc-test-reporter", "format-coverage",
162+
str(coverage_file), "-t", "coverage.py", -o
163+
f"$(Build.StagingDirectory)/code-climate.{key}.json"]
164+
print(f"\t{cmd}")
165+
subprocess.check_call(cmd)'
166+
displayName: format coverage.xml-s for code climate
167+
168+
- script: |
169+
./cc-test-reporter sum-coverage --output - \
170+
--parts 13 \
171+
$(Build.StagingDirectory)/code-climate.*.json | \
172+
./cc-test-reporter upload-coverage --input -
173+
displayName: publish code climate
76174
77175
- job: publish
78176
dependsOn:
79-
- tests_done
80-
- check_code_style
81-
- generate_docs
82-
- check_package_long_description
177+
- report_coverage
178+
- linux_fix_lint
179+
- linux_docs
180+
- linux_package_description
83181
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
84182
pool: {vmImage: 'Ubuntu 16.04'}
85183
steps:
@@ -90,5 +188,5 @@ jobs:
90188
displayName: Package and publish to PyPI
91189
inputs:
92190
pypiConnection: pypi-conn
93-
packageDirectory: '$(System.DefaultWorkingDirectory)'
191+
packageDirectory: $(System.DefaultWorkingDirectory)
94192
alsoPublishWheel: true

0 commit comments

Comments
 (0)