Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add option to report total coverage to stderr #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MisterMX
Copy link

This adds an optional flag -report-total-coverage-to-stderr that tells the converter to write the total coverage percentage to stderr.

This is usefull when working with CIs that rely on the logs to retrieve the total coverage for reporting, such as Gitlab CI.

In Gitlab CI this can be used in the following way:

go-test-report-coverage:
  scripts:
    - gocover-cobertura -report-total-coverage-to-stderr < go-test-coverage.txt > go-test-report-coverage.xml
  # Tell Gitlab to extract the coverage from the logs:
  coverage: '/^Total test coverage is (\d+.\d+%) of lines$/'
  # Regular coverage export for reporting (in addition to the total number above)
  artifacts:
    expire_in: 1 week
    reports:
      coverage_report:
        coverage_format: cobertura
        path: go-test-report-coverage.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant