I don’t like that our build goes red on master all the time due to flaky service tests. I thought I’d look into other CI services that would make it possible to run the scheduled tests nightly without causing those messages to show up. CircleCI, Heroku CI, and Codeship were obvious choices. Heroku CI wasn’t free and I didn’t have any experience with Codeship, so I looked into CircleCI. I’ve used their 1.0 system a lot though this was my first time on their 2.0 system. As with earlier versions, they’ve put a lot of work into making the build fast – perhaps more than any other CI system I’ve seen. I had such good results, my goal shifted from scheduled daily builds (that don’t litter our commit history with red builds) to improving the CI experience as a whole. This change made a big impact: - Build logs load much, much faster. In the test I just ran, 22 seconds to < 2 seconds, a 90% improvement. - Status of each step shows up right in the GitHub UI, which makes it much faster to see exactly what’s failed. - Builds run about 50-75% faster on account of parallelism. - GitHub service tests are fixed. This has been a long-standing issue. - Ability to ssh into a build container to debug failures. Here’s what I did: - Created custom Docker images with our dependencies. To be honest, I’m not even sure these are necessary, only to install the greenkeeper-lockfile. We could get dejavu from npm. They make startup very fast. - Created an npm-install stage which loads all dependencies into node_modules and caches them. - Created separate stages for our main tests, service tests, and frontend tests, and stages to run the main tests and service tests in Node 6. These run in parallel, up to four at a time. - Separated service test ID output from the service test results themselves. (I check these often during the PR process, when I confirm that service tests actually ran. Because the production Shields server caches the title, after updating it you can’t tell whether the update is taking effect.) - Added a personal access token for the shields-ci user. This should actually fix the long-standing issue #979. CircleCI provides an option to “Pass secrets to builds from forked pull requests,” which means unlike Travis, they’ll give us enough rope to shoot ourselves in the foot. - Schedule a daily build, which runs all the service tests.
9.2 KiB
This is home to Shields.io, a service for concise, consistent, and legible badges in SVG and raster format, which can easily be included in GitHub readmes or any other web page. The service supports dozens of continuous integration services, package registries, distributions, app stores, social networks, code coverage services, and code analysis services. Every month it serves over 470 million images.
In addition to hosting the shields.io frontend and server code, this monorepo hosts an NPM library for generating badges, and the badge design specification.
Examples
- build status:
build | failing - code coverage percentage:
coverage | 80% - stable release version:
version | 1.2.3 - package manager release:
gem | 1.2.3 - status of third-party dependencies:
dependencies | out-of-date - static code analysis GPA:
code climate | 3.8 - SemVer version observance:
semver | 2.0.0 - amount of Gratipay donations per week:
tips | $2/week
Make your own badges!
(Quick example: https://img.shields.io/badge/left-right-f39f37.svg)
Browse a complete list of badges.
Contributing
Shields is a community project. We invite your participation through issues and pull requests! You can peruse the contributing guidelines.
When adding or changing a service please add tests.
This project has quite a backlog of suggestions! If you're new to the project, maybe you'd like to open a pull request to address one of them:
Or you can adopt one of these pull requests:
You can read a tutorial on how to add a badge.
Using the badge library
npm install -g gh-badges
badge build passed :green .png > mybadge.png
const badge = require('gh-badges')
// Optional step, to have accurate text width computation.
const format = {
text: ['build', 'passed'],
colorscheme: 'green',
template: 'flat',
}
badge.loadFont('/path/to/Verdana.ttf', err => {
badge(format, (svg, err) => {
// svg is a string containing your badge
})})
View the documentation for gh-badges.
Note: The badge library was last released in 2016.
Development
- Install Node 8 or later. You can use the package manager of your choice. Node 8 is required for building or developing the front end. Node 6 or 8 will work to run the server, and we'll transition to Node 8 everywhere once the production server is upgraded. Server tests need to pass in both.
- Clone this repository.
- Run
npm installto install the dependencies. - Run
npm run buildto build the frontend. - Run
npm startto start the server. - Open
http://[::]:8080/to view the home page.
To generate the frontend using production cache settings – that is,
badge preview URIs with maxAge – run LONG_CACHE=true npm run build.
To analyze the frontend bundle, run npm install webpack-bundle-analyzer and
then ANALYZE=true npm start.
Hosting your own server
There is documentation about hosting your own server.
History
b.adge.me was the original website for this service. Heroku back then had a thing which made it hard to use a toplevel domain with it, hence the odd domain. It used code developed in 2013 from a library called gh-badges, both developed by Thaddée Tyl. The project merged with shields.io by making it use the b.adge.me code and closed b.adge.me.
The original badge specification was developed in 2013 by Olivier Lacan. It was inspired by the Travis CI and similar badges (there were a lot fewer, back then). In 2014 Thaddée Tyl redesigned it with help from a Travis CI employee and convinced everyone to switch to it. The old design is what today is called the plastic style; the new one is the flat style.
You can read more about the project's inception, the motivation of the SVG badge specification, and the specification itself.
Project leaders
espadrine is the sysadmin.
These contributors donate time on a consistent basis to help guide and maintain the project:
Related projects
License
All assets and code are under the CC0 LICENSE and in the public domain unless specified otherwise.
The assets in logo/ are trademarks of their respective companies and are
under their terms and license.
Contributors
This project exists thanks to all the people who contribute. [Contribute].
Backers
Thank you to all our backers! 🙏 [Become a backer]
Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]