96

I have a project on github that has extensive unit tests (using mocha for node.js).

I'd like to show off by showing those tests passing/failing on each page. I notice other projects on Github are doing this.

enter image description here

I've been unable to find any documentation on how to make the test status display.

  • How can I make Github show unit test output?
  • Does Github run the tests or do you need to hook up with an external webapp?
  • Is there a free webservice to do this (my app is Open Source)?
mikemaccana
  • 110,530
  • 99
  • 389
  • 494

4 Answers4

55

Take a look at Travis CI. You can use it with GitHub.

They have docs on using NodeJS

Those badges you see are called "status images" and Travis provides MarkDown that you can insert into your project's README.md file.

mikemaccana
  • 110,530
  • 99
  • 389
  • 494
relekang
  • 1,844
  • 16
  • 6
  • 1
    Yep, sign in with github. Docs on using NodeJS are at: http://about.travis-ci.org/docs/user/languages/javascript-with-nodejs/ – mikemaccana Nov 24 '12 at 22:49
  • 1
    For more detailed instructions follow this link, https://docs.travis-ci.com/user/status-images/ , select the dropdown "markup" option, and paste the text on your github project's README.md file – rtrujillor Dec 16 '15 at 12:28
  • Is there any way to use Travis CI if my GitHub project is WinForms? It does not seem to work for me. Perhaps, any other CI tool that's available for Windows-specific open source projects? – Victor Zakharov Mar 21 '16 at 19:14
13

Note that since April 26th 2013, you can see the build status on your GitHub repo branch page:

build status on GitHub repo branches

The Commit Status API allows you to use that elsewhere: see " Repo Statuses API".

Starting April 30th, 2013, the API endpoint for commit statuses has been extended to allow branch and tag names, as well as commit SHAs.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
7

CircleCI the status badges are also simply images that you can drop into your README.md file with the markdown. For example:

![Build Status](https://circleci.com/gh/<your github name>/<repo name>.png?circle-token=:circle-token)

or

![Build Status](https://circleci.com/gh/<your github name>/<repo name>.svg?style=shield&circle-token=:circle-token)
sebix
  • 2,943
  • 2
  • 28
  • 43
mjhm
  • 16,497
  • 10
  • 44
  • 55
1

GitHub also has workflow status badges for GitHub Actions.

The image is usually embedded into the README.md file using Markdown like this:

![example workflow](https://github.com/<OWNER>/<REPOSITORY>/actions/workflows/<WORKFLOW>.yml/badge.svg)
Florian
  • 78
  • 6
  • 1
    It's been a few years since I asked this question so Travis (used in the original answer) isn't very popular anymore compared to say GitHub Actions. I'm going to mark this as the accepted answer, though people using Circle, Travis etc. should also look at the other answers. – mikemaccana Dec 05 '22 at 11:07