I need to see code coverage report for a java maven project in Gitlab. According to this, this and some other sources:
- I added
jacoco
to the list of plugins inpom.xml
. - Added pages job to my
.gitlab-ci.yml
file. - Added
Total.*?([0-9]{1,3})%
to code coverage parsing in project setting.
but there isn't any coverage report or at least I can't see it. There is no coverage percentage or coverage report page.
Content of .gitlab-ci.yml
file:
image: maven:latest
variables:
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
cache:
paths:
- .m2/repository/
build:
stage: build
script:
- mvn $MAVEN_CLI_OPTS compile
test:
stage: test
script:
- mvn $MAVEN_CLI_OPTS test
artifacts:
paths:
- target/site/jacoco/
pages:
stage: deploy
dependencies:
- test
script:
- mkdir public
- mv target/site/jacoco/index.html public
artifacts:
paths:
- public
deploy:
stage: deploy
script:
- mvn $MAVEN_CLI_OPTS verify
only:
- master
jacoco
plugin in pom.xml
:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.5.201505241946</version>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
My Project is a private project on gitlab.com
.
Pipeline and its all 4 jobs passed successfully.
How can I see the coverage reports?