Introduction: Arduino Cloud Build

About: News November 2019. Welcome to the place where we have started to build useful examples. Arduino for Visual Studio provides an Arduino compatible development environment in Microsoft Visual Studio. The tools p…

In a team or commercial setting it can be useful to have the code automatically build on a regular basis within your cloud management solution, often as part of continuous integration.

Here we can leverage the Visual Micro Command Line Interface (CLI) on our Build server to build the code, for a variety of boards or debug levels for example.

In this guide we will link to the Azure Dev Ops solution for our code version control and build management.

Supplies

Visual Micro

Admin rights on Cloud System

One project checked in for Build

Step 1: Setting Up the Build Dependencies

First we will need to deploy the below items to the build server and set them up:-

It is often best to install these to user independent locations on the Build Server, especially if using the agent as a service on the build server.

Tip - Check you can build a sketch on the build server using the command line at this point, ensure you run it as the user which you will run the build server as.

Step 2: Link and Configure Build Agent

We will need to configure the new Agent in Azure Dev Ops, and configure the Agent on our build server as needed which is detailed below:-

https://docs.microsoft.com/en-us/azure/devops/pipe...

Step 3: Configure Build Pipeline

Now we have an agent ready to build, we will need to configure our pipeline:-

  • Create a new blank pipeline
  • Ensure the sources are pointing to your checked in project (or GitHub/SVN/Git/Other Source)
  • Add a Command line task
  • Add commands to run VMBuild.exe as we need
  • Add any additional logging to the script (Environmental/user parameters are useful to log for debugging)

You can include pre-defined variables from Azure in your script directly e.g. $(build.sourcesDirectory)

Any further actions such as publishing the artefacts created back to your system can now be added as well.

Step 4: Check Logging

As with all things ensure you have added some informative logging to the whole process.

The Visual Micro Command Line Interface assists with this by adding the below parameters:-

  • -builder.verbose=true

this will ensure all verbose messages are output

  • -builder.verbose_warnings=true

this will ensure all verbose warnings are also output

  • -builder-close=true and -builder-closeonerrror=true

this ensures the builder exits without need for input from the user

All Visual Micro CLI Parameters can be found here

Step 5: Try It Out

Now you should be able to run a build in your cloud system and see the build process complete!

Its also useful to use the local library cloning, and shared library functions of Visual Micro when integrating with Version Control systems, to keep it as simple and localised as possible for your team, and the build system.

From here you can configure more agents, pipelines and enable the Triggers to automate when your build happens.

Step 6: Find Out More