The Arduino team created some tools that make it easy to automate a check for whether your Arduino sketches compile. Used with GitHub Actions, the tools allow anyone to set up a simple “smoke test” on every commit and pull request made to a GitHub repository, with reports on the impacts of those changes.

These free, open source actions are now listed on the GitHub Marketplace.

Why do a compile test?

Although passing a “Does it compile?” check is not definitive proof of a working project, failure to compile is a sure sign of a non-working project! For this reason, it can provide a useful “smoke test”.

Even if you have more formal tests in place, a compilation check remains a valuable supplement, since it is able to catch incompatibilities with the Arduino build system that other tests will miss.

The biggest advantage of this approach is that, unlike other testing methods, it takes very little effort to set up and maintain. All that’s needed is to define a few basic parameters of the compilations, such as which Arduino boards to compile for and which library dependencies of the sketch need to be installed. After that, everything is automatic!

GitHub Actions

GitHub Actions is the preferred automation service for continuous integration in the Arduino firmware repositories. Let’s take a look at its fundamental concepts.

Workflows define the procedure that should run when a specific event occurs in the repository. For example, you might have a workflow that runs every time someone submits a pull request to your repository. Using GitHub Actions is only a matter of adding a workflow configuration file to your repository.

Actions are programs that do specific tasks. These programs are packaged in a manner that makes them easy to reuse in any GitHub Actions workflow. By using combinations of the many actions provided by the open source community, you can easily do complex things with simple, easy to maintain workflows.

Actions for Arduino projects

Several GitHub Actions actions are available for use with Arduino projects. One of these is arduino/compile-sketches. As you might have guessed from the name, this is a tool for compiling Arduino sketches.

#arduino #github

Test Your Arduino Projects with GitHub Actions
2.55 GEEK