My thoughts on tech.
18 October 2017
Here at Coolblue, we can choose our tools from a range of technologies. A while ago, our team started moving from Microsoft MSTest to xUnit.
Although the code change was fairly simple, the build pipeline was tied with the MSTest framework, ignoring the xUnit tests. Between the requests to the deployment team to alter the team’s deployment pipelines, Nathan challenged us to use Cake.
Although I’m a cake monster, “Cake (C# Make) is a cross-platform build automation system with a C# DSL to do things like compiling code, copy files/folders, running unit tests, compress files and build NuGet packages (source).”
Great, this is the tool that was missing, allowing us to abstract from our CI server, speeding our development (at the end that is Agile)!
Cake allow us to build our project in many different ways with a syntax that is our bread and butter (C#). The platform is open-source, meaning that we can fix any bug, or contribute with a module to increase the ecosystem.
During my spare time, I started playing around with Cake in a pet project. The pet project is built using .NET Core 2.0, and the ultimate goal was to build the project in AppVeyor and TravisCI. The build steps were:
As a bonus it should be able to:
Cake offers support to all these steps, either out-of-the-box feature or as a module offered by the community.
The development was simplified since the operations to build & test my project was the same that the build server would execute. It avoids the old developer excuse “it works on my machine”, since the developer machine has the same software as the build server (during the development I face this problem with AppVeyor. The solution was published here).
This approach decreased the time to configure two different CI servers since it supports the executing of the scripts in Windows, Linux, and MacOS.
However, the opportunities are endless. In an enterprise environment, the software is a complex web of services and other moving parts; a team needs to be able to add a feature, test & ship it quickly; at the same time ensuring the business is working as expected, and more important, it doesn’t introduce any regression bugs.
Using Cake, we can setup the script to deploy the necessary components on our development machines, running the tests to assure that everything works before we push our changes. This level of automation and abstraction also enables the developers to focus on delivering value (coding a new feature), rather than spending time configuring and deploying (manually) all the components to run the tests. Raise your hand who was in this situation. Yeah, every developer. 😉
After a few hours around the script, both AppVeyor and TravisCI can execute it, predictably, as I do in my development environment. You can view a sample of the build logs here and here.
Within our team, we started to move towards this direction. All the new projects are bootstrapped with a basic Cake script (Clean, Restore, Build, Test and Create NuGet package), but the team iteratively adapts it to our development needs. In the end, a development team should be proud of the software delivered, because it improves the business, but also the team has to be able to use its time in an effective way.
The same concept exists in other languages/frameworks. As short list we can:
Be aware that this is a short list. Out there exists other build platforms that allow you to abstract from your CI server.