gpt4 book ai didi

reactjs - 如何为 Azure 私有(private)存储库设置代码覆盖率徽章?

转载 作者:行者123 更新时间:2023-12-02 06:18:52 24 4
gpt4 key购买 nike

我在 Azure 上有一个 ReactJS 项目,我正在使用 Cobertura 发布代码覆盖率。

我见过像badge.io这样的工具可以用来获取徽章,但它似乎只能为公共(public)存储库提供徽章。如何在此私有(private) Azure 托管存储库的 readme.md 中获取徽章?

azure-pipelines.yml:

- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'cobertura'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage/cobertura-coverage.xml'

最佳答案

如果您没有覆盖率报告文件,则需要添加任务 reportgenerator (如果未安装,请在您的组织中安装此任务)在发布代码覆盖结果任务之前。请检查下面的示例

- task: reportgenerator@4
displayName: ReportGenerator
inputs:
reports: '$(System.DefaultWorkingDirectory)\TestCoverage.xml'
targetdir: '$(Build.SourcesDirectory)\TestResults\Coverage\Reports'
sourcedirs: '$(Build.SourcesDirectory)'
verbosity: Verbose


- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'cobertura'
summaryFileLocation: '$(System.DefaultWorkingDirectory)\TestCoverage.xml'
pathToSources: '$(Build.SourcesDirectory)'
reportDirectory: '$(Build.SourcesDirectory)\TestResults\Coverage\Reports'

您希望徽章显示什么状态?

如果您想将构建状态徽章添加到存储库中的自述文件中。您可以查看here将状态徽章添加到您的存储库以了解构建状态。

enter image description here

更新:

因为 azure devops 测试结果中没有测试覆盖率徽章。您可以安装代码覆盖率扩展,例如。 code coverage protectorCode Coverage Widgets 。请按照下面的屏幕截图浏览市场并搜索代码覆盖率 enter image description here

当您从市场安装代码覆盖率扩展时。然后您可以Add a code coverage widgets to a dashboard .

您还可以submit a feature request (单击建议功能并选择 Azure Devops)向 Microsoft 开发团队提供测试覆盖率徽章。希望他们今后能够考虑并实现。

关于reactjs - 如何为 Azure 私有(private)存储库设置代码覆盖率徽章?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59631194/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com