Heroku CI (continuous integration) runs tests in an environment very similar to an Heroku application, the code is packaged into a slug and runs on a dyno.
With Heroku's Github Integration it can automatically run CI-builds for every commit, then report back to Github with a pass or fail status and a link.
The test results can be parsed if they are reported in the TAP-format, but it still stays on Heroku and is not visible on Github.
What if we could get the number or failing tests, error messages, backtraces and even screenshots directly to Github?
This is why I built Blinka🚦!
Setup
- Configure your application for Heroku CI.
- Install
blinka-reporter
by adding it toGemfile
using
bundle add blinka-reporter
- Get
BLINKA_TEAM_ID
andBLINKA_TEAM_SECRET
from Blinka🚦 - the only way to do this today is reaching out to me on Twitter @davidwessman. - Add the values from step 3 to Heroku CI environment variables.
- Add the Github App blinka-bot to the repository.
- Add Blinka-configuration to the testing part of the Heroku configuration in
app.json
. Mine looks like:
"environments": {
"test": {
"addons": [
"heroku-postgresql:in-dyno",
"heroku-redis:in-dyno"
],
"buildpacks": [
{
"url": "https://github.com/heroku/heroku-buildpack-google-chrome"
},
{
"url": "https://github.com/heroku/heroku-buildpack-ruby"
}
],
"env": {
"BLINKA_REPORT": "true",
"BLINKA_REPOSITORY": "davidwessman/synka",
"BLINKA_TAP": "true",
"WD_CHROME_PATH": "/app/.apt/usr/bin/google-chrome-stable"
},
"formation": {
"test": {
"quantity": 1,
"size": "standard-2x"
}
},
"scripts": {
"test-setup": "bin/yarn && bin/rails webpacker:compile",
"test": "bin/rails test:system test"
}
}
}
- Before
blinka-reporter
version 0.3.3 you had to do the reporting separately, this is now handled by settingBLINKA_REPORT=true
.
Bonus
The gem blinka-reporter
also supports outputting test results in TAP-format, without depending on anything but minitest.
Enable by setting the envionment variable BLINKA_TAP=true
. This allows Heroku to parse the results and report them in their interface.
Results
With failing tests
The tests run on Heroku CI and with the TAP-format output we get some feedback in the Heroku interface.
The test results are reported to Blinka🚦 which results in a Github Status:
A comment with the results of the CI-run is posted:
It can even handle screenshots generated from a failing test, upload them to the service and include them in the comment:
Please reach out to me on Twitter if you want to learn more!
Top comments (0)