AppVeyor is a great continuous build/delivery service which is hosted in the cloud. You can think of it as a hosted alternative to TeamCity or Visual Studio Online. One of the best things is that it is free for open source projects. This makes it a popular choice for something like GenFu, our test data generation tool.
There are a couple of ways to set up AppVeyor for building a project like GenFu. You can put in place an AppVeyor.yml file which gives instructions about which steps to run to generate a build. Alternately you can put in place a powershell script to do the building. I opted for the latter because it is more portable to other build tools should it be necessary.
The first thing to do is to set up an AppVeyor account and hook it up to your source control. I signed in with github credentials so it was easy to locate the GenFu project which is, of course, hosted on github.
In the build tab I put in just a call to a powershell script.
I also disabled the test task. This is because AppVeyor, at the time of writing, doesn’t really understand how to call dnx based tests. No big deal we’ll do that in our build scripts. AppVeyor does have the dotnet version manager installed so we can skip the step of downloading that and just make use of it.
Here I’ve listed out the current environments then installed the latest versions of the runtime. This could probably be done implicitly so our builds were always using the latest. I would actually discourage that because we don’t want our builds to start failing when we haven’t made changes fixing on a very specific version is desirable. Now we have everything installed we can call the build itself.
First we restore all the packages. In theory the msbuild script should probably do that but I did run into some errors as a result of not calling dnu restore so I’d recommend it. Again we’re being very specific here using version 14 of MSBuild. No previous version understands how to do DotNet Core builds so we’ll focus on version 14.
Finally we need to run our tests. GenFu makes use of XUnit because
A) It is awesome
B) Brad Wilson who maintains it is awesome
I did find some documentation which suggested that you had to produce an XML file and upload it using
# upload results to AppVeyor
However I think that AppVeyor was able to parse the test results without that doing that so YMMV.
Now GenFu has a handy build all set up and we can proudly display a badge in our Readme so people can see that we are building and testing continuously.