Skip to content

Commit

Permalink
move to coveralls from codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat committed Oct 3, 2018
1 parent b367a52 commit 8c1a29f
Show file tree
Hide file tree
Showing 10 changed files with 254 additions and 185 deletions.
20 changes: 20 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
engines:
duplication:
enabled: true
config:
languages:
python:
python_version: 3
pep8:
enabled: true
radon:
enabled: true
sonar-python:
enabled: true
config:
tests_patterns:
- tests/**

ratings:
paths:
- "**.py"
37 changes: 0 additions & 37 deletions .codecov.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .travis.yml

This file was deleted.

11 changes: 4 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
.. image:: https://dev.azure.com/toxdev/tox/_apis/build/status/tox%20ci?branchName=master
:target: https://dev.azure.com/toxdev/tox/_build/latest?definitionId=9&branchName=master
:alt: Azure Pipelines build status
.. image:: https://travis-ci.org/tox-dev/tox.svg?branch=master
:target: https://travis-ci.org/tox-dev/tox
:alt: Travis-CI build status
.. image:: https://codecov.io/gh/tox-dev/tox/branch/master/graph/badge.svg
:target: https://codecov.io/gh/tox-dev/tox
:alt: Code coverage Status
.. image:: https://readthedocs.org/projects/tox/badge/?version=latest
.. image:: https://api.codeclimate.com/v1/badges/425c19ab2169a35e1c16/test_coverage
:target: https://codeclimate.com/github/tox-dev/tox/test_coverage
:alt: Test Coverage
.. image:: https://readthedocs.org/projects/tox/badge/?version=latest&style=flat-square
:target: https://tox.readthedocs.io/en/latest/?badge=latest
:alt: Documentation status
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
Expand Down
165 changes: 131 additions & 34 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: $(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.rr)

variables:
"System.PreferGit": true
CI_NAME: Azure Pipelines
CI_BUILD_ID: $(Build.BuildId)
CI_BUILD_URL: "https://toxdev.visualstudio.com/tox/_build/results?buildId=$(Build.BuildId)"
GIT_BRANCH: $(Build.SourceBranch)
GIT_COMMIT_SHA: $(Build.SourceVersion)

trigger:
batch: true
Expand All @@ -23,63 +28,155 @@ trigger:
- tasks/*

jobs:
- job: notify_build_start
pool: {vmImage: 'Ubuntu 16.04'}
steps:
- script: echo start
- script: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter && \
chmod +x ./cc-test-reporter && \
./cc-test-reporter before-build
displayName: notify code climate of new build
condition: eq(variables['system.pullrequest.isfork'], false)
- template: azure-run-tox-env.yml
parameters: {tox: fix_lint, python: 3.7}
- template: azure-run-tox-env.yml
parameters: {tox: docs, python: 3.7}
- template: azure-run-tox-env.yml
parameters: {name: check_code_style, tox: "fix-lint", python: '3.7', image: 'Ubuntu 16.04'}
parameters: {tox: package_description, python: 3.7}

- template: azure-run-tox-env.yml
parameters: {name: generate_docs, tox: docs, python: '3.7', image: 'Ubuntu 16.04'}
parameters: {tox: pypy, python: pypy, os: linux}
- template: azure-run-tox-env.yml
parameters: {name: check_package_long_description, tox: "package-description", python: '3.7', image: 'Ubuntu 16.04'}
parameters: {tox: pypy3, python: pypy3, os: linux}

- template: azure-run-tox-env.yml
parameters: {name: windows_37, python: '3.7', image: 'vs2017-win2016'}
parameters: {tox: py37, python: 3.7, os: windows}
- template: azure-run-tox-env.yml
parameters: {name: windows_36, python: '3.6', image: 'vs2017-win2016'}
parameters: {tox: py36, python: 3.6, os: windows}
- template: azure-run-tox-env.yml
parameters: {name: windows_35, python: '3.5', image: 'vs2017-win2016'}
parameters: {tox: py35, python: 3.5, os: windows}
- template: azure-run-tox-env.yml
parameters: {name: windows_34, python: '3.4', image: 'vs2017-win2016'}
parameters: {tox: py34, python: 3.4, os: windows}
- template: azure-run-tox-env.yml
parameters: {name: windows_27, python: '2.7', image: 'vs2017-win2016'}
parameters: {tox: py27, python: 2.7, os: windows}

- template: azure-run-tox-env.yml
parameters: {name: linux_37, python: '3.7', image: 'Ubuntu 16.04'}
parameters: {tox: py37, python: 3.7, os: linux}
- template: azure-run-tox-env.yml
parameters: {name: linux_36, python: '3.6', image: 'Ubuntu 16.04'}
parameters: {tox: py36, python: 3.6, os: linux}
- template: azure-run-tox-env.yml
parameters: {name: linux_35, python: '3.5', image: 'Ubuntu 16.04'}
parameters: {tox: py35, python: 3.5, os: linux}
- template: azure-run-tox-env.yml
parameters: {name: linux_34, python: '3.4', image: 'Ubuntu 16.04'}
parameters: {tox: py34, python: 3.4, os: linux}
- template: azure-run-tox-env.yml
parameters: {name: linux_27, python: '2.7', image: 'Ubuntu 16.04'}
parameters: {tox: py27, python: 2.7, os: linux}

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

- job: tests_done
- job: report_coverage
pool: {vmImage: 'Ubuntu 16.04'}
condition: always()
condition: eq(variables['system.pullrequest.isfork'], false)
dependsOn:
- windows_37
- windows_36
- windows_35
- windows_34
- windows_27
- linux_37
- linux_36
- linux_35
- linux_34
- linux_27
- macOS_36
- windows_py37
- windows_py36
- windows_py35
- windows_py34
- windows_py27
- linux_py37
- linux_py36
- linux_py35
- linux_py34
- linux_py27
- linux_pypy3
- linux_pypy
- macOS_py36
steps:
- script: echo "done"
displayName: running tests done
- task: DownloadBuildArtifacts@0
displayName: download coverage files for run
inputs:
buildType: current
downloadType: specific
itemPattern: coverage-*/*
downloadPath: $(Build.StagingDirectory)

