Why is my coveralls.io badge not updating even when the builds are happening?
Asked Answered
A

10

27

I am trying to use coveralls.io to show a coverage badge for my tests, but the coverage badge is stuck on "unknown".

The relevant repo is here: https://github.com/cfogelberg/grunt-set-app-mode

When I look at coveralls.io for that repo I see the same "coverage: unknown" status: coveralls.io/r/cfogelberg/grunt-set-app-mode

However, the individual builds are being correctly sent to coveralls.io: https://coveralls.io/builds/788669

What am I missing?

Atherton answered 21/5, 2014 at 15:49 Comment(5)
I am in fact having trouble even finding documentation on how to add the coveralls badge. Could you shed some insights for that?Purplish
Hey @dming, this should prob be a separate question but in brief: I haven't been able to find good coveralls documentation but the URL for your coveralls badge will be coveralls.io/repos/<coveralls-user-name>/…. You can check it in your browser.Atherton
Yeah I was able to figure it out from inspecting other project's README files as well, but so odd it's not documented anywhere. Anyway, I think my issue might be different from yours as my repo is private and the issue for me appears to be that GitHub cannot render the image without authenticating with coveralls.io. Posted a separate question here: #33133506Purplish
Have the same issue with my project. But the "fun" part, is it's not only me. It also happens for my friends who try's to check it out.Appraise
This might not be an answer to this question but might help someone else. I just noticed that github does some caching on those images to. When rendering README.rst, it changes the image URL to https://camo.githubusercontent.com/ followed by a humongous number of characters.Renell
D
24

If clearing your local cache isn't fixing the image, the problem is likely that it was cached by Github as a part of their image URL anonymization process.

You can force Github to clear their cache of the image with the following curl command. Change the example URL to the one from the your repo, it will always be https://camo.githubusercontent.com/ followed by a long hash.

curl -X PURGE https://camo.githubusercontent.com/4d04abe0044d94fefcf9af2133223....

Source: GitHub Help: About anonymized image URLs

Dissepiment answered 30/6, 2019 at 14:22 Comment(3)
That returns a forbidden pageSneakbox
This worked for me, December 2022.Corkboard
I was wondering why my NPM Version Badge wasn't updating and was inspecting the HTML element and saw that the img src was at camo.githubusercontent.com and guessed it was some sort of proxy-cache, so like a server-side cache that can't be resolved client-side. I had no issues running the curl -X PURGE on the src URL, getting a successful response: { "status": "ok", "id": "4120-1688343712-210422" } Then I did a hard refresh in my browser (Firefox, Ctrl+F5) and could then see the up-to-date badge image.Drawknife
M
9

What am I missing?

It's possible that your browser cached the image. I realized this was happening to me recently. I couldn't understand why my badge said one thing on my github page, but something different on the badge's website.

Now I tend to check websites in a Chrome incognito window so I don't have the cache to worry about.

Montague answered 18/6, 2016 at 7:10 Comment(1)
This was true in my case. I simply press the SHIFT key while reloading and the badge was updated.Shere
J
6

In my case, I had the code coverage outdated in my coveralls badge with this Markdown snippet:

