Thursday, January 10, 2013

Dart Continuous Integration with

‹prev | My Chain | next›

Up tonight, I would like to get a Dart project running under continuous integration. Since this is Dart, that mean

I am going to try to get Hipster MVC tests onto I start by creating a new project:

Then choose git repository, entering in the git URL from which can pull updates.

On the settings page, I customize the build commands to explicitly run the known tests:
pub install
dart test/hipster_events_test.dart
Then I can build:

Bummer. The build failed because:
$ git clone /home/ubuntu/src 
Cloning into '/home/ubuntu/src'...
$ dart --version
Dart VM version: (Mon Jan  7 19:01:05 2013)
$ cat $DART_SDK/revision
$ pub install
Resolving dependencies...
Downloading unittest 0.2.10+1...
Dependencies installed!
$ dart test/hipster_events_test.dart
Do not know how to load 'dart:html''package:unittest/html_enhanced_config.dart': Error: line 13 pos 1: library handler failed
import 'dart:html';
'file:///home/ubuntu/src/test/hipster_events_test.dart': Error: line 2 pos 1: library handler failed
import 'package:unittest/html_enhanced_config.dart';
Dang it. I forgot there is no way to test dart:html under CI. It will be really nice when that changes.

Fortunately that is not the only Dart project for which I have tests. I also have dart dirty. So I create a new project with the git repo's URL, configure it to run the tests for that library, and...

It passes!

That's pretty cool. I am especially pleased to have build #1 passing. That may be a first for me on any project in any language.

Since I have a passing test, I need to add it to my app's README so I can brag about my awesome coding skills. I do this with some simple markdown that pulls the current status from
This results in a pretty GitHub page:

Last up is to trigger a new build when I commit to the repository. This is done with a standard GitHub webhook. provides some fairly nice documentation. I grab the webhook URL from the General section of my project's settings. Then I add the link to the GitHub repository's settings:

And that's all there is to it. I now have my very excellent test suite running for my very excellent Dart library. And best of all, all potential contributors know that there are tests that they need to keep passing and I create the reasonable expectation that any contributions should include tests.

Day #626

No comments:

Post a Comment