In my project jQuery Terminal I commited a change that make coverage was changed from 79% to 80% (the project is using jasmine, travis and coveralls service) but my badge in README still was showing 79%, even after removing cache. I’ve fixed the issue by adding md5 hash (I know it have been broken, but we don’t use anything secure here) of the spec file after url of my badge, so each time I add something to spec file I’ve get different url, so github wont cache the file.
I’m using make
as my build script and I have two README
files. Source with .in
extension and result with .md
extension so I’ve put another variable (I’m already using BRANCH
and VERSION
in README
):
https://coveralls.io/repos/github/jcubic/jquery.terminal/badge.svg?branch=BRANCH&CHECKSUM
and in my Makefile I’ve added:
SPEC_CHECKSUM=`md5sum spec/terminalSpec.js | cut -d' ' -f 1` README.md: README.in .$(VERSION) $(SED) -e "s/{{VER}}/$(VERSION)/g" -e "s/{{BRANCH}}/$(BRANCH)/g" -e "s/{{CHECKSUM}}/$(SPEC_CHECKSUM)/" < README.in > README.md
This is simplification, actually I have more code, you can see in my Makefile
if you have more then one spec file you can use this to generate checksum
SPEC_CHECKSUM=`cat spec/*.js | md5sum | cut -d' ' -f 1`
This will also work if you have different language and different build system.