Automate building of HEX files for your nRF Connect SDK application using CircleCI or GitHub Actions

Continuous delivery is in important aspect of short time to market and since the nRF9160 supports firmware over the air updates we want to ship a new firmware to our development boards every time we update the application.

GitHub release with attached HEX files

One precondition for that is the automation of the process that compiles the HEX file of an application.

In this example I'll provide the configuration for Circle CI, a continuous integration service, which allows you to run task on their service for free, if your project is open source.

After signing up for CircleCI and connecting it to your source code provider, you need to provide a configuration file which instructs the docker-based build system to

  • configure the image with the necessary dependencies for Zephyr
  • initialize NCS and its dependencies
  • build the HEX files for all target devices of your application

Getting all these steps right takes a while, because configuring NCS and Zephyr includes many individual tasks, but afterwards you have a reproducible recipe to build your HEX files, as part of your source code project. 

Not only does that mean you can provide up-to-date HEX files with zero effort, but using a CI runner allows you to automate your software releases using a project called semantic release.

This repository contains the

Following this example, all developers need to do format their commit messages following a certain schema (you can read more in detail about this process here) to trigger a new release.

GitHub releases

Using GitHub Actions

GitHub Actions are a new feature which is to be released in November 2019, but many GitHub organizations already are enrolled in the public beta. Like CircleCI it is a generic task runner but offers deeper integration into GitHub.

Here is the workflow definition for GitHub Actions which automatically compiles HEX files and attaches them to the GitHub release.