ESP32 Integration Test Pipeline with Over-The-Air update

20.03.2023

If you want to learn how to implement a fully automated integration test pipeline for your ESP32 based IoT project, this article is for you.

About

As a software project increases in complexity it is inevitable to implement a continuous integration pipeline at some point during development. It will help to maintain quality and provide immediate feedback to the developer about whether or not the latest code changes contain breaking changes. There are several hurdles to overcome when it comes to implmenting such a pipeline for an IoT device like the WIFI enabled ESP32 microcontroller:
 

  • Implement Over-The-Air firmware upgrade capabilities for the IoT device
  • Automate building of the binary deployment artifact
  • Deploy the artifact to the IoT device over the air
  • Execute integration test suite against the API of the IoT device

 
This article refers to this public github repository template. It contains a minimal example which addresses all these challenges using a github actions pipeline.

Concept

The idea is to connect a self-hosted github action runner to the github repository. The self-hosted runner uses Docker to build and deploy the firmware to the ESP32 microcontroller. A successful deployment will trigger the execution of a java based integration test on the HTTP API of the ESP32 to validate the device is behaving properly. This requires the ESP32 and the self-hosted runner to be in the same local network. The self-hosted runner is required to have docker installed.
Architecture image

Demo project and pipeline

In the repository you can find a PlatformIO project which makes use of the ESP-IDF (Espressif IoT Development Framework) to implement Over-The-Air firmware update capabilities for the ESP32. In order to benefit from Over-The-Air firmware updates through an automated pipeline we must first add OTA-capabilities to our project.
It can be imported into any PlatformIO compatible IDE such as Atom or Visual Studio Code.
The code must be uploaded to the microcontroller manually only once in order to benefit from automated deployments through a pipeline in the future.
 
The github actions pipeline provided with the template repository uses docker to install all compiler dependencies and build the microcontroller firmware on the self-hosted github actions runner. After that the pipeline will perform the OTA update over WIFI and finally execute a java based integration test suite against the API of the ESP32 that is implemented in the project for the purpose of demonstration.
Image of pipeline

Sources

https://github.com/enthusiasc/esp32-integration-test-pipeline-ota
https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners
https://docs.platformio.org/en/latest/what-is-platformio.html
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/index.html
 
Feel free to refer to the repository if you need more details on how to get started.
Modification, distribution, private use and commercial use are welcome as stated in the license.

Zurück zur Übersicht

Kommentar verfassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

*Pflichtfelder

*