It seems you forgot to add the calls to cat in your .gitlab-ci.yml file.
You should have something like that:
script:
- mvn $MAVEN_CLI_OPTS test
- cat target/site/jacoco/index.html
That being said, I don't think this is the best way of doing this, as you need to pollute your output with raw HTML in order to retreive the desired coverage value.
I would recommend using the method described in this pull request instead: https://github.com/jacoco/jacoco/pull/488
- Keep the jacoco parts in your
build.xml Use this awk instruction to print the correct code coverage total:
awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions, "% covered" }' target/site/jacoco/jacoco.csvReplace the Gitlab CI regexp with what the instruction returns:
\d+.\d+ \% covered
Edit:
As of Gitlab 8.17, you can define the regexp directly inside the .gitlab-ci.yml file, as stated in the documentation.
It may seem superfluous, but if this regexp is now part of your repository history, you can change it alongside the other tools used to compute it.
Answer from SKBo on Stack OverflowIt seems you forgot to add the calls to cat in your .gitlab-ci.yml file.
You should have something like that:
script:
- mvn $MAVEN_CLI_OPTS test
- cat target/site/jacoco/index.html
That being said, I don't think this is the best way of doing this, as you need to pollute your output with raw HTML in order to retreive the desired coverage value.
I would recommend using the method described in this pull request instead: https://github.com/jacoco/jacoco/pull/488
- Keep the jacoco parts in your
build.xml Use this awk instruction to print the correct code coverage total:
awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions, "% covered" }' target/site/jacoco/jacoco.csvReplace the Gitlab CI regexp with what the instruction returns:
\d+.\d+ \% covered
Edit:
As of Gitlab 8.17, you can define the regexp directly inside the .gitlab-ci.yml file, as stated in the documentation.
It may seem superfluous, but if this regexp is now part of your repository history, you can change it alongside the other tools used to compute it.
GitLab employee here.
If your administrator has GitLab pages set up, you can see the URL that your artifact deployed to by going (on your project) to Settings -> Pages.
There you should see:
Congratulations! Your pages are served under: https://your-namespace.example.com/your-project
Click on that link and you should be good to go! Also we are expanding support for HTML artifacts. This issue and it’s related issues talk about existing and upcoming features that may expand on what you’ve built here.