Skip to content

Commit

Permalink
VSTS build improvements (#960)
Browse files Browse the repository at this point in the history
* Enable code coverage reports and fix test environment names

* Fix coverage option

* Skip codecov upload when no token is available.
  • Loading branch information
zooba authored and gaborbernat committed Sep 4, 2018
1 parent e35a225 commit 9335906
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
15 changes: 12 additions & 3 deletions .vsts-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ jobs:
inputs:
testResultsFiles: '.tox/test-results.*.xml'
mergeTestResults: true
testRunTitle: '$(toxenv)'
testRunTitle: '$(agent.os) py$(python.version)'
platform: linux
condition: succeededOrFailed()

- script: 'python -m tox -e coverage'
displayName: generate coverage.xml
Expand All @@ -98,10 +99,12 @@ jobs:
inputs:
codeCoverageTool: 'cobertura'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/.tox/coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/.tox/htmlcov'
failIfCoverageEmpty: true

- script: 'python -m tox -e codecov -- -t $(CODECOV_TOKEN) --required -n "$(agent.os)-$(python.version)" --build "$(Build.DefinitionName)" --env OS=$(agent.os) python=$(python.version)'
displayName: upload codecov
condition: and(succeeded(), variables['CODECOV_TOKEN'])

- job: windows
pool:
Expand Down Expand Up @@ -140,8 +143,9 @@ jobs:
inputs:
testResultsFiles: '.tox/test-results.*.xml'
mergeTestResults: true
testRunTitle: '$(toxenv)'
testRunTitle: '$(agent.os) py$(python.version)'
platform: windows
condition: succeededOrFailed()

- script: 'python -m tox -e coverage'
displayName: generate coverage.xml
Expand All @@ -150,10 +154,12 @@ jobs:
inputs:
codeCoverageTool: 'cobertura'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/.tox/coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/.tox/htmlcov'
failIfCoverageEmpty: true

- script: 'python -m tox -e codecov -- -t $(CODECOV_TOKEN) --required -n "$(agent.os)-$(python.version)" --build "$(Build.DefinitionName)" --env OS=$(agent.os) python=$(python.version)'
displayName: upload codecov
condition: and(succeeded(), variables['CODECOV_TOKEN'])

- job: macOS
pool:
Expand All @@ -180,7 +186,8 @@ jobs:
testResultsFiles: '.tox/test-results.*.xml'
mergeTestResults: true
testRunTitle: '$(toxenv)'
platform: windows
platform: macos
condition: succeededOrFailed()

- script: 'python3 -m tox -e coverage'
displayName: generate coverage.xml
Expand All @@ -189,10 +196,12 @@ jobs:
inputs:
codeCoverageTool: 'cobertura'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/.tox/coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/.tox/htmlcov'
failIfCoverageEmpty: true

- script: 'python3 -m tox -e codecov -- -t $(CODECOV_TOKEN) --required -n "$(agent.os)-python3" --build "$(Build.DefinitionName)" --env OS=$(agent.os) python=3'
displayName: upload codecov
condition: and(succeeded(), variables['CODECOV_TOKEN'])

- job: publish
dependsOn:
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ commands = coverage erase
coverage combine
coverage report -m
coverage xml -o {toxworkdir}/coverage.xml
coverage html -d {toxworkdir}/htmlcov
diff-cover --compare-branch {env:DIFF_AGAINST:origin/master} {toxworkdir}/coverage.xml

[testenv:codecov]
Expand Down

0 comments on commit 9335906

Please sign in to comment.