mu_pip_build/azure-pipelines-pr-gate.yml

73 строки
2.1 KiB
YAML

workspace:
clean: all
steps:
- checkout: self
clean: true
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7.x'
architecture: 'x64'
- script: python -m pip install --upgrade pip
displayName: 'Install/Upgrade pip'
- script: pip uninstall -y mu_build
displayName: 'Remove existing version of self'
- script: pip install --upgrade -r requirements.txt
displayName: 'Install requirements'
- script: pip install -e .
displayName: 'Install from Source'
- script: pytest -v --junitxml=test.junit.xml --html=pytest_MuBuild_report.html --self-contained-html --cov=MuBuild --cov-report html:cov_html --cov-report xml:cov.xml --cov-config .coveragerc
displayName: 'Run UnitTests'
# Publish Test Results to Azure Pipelines/TFS
- task: PublishTestResults@2
displayName: 'Publish junit test results'
continueOnError: true
condition: succeededOrFailed()
inputs:
testResultsFormat: 'JUnit' # Options: JUnit, NUnit, VSTest, xUnit
testResultsFiles: 'test.junit.xml'
mergeTestResults: true # Optional
publishRunAttachments: true # Optional
# Publish Build Artifacts
# Publish build artifacts to Azure Pipelines/TFS or a file share
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: 'pytest_MuBuild_report.html'
artifactName: 'MuBuild unit test report'
continueOnError: true
condition: succeededOrFailed()
# Publish Code Coverage Results
# Publish Cobertura code coverage results
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'cobertura' # Options: cobertura, jaCoCo
summaryFileLocation: $(System.DefaultWorkingDirectory)/cov.xml
reportDirectory: $(System.DefaultWorkingDirectory)/cov_html
condition: succeededOrFailed()
- script: flake8 .
displayName: 'Run flake8'
condition: succeededOrFailed()
# Only capture and archive the lint log on failures.
- script: flake8 . > flake8.err.log
displayName: 'Capture flake8 failures'
condition: Failed()
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: 'flake8.err.log'
artifactName: 'Flake8 Error log file'
continueOnError: true
condition: Failed()