使用GitHub操作收集代码覆盖率
我有一个Azure管道构建步骤,如下所示:使用GitHub操作收集代码覆盖率,github,github-actions,Github,Github Actions,我有一个Azure管道构建步骤,如下所示: - task: PublishCodeCoverageResults@1 displayName: 'collect code coverage' inputs: codeCoverageTool: 'cobertura' summaryFileLocation: $(Build.SourcesDirectory)\Coverage\coverage.cobertura.xml
- task: PublishCodeCoverageResults@1
displayName: 'collect code coverage'
inputs:
codeCoverageTool: 'cobertura'
summaryFileLocation: $(Build.SourcesDirectory)\Coverage\coverage.cobertura.xml
failIfCoverageEmpty: false
- task: mspremier.BuildQualityChecks.QualityChecks-task.BuildQualityChecks@6
displayName: 'check build quality'
inputs:
checkCoverage: true
coverageFailOption: fixed
coverageType: lines
coverageThreshold: 1
如何将这些转换为GitHub操作?您可以使用codecov之类的代码覆盖率仪表板来收集代码覆盖率。在Azure DevOps中,代码覆盖率视图位于Azure Pipelines视图中,但GitHub不提供这样的视图。CodeCov,工作服来帮忙。其他可以在中找到 示例用法如下所示:
- name: Test with pytest
run: |
pytest --instafail --cov=./src --cov-report xml --cov-branch tests/unittests
- name: Codecov
uses: codecov/codecov-action@v1.0.13
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
file: ./coverage.xml # optional
flags: unittests # optional
name: codecov # optional
fail_ci_if_error: false # optional (default = false)