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

gitlab-ci can't read .xml file, which is conversion by lcov-to-cobertura-xml #43

Open
EAHITechnology opened this issue Jul 5, 2022 · 3 comments

Comments

@EAHITechnology
Copy link

I have a .lcov file generated by llvm-cov.

/usr/lib/llvm-8/bin/llvm-cov export -format=lcov -Xdemangler c++filt -Xdemangler -n -instr-profile=xxx.profdata -object=build/bin/xxx > worker_ut.lcov

python3 /usr/local/lib/python3.9/dist-packages/lcov_cobertura/lcov_cobertura.py xxxx.lcov

When i use it in gitlab-ci:

coverage: /^\s*lines:\s*\d+.\d+\%/
  artifacts:
    expire_in: 1 days
    reports:
      cobertura: xxx.xml
      junit: xxxx.xml

But it doesn't work, Test is always 0

@egfx-notifications
Copy link

Are you sure that is the right CI configuration for your GitLab version? A while ago they changed that from what you have to this: https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html#artifactsreportscoverage_report

The coverage with regex feature is completely removed in current versions.

@betaboon
Copy link
Contributor

@egfx-notifications the regex feature is still there: https://docs.gitlab.com/ee/ci/yaml/#coverage (I'm using it in gitlab-cloud as we speak)

@EAHITechnology this is the gitlab-ci-config (snippet) that i currently use which works:

test:
  script:
    - myscript
  coverage: '/Code coverage: \d+\.\d+/'
  artifacts:
    reports:
      coverage_report:
        coverage_format: cobertura
        path: .reports/coverage.xml

@egfx-notifications
Copy link

Please forgive my faulty memory, the coverage regex in the CI configuration is indeed the replacement for the removed coverage regex in project settings. Somehow got that mixed up. Thank you for correcting me @betaboon

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

No branches or pull requests

3 participants