- task: UsePythonVersion@0
displayName: setup python
inputs:
versionSpec: 3.7

- script: |
python -c '
from pathlib import Path
import shutil
from_folder = Path("$(Build.StagingDirectory)")
destination_folder = Path("$(System.DefaultWorkingDirectory)") / ".tox"
destination_folder.mkdir()
for coverage_file in from_folder.glob("*/.coverage"):
destination = destination_folder / f".coverage.{coverage_file.parent.name[9:]}"
print(f"{coverage_file} copy to {destination}")
shutil.copy(str(coverage_file), str(destination))'
displayName: move coverage files into .tox
- script: 'python -m pip install -U tox --pre'
displayName: install tox

- script: 'python -m tox -e py --sdistonly'
displayName: generate version.py

- script: 'python -m tox -e coverage'
displayName: create coverag report via tox

- task: PublishCodeCoverageResults@1
displayName: publish overall coverage report to Azure
inputs:
codeCoverageTool: 'cobertura'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/.tox/coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/.tox/htmlcov'
failIfCoverageEmpty: true

- script: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter && \
chmod +x ./cc-test-reporter && \
python -c '
from xml.etree import ElementTree as et
from pathlib import Path
import subprocess
from_folder = Path("$(Build.StagingDirectory)")
for counter, coverage_file in enumerate(from_folder.glob("*/coverage.xml")):
key = coverage_file.parent.name[9:]
print(f"{counter}){coverage_file}")
try:
# first we need to fix the root file
tree = et.parse(str(coverage_file))
tree.getroot().find('sources/source').text = "$(System.DefaultWorkingDirectory)"
tree.write(str(coverage_file))
cmd = ["$(System.DefaultWorkingDirectory)/cc-test-reporter", "format-coverage",
str(coverage_file),
"-t", "coverage.py",
"-o", f"$(Build.StagingDirectory)/code-climate.{key}.json"]
print(f"\t{cmd}")
subprocess.check_call(cmd)
except Exception as exception:
print(f"FAIL {exception}")' && \
./cc-test-reporter sum-coverage --output - \
--parts $(ls -1 $(Build.StagingDirectory)/code-climate.*.json | wc -l) \
$(Build.StagingDirectory)/code-climate.*.json | \
./cc-test-reporter upload-coverage --input -
displayName: publish code climate
condition: succeededOrFailed()
- job: publish
dependsOn:
- tests_done
- check_code_style
- generate_docs
- check_package_long_description
- report_coverage
- linux_fix_lint
- linux_docs
- linux_package_description
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
pool: {vmImage: 'Ubuntu 16.04'}
steps:
Expand All @@ -90,5 +187,5 @@ jobs:
displayName: Package and publish to PyPI
inputs:
pypiConnection: pypi-conn
packageDirectory: '$(System.DefaultWorkingDirectory)'
packageDirectory: $(System.DefaultWorkingDirectory)
alsoPublishWheel: true
Loading

0 comments on commit 8c1a29f

Please sign in to comment.