[![Coverage Status](https://coveralls.io/repos/github/user-repo/user-project/badge.svg?branch=master)](https://coveralls.io/github/user-repo/user-project?branch=master)

But when I removed the branch parameter of the first URL, the coverage gets updated!

[![Coverage Status](https://coveralls.io/repos/github/user-repo/user-project/badge.svg)](https://coveralls.io/github/user-repo/user-project?branch=master)

Update:

My first solution didn't work the second time though. So I reverted it, and resorted to changing the badge type from SVG to PNG.

[![Coverage Status](https://coveralls.io/repos/github/user-repo/user-project/badge.png?branch=master)](https://coveralls.io/github/user-repo/user-project?branch=master)
Jazminejazz answered 13/5, 2018 at 3:14 Comment(0)
A
4

Since posting this question I have pushed more commits and rerun the coveralls task a number of times and the coverage badge now works:

https://github.com/cfogelberg/grunt-set-app-mode/compare/4FB59ACC...58E23E5373

It is not clear why it works now and didn't earlier. coveralls has been added to the default task since the previous failed build on coveralls. However, it was added to the default task and pushed to Github earlier than the next build on coveralls, which only changes the README.md file (fixing a link to a david-dm.org badge).

I'm afraid this isn't really a "solution" as such and I would still love to know (not sure why/who voted the question down), but in any case I hope this information is useful to someone else in the future.

Atherton answered 23/5, 2014 at 19:27 Comment(1)
This is just happening to my repo at github.com/intuit/node-pom-parser... :( Can't find an answer. It looks like the redirect of the URL may be the problem.Haerr
P
3

Your browser cached the badge image. To force an update, hold SHIFT while reloading your browser tab (on Brave on macOS, I do this via CMD + R).

Phi answered 27/6, 2021 at 9:38 Comment(1)
This did it for meSartorius
R
2

I've come arround this issue adding a PURGE request to purge GitHub's cached copy of the badge at the end of a my github actions workflow:

$ curl -X PURGE https://camo.githubusercontent.com/4d04abe0044d94fefcf9af2133223....

i 've used the http-request-action :

- name: refresh coverage badge
      uses: fjogeleit/http-request-action@master
      with:
        url: https://camo.githubusercontent.com/12c4fcb3b21fbb2a725fc61449fb1b91e972c4c8a2baaf5904936d8e334bdbe8/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f62336230302f63736c792f62616467652e7376673f6272616e63683d64657626736572766963653d676974687562
        method: PURGE
Revoke answered 3/6, 2021 at 13:41 Comment(0)
R
2

For me the problem was that the image was cached by github, not my own browser. There is a fix documented here that worked:

I added 'kill_cache=1' in the image url

ex: src="https://coveralls.io/repos/github/spread-the-code/git-commiter-nodejs/badge.svg?branch=master&kill_cache=1" />

https://github.com/lemurheavy/coveralls-public/issues/1065

Rhadamanthus answered 16/2, 2022 at 17:51 Comment(0)
M
1

Add a queryString param to the badge image URL, Here is the answer https://github.com/lemurheavy/coveralls-public/issues/1065#issuecomment-435494495

Margaritamargarite answered 14/4, 2021 at 20:45 Comment(0)
S
0

I have tried other proposals here, and none of them seems to work.

Install disable Cookies chrome extension from here.

Go to your github project, press disable cookies, and then restore them back.

coveralls.io badge should be updated after that.

Suspect same problem is applicable also to normal users as well.

In my case image failed to refresh no manner how many times I've pressed reload, used purge or so other tricks (did not want to clear history).

Also anonymous web browsing sometimes helps.

Please note that coveralls.io report takes time to be processed, so need to wait couple of minutes at least. (Can be checked from coveralls.io site).

Suds answered 15/4, 2021 at 20:50 Comment(0)
E
0

@iamdefinitelyahuman Answer helped me, but I would like to add some more things that weren't clear to me.

I had the same issue. My coveralls status badge was showing an old coverage percentage. The reason was that the badge was cached by GitHub so I had to clean it using a curl command.

In the beginning, I didn't realize where to get the URL "https://camo.githubusercontent.com/...". After some time I understood that it is the badge image path that can be taken by inspecting the image element.

Then I opened Powershell which was a mistake and run the command: curl -X PURGE https://camo.githubusercontent.com/a4550375d0d4b6f1b363909b2aeeb2827303e07388abe00c0662700f1514fef5/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f4d69636861656c5a61736c6176736b792f736f6369616c2d6576656e742d6d616e616765722f62616467652e737667.

And I got this error: enter image description here

Then I tried to run this command in CMD and it worked properly. { "status": "ok", "id": "10525-1659579296-180434" }.

Then I still didn't see it on my browser as it was my browser cache issue. I knew it is a browser cache as I could see the new coverage percentage in Incognito.

Lastly, I cleaned the cache of my browser by opening the developer's tools (F12) => Right-click on the refresh button => Empty Cache and Hard Reload. And, that I could see the percentage updated in my browser as well.

Emolument answered 5/8, 2022 at 17:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.