Gitlab CI Test Regular Expression

I struggled to find a regular expression that would work in the "Testing Test Coverage" section of the "CI / CD Pipelines" page. This does not help the examples to show inconsistent examples, that is, some escape brackets and others do not match percent signs, some capture an explicit result in $1, etc. Anyway, here is my text - what is a regular expression?

CI Icon:

![coverage](https://gitlab.com/mycompany/master/badges/master/coverage.svg?job=coverage)

Output Text:

Unit test coverage:
   10.01% blocks
   10.01% lines

Tried so far: (slashes added just to represent space in front or regular expression)

/ \(\d+\.\d+\%\) blocks/
/ (\d+\.\d+\%) blocks/
/ (\d+\.\d+%) blocks/
/ (\d+\.\d+)% blocks/
+4
source share
3 answers

:

^\s*(\d+(?:\.\d+)?%)\s*blocks

, :

^\s*(\d+(?:\.\d+)?%)\s*lines

GitLab /, .

GitLab Ruby, Ruby rubular.com

+1

URL- "? job = coverage". , :

\W(\d+(?:\.\d+)%)\sblocks
0

Source: https://habr.com/ru/post/1669216/


All Articles