2020-10-04 00:03:28 +00:00
|
|
|
steps:
|
|
|
|
- task: UsePythonVersion@0
|
|
|
|
inputs:
|
|
|
|
versionSpec: '$(python.version)'
|
|
|
|
|
|
|
|
- script: python -m pip install -r requirements-dev.txt
|
|
|
|
displayName: 'Install dev tools'
|
|
|
|
|
|
|
|
- script: |
|
2020-10-05 04:27:07 +00:00
|
|
|
# Azure pipelines: https://github.com/microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md
|
|
|
|
# GitHub actions: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions
|
|
|
|
|
|
|
|
rm -f flake8.output
|
|
|
|
flake8 . --statistics --output-file=flake8.output && {
|
|
|
|
echo "##vso[task.complete result=Succeeded;]"
|
|
|
|
} || {
|
|
|
|
echo "##vso[task.complete result=Failed;]"
|
|
|
|
}
|
|
|
|
|
|
|
|
cat flake8.output | awk -F: '{
|
|
|
|
if ($0 ~ /^\./) {
|
|
|
|
gsub(/^[ \t]+/,"",$4);
|
|
|
|
codesep=index($4, " ");
|
|
|
|
code=substr($4, 1, codesep-1);
|
|
|
|
msg=substr($4, codesep+1);
|
|
|
|
print "##vso[task.logissue type=error;sourcepath=" $1 ";linenumber=" $2 ";columnnumber=" $3 ";code=" code ";]" msg;
|
|
|
|
} else {
|
|
|
|
print $0
|
|
|
|
}
|
|
|
|
}'
|
2020-10-04 00:03:28 +00:00
|
|
|
displayName: 'Run Linter'
|
|
|
|
failOnStderr: false
|
|
|
|
|
|
|
|
- script: |
|
2020-10-05 04:27:07 +00:00
|
|
|
rm -f test.xml coverage.xml
|
|
|
|
coverage run && {
|
|
|
|
echo "##vso[task.complete result=Succeeded;]"
|
|
|
|
} || {
|
|
|
|
echo "##vso[task.complete result=Failed;]"
|
|
|
|
}
|
|
|
|
coverage xml
|
|
|
|
coverage html
|
|
|
|
coverage report
|
2020-10-04 00:03:28 +00:00
|
|
|
displayName: 'Run Tests'
|
|
|
|
failOnStderr: false
|
2020-10-05 04:27:07 +00:00
|
|
|
condition: succeededOrFailed()
|
2020-10-04 00:03:28 +00:00
|
|
|
|
|
|
|
- task: PublishTestResults@2
|
|
|
|
condition: succeededOrFailed()
|
|
|
|
inputs:
|
2020-10-05 04:27:07 +00:00
|
|
|
testResultsFiles: 'test.xml'
|
2020-10-04 00:03:28 +00:00
|
|
|
testRunTitle: 'Publish test results for Python $(python.version)'
|
2020-10-05 04:27:07 +00:00
|
|
|
|
|
|
|
- task: PublishCodeCoverageResults@1
|
|
|
|
condition: succeededOrFailed()
|
|
|
|
inputs:
|
|
|
|
codeCoverageTool: 'cobertura'
|
|
|
|
summaryFileLocation: 'coverage.xml'
|