#2084: applying github example fix to pipeline

This commit is contained in:
Czar Echavez
2023-12-02 01:05:13 +00:00
parent af8401440d
commit 31c4287f46

View File

@@ -97,6 +97,12 @@ stages:
primaite setup
displayName: 'Perform PrimAITE Setup'
- task: UseDotNet@2
displayName: 'Install dotnet dependencies'
inputs:
packageType: 'sdk'
version: '2.1.x'
- script: |
pytest -v tests/ --cov=src/ -o junit_family=xunit2 --junitxml=junit/test-results.xml --cov-report xml:$(System.DefaultWorkingDirectory)/coverage.xml --cov-report html:$(System.DefaultWorkingDirectory)/htmlcov --cov-report term
displayName: 'Run tests and code coverage'
@@ -111,9 +117,25 @@ stages:
- publish: $(System.DefaultWorkingDirectory)/htmlcov/
artifact: coverage_report
# - task: PublishCodeCoverageResults@2
# displayName: 'Publish coverage report'
# inputs:
# codeCoverageTool: Cobertura
# summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage.xml'
# failIfCoverageEmpty: true
- task: PublishCodeCoverageResults@2
displayName: 'Publish coverage report'
displayName: 'Install code coverage upload dependencies'
# We only want the dependencies - this azure task is borked https://github.com/microsoft/azure-pipelines-tasks/issues/17756
# ref: https://github.com/microsoft/azure-pipelines-tasks/issues/17756#issuecomment-1585620675
condition: eq('true', 'false') # THIS WILL NEVER RUN ONCE TASK DECLARATION IS NEEDED TO DOWNLOAD IT SOURCES
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage.xml'
failIfCoverageEmpty: true
- task: CmdLine@2
displayName: Publish Code Coverage
env: { 'SYSTEM_ACCESSTOKEN': $(System.AccessToken) } #access token is needed to upload report to azure pipeline tabs
inputs:
script: |
mkdir /home/vsts/work/_temp/cobertura
"$(Dotnet_Root)/dotnet"dotnet `find /home/vsts/work/_tasks/ -name CoveragePublisher.Console.dll` '$(System.DefaultWorkingDirectory)/coverage.xml' --reportDirectory /home/vsts/work/_temp/cobertura