Use badges to show latest values

Oct 16, 2019
4 min read

What is Continuous Integration without badges? We like those little SVG images within our README.md and every major player has some kind of badge. Even package managers and documentation pages have badges these days.

We are happy to announce that SeriesCI has added support for badges. We have got a few demo repositories where we have already added those badges.

github.com/seriesci/calc has got a badge for code coverage. 100% code coverage is pretty impressive and we would like to keep it at this level.

SeriesCI code coverage

github.com/seriesci/bench has got a badge for a benchmark for its most important function. It is necessary to keep an eye on it.

SeriesCI benchmark

github.com/seriesci/dockersize has got a badge for the docker image size. Without multi stage builds and other optimizations this value was around 800 MB.

SeriesCI docker image size

github.com/zemirco/seriesci-demo has got a badge for the number of dependencies. Although this is a fake value it shows a badge without optional unit.

SeriesCI number of dependencies

As you can see our badges are very flexible. They consist of the series name, a value and an optional unit. In a very generic way it looks like the following badge.

series: string series: string value: double [unit: string] value: double [unit: string]


On the left hand side we've got the series name. This is a string and defined by you when you create a new series. Afterwards we've got the value which is of type double. Those values usually come from your Continuous Integration. Internally we store them as double because we don't know what you are sending to us. You could send a simple integer but also a floating point value. In the end we've got an optional unit. The unit is a string just like the series name. As we said the unit is optional because sometimes we have quantities where we need it, e.g. ms, % or ns/op, whereas in other cases we simply do not have units. Think about lines of code. A project might have 314159 lines of code. It is a plain number without any unit.

To add badges to your README.md include the following code and adjust it to your needs. It is basically the normal URL for your series with .svg added at the end.

// README.md
[![badge](https://seriesci.com/seriesci/bench/series/master/benchmark.svg)](https://seriesci.com/seriesci/bench/series/master/benchmark)

The generic form for this URL looks like this.

https://seriesci.com/:owner/:repo/series/:branch/:series.svg

You are now able to keep an eye on all of your KPIs (key performance indicators). Be it

  • bundle size
  • build time
  • lines of code
  • number of dependencies
  • docker image size
  • benchmarks
  • code coverage
  • quality metrics, e.g. cyclomatic complexities and cognitive complexity

We hope you like this new feature. Start adding badges to your repository's README.md file and let your users know about the KPIs of your project.