Thursday, January 10, 2013

Dart Continuous Integration with Drone.io

‹prev | My Chain | next›

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

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


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

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


Bummer. The build failed because:
$ git clone https://github.com/eee-c/hipster-mvc.git /home/ubuntu/src 
Cloning into '/home/ubuntu/src'...
$ dart --version
Dart VM version: 0.2.10.1_r16761 (Mon Jan  7 19:01:05 2013)
$ cat $DART_SDK/revision
16761
$ 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 drone.io 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 drone.io:
[![](https://drone.io/eee-c/DartDirty/status.png)](https://drone.io/eee-c/DartDirty/latest)
This results in a pretty GitHub page:


Last up is to trigger a new drone.io build when I commit to the repository. This is done with a standard GitHub webhook. Drone.io provides some fairly nice documentation. I grab the drone.io webhook URL from the General section of my drone.io 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