You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

This tutorial carries on from the previous tutorials Part 1: Create your First ProjectPart 2: Create your First Configuration and  Part 3: Create your First Repository and it is recommended that these are completed before reading this tutorial.

So far we have created a project, attached a configuration and created a repository, however we still cannot run a build! Fear not, by the end of this tutorial you will have your first build up and running.

In this tutorial we will be creating an action that will build our Fluent NHibernate source repository using Visual Studio. This tutorial assumes you have Visual Studio installed on your server.

Attempting to Run a Build

Go ahead and try running a build. The easiest way to run a build is by using the Quick Build button (Fast forward icon) on the configuration tile. The quick build action will run a build with the default actions passed into the build process.

Once the build has been run it will turn red, as seen below. The reason the build failed is that there are no actions for the build to complete. Well this is easily fixed by adding some actions to the Configuration Workflow in the Configuration Wizard. Click the Edit Configuration button (Edit pencil icon) on the configuration tile to enter the Configuration Wizard then click 4 Stages.

Stages & Workflow Editor

Welcome to the Stage & Workflow Editor. This is where you define the individual actions that will be executed when a build is run. For more detailed information on working with workflows, check out the Managing Stages section.

Stages

Continua CI creates a default 'Build' Stage when a new configuration is created and this stage can be seen near the top of the page in the Stage Editor. Each stage is represented as a blue chevron and is accompanied by a stage gate, which is represented as a box with a triangle missing. Stages can be used as a way to break a complex build process into smaller, logical pieces. For example, your build may consist of a build stage, a test stage and a deployment stage. For this tutorial however the default 'Build' stage will be all we need.

Actions

Actions are the individual build steps that are executed when a build is run. These actions range from running a batch file to running a build runner and executing unit tests. All actions are defined and controlled through the bottom section of the stages page. On the left you can find all the available actions and to the right is the Workflow Editor where the action execution order is defined.

So lets create our first action by navigating to the Build Runners category as seen below. Selecting the Build Runners category will display all available build runner actions that can be executed within Continua. For this tutorial we want to build our Fluent NHibernate source code using Visual Studio, so lets add a Visual Studio .NET Action by double clicking Visual Studio.

Selecting an action will bring up the action dialog where you can set all the properties for your Visual Studio action. In this tutorial we will need to point this action to the Fluent NHibernate Visual Studio .sln file, so lets set the Project File property to $Source.Fluent_Nhibernate$/src/FluentNHibernate.sln. Continua CI supports Variables, Objects & Expressions which we are using in this field to point to our repository. You can see that we are using $Source.Fluent_Nhibernate$ to point to our repository rather then providing a concrete file path. This is done so that you do not need to worry about where repositories are located as Continua CI looks after all repository management for you. So lets breakdown what is happening when we define our project file to point to $Source.Fluent_Nhibernate$/src/FluentNHibernate.sln.

Continua allows you to specify dynamic objects and variables that are then given values when a build is executed. Dynamic objects and expressions are registered with surrounding $ symbols. In the image below you can see that specifying $Source.$ displays a dropdown that lists all the repositories that can be accessed from this configuration. At the moment we only have our Fluent NHibernate repository, however any other repositories that may have been created will also display in this list. So by setting the project file to $Source.Fluent_Nhibernate$, we are pointing Continua to our Fluent_NHibernate repository. If you called your repository a different name then this property will need to reflect the new name. ie. $Source.<repo_name>$

Anything that follows $Source.Fluent_Nhibernate$ refers to the file structure of the repository itself. So by specifying /src/FluentNHibernate.sln we are telling Continua to get the FluentNHibernate.sln file from the src folder of the repository. On the GitHub Fluent NHibernate page you can see the project's repository structure. In the two images below, you can see how we point to the .sln file in Continua CI and how the project's file structure looks over at GitHub.

For this tutorial we only need to set the project file, make sure the action is enabled and set the Using property to whichever Visual Studio version that is installed on the server.

The Using property is used to tell Continua which version of Visual Studio it should use when executing the Visual Studio action. This Using property uses property collectors to point Continua to the correct application it should use when performing a task. Unless your Visual Studio was installed in a non-standard directory, the default Property Collector should find Visual Studio. If Continua cannot find Visual Studio then a new property collector will need to be specified in the administration section.

Once your Visual Studio action has been configured, click Save which will add your action to the Workflow editor, as shown below.

If you were to create additional actions then these would also be added to the Workflow editor underneath your Visual Studio action. In Continua, actions toward the top of the list are executed before actions that are towards the bottom. For now though, the Visual Studio action is all we need to build our project so lets save our workflow by clicking Save & Complete Wizard.

  • No labels