Skip to content

.NET Core and Continuous Integration with AppVeyor

I’ve spent some time on searching for good Continuous Integration (CI) for Kronos. My requirements were simple:

  • free for Open Source project
  • support for .NET Core (DNX runtimes)
  • easy configuration
  • good connection with github

Yegor Bugayenko wrote a great article about CI platforms. Here is a table with differences:

CI

ASP.NET team uses AppVeyor. My decision was quite fast – let’s play with this CI.

Registration is very easy. Go to signup page, select free plan and connect your github/gitlab/vso account. That’s it – your AppVeyor account is ready. You should be automatically redirected to internal CI portal. Click “New project” and select your public project from repository. Now the most interesting part – configuration!

AppVeyor configuration

In the first step we need to configure environment. So let’s go to environment tab. Operating system – select Visual Studio 2015, because this one has DNVM command line. To speed up next builds we need to cache .dnx folder (runtimes, packages, etc.). Is really easy – just type

C:Usersappveyor.dnx

into Cached directories and files input. This cache will increase speed by approximately 100%.

Next step will be related to DNX runtimes. I need to have normal CLR x86 and CoreCLR x64 as a default runtime. Here is install script

dnvm install -r coreclr -arch x64 latest
dnvm install -r clr -arch x86 latest
dnvm use -r coreclr -arch x64 1.0.0-rc1-update1

It is time to configure build. Let’s go to this tab.  You have to type a path to .sln file into the Visual Studio solution or project file input. Also before build we need to restore Nuget packages:

dnu restore

This should be everything… but unfortunately AppVeyor has a problem with discovering xUnit tests with DNX runner.

Go to test tab and disable automatic discover. You have to write own script to run test or disable tests for some time. I’ve already written a simple PS script:

dnx -p ..SrcTestsKronos.Core.Tests test
dnx -p ..SrcTestsKronos.Client.Tests test
dnx -p ..SrcTestsKronos.Server.Tests test

And that’s it.

Kronos Build

After whole work, Appveyor.yaml should look like this:

version: 1.0.{build}
os: Previous Visual Studio 2015
install:
- cmd: >-
    dnvm install -r coreclr -arch x64 latest

    dnvm install -r clr -arch x86 latest

    dnvm use -r coreclr -arch x64 1.0.0-rc1-update1
before_build:
- cmd: dnu restore
build:
  project: Kronos.sln
  verbosity: minimal
test: off

I think it is a good time to show everyone your build status – badge. How my looks like? “Always” green 🙂

Here is sample markdown code

[![Build status](https://ci.appveyor.com/api/projects/status/96trsmj79d7li38f?svg=true)](https://ci.appveyor.com/project/LukaszPyrzyk/kronos-sf0iu)

That is end of this post. Thank you for attention – i wish you only green builds! Feel free to ask, comment and give feedback!