Custom coverage regexp is not working

Replace this template with your information

custom coverage regexp for OpenCppCoverage is not working:

  • i am using OpenCppCoverage for my project’s unit test. and i made a some script for extract coverage value from html report file. and add custom coverage regexp to gitlab-ci.yml
  coverage: '/Cover \d+(\.\d+)?%/' 

and actual output of pipeline was

$ $coverageReport = Get-Content ".\coverage_report\index.html"
$ $coverage = [regex]::Match($coverageReport, "Cover (\d+)%").Groups[0].Value
$ echo $coverage
Cover 100%

but gitlab doesn’t read this console output

how to make this work??

Interesting. I plugged in your RE & example job output into the rebular.com Ruby re editor. I’ve been using this to evaluate REs before commiting my .gitlab-ci.yml changes as it’s my understanding this tool uses the same Ruby RE library as does Gitlab. So far, any RE that passes this editor’s eval has worked in my .gitlab-ci.yml usage.

Any chance the coverage key is not in the intended job block? (my 14.6.1 & earlier usage had the coverage RE in the project’s UI settings (removed in 15+)? As it looks like it should work. My 15.6.3 install is using this coverage key and does scrape, display the last matched RE’s value as documented. I hope it starts working for you.