Coverage badge unknown

Hi all.
I have a Ruby repository on github, and I have set up the code coverage with Simplecov. I seem to be unable to show the coverage percentage on a badge though.

I followed this tutorial here:

So I have this set into my .gitlab-ci.yml

rspec:
  stage: test
  script:
    - rspec
  artifacts:
    paths:
      - coverage/

pages:
  stage: deploy
  dependencies:
    - rspec
  script:
    - mv coverage/ public/
  artifacts:
    paths:
      - public
    expire_in: 30 days
  only:
    - master

which correctly saves my artifact, I found they are now stored in
http://mariodarco.gitlab.io/selfies/#_AllFiles

Yet. the badge is always grey.

I assume there is something wrong in the path of my artifacts but I’m not sure what that is.

I’m still struggling with it, does anyone know a solution please?

Hi @marioD78,

are you talking about GitHub or GitLab? Assuming GitLab, note that coverage is capture in GitLab by specifying a regular expression that will be matched against the output of your script part. Nothing more, nothing less.

See: https://docs.gitlab.com/ee/user/project/pipelines/settings.html#test-coverage-parsing and https://docs.gitlab.com/ee/user/project/pipelines/settings.html#test-coverage-report-badge

So if coveralls somehow reports you back something in your script, you should try to make the coverage percentage number to be written in output, so that you can then have the above-mentioned regular expression to match it.

Hope this helps,
Samuele

Thanks Samuele,
I was talking about Gitlab, I followed the various guides and never managed to make anything work.

Anyway, I moved all my stuff to Github and now everything works fine, I’m getting the correct coverage from SimpleCov / Code Climate.

1 Like