lcov-to-cobertura-xml icon indicating copy to clipboard operation
lcov-to-cobertura-xml copied to clipboard

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

Open EAHITechnology opened this issue 2 years ago • 3 comments

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

EAHITechnology avatar Jul 05 '22 06:07 EAHITechnology

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.

egfx-notifications avatar Jul 05 '22 08:07 egfx-notifications

@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

betaboon avatar Jul 14 '22 17:07 betaboon

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

egfx-notifications avatar Jul 18 '22 08:07 egfx-notifications