I’m aiming to set up a build stage in an AWS pipeline where the source code is a PlatformIO project that I develop here in VSCode for ESP32’s. I’d like this build stage to compile the project and output a firmware binary that can be flashed to the ESP32’s (via OTA).
I am stuck trying to figure out how I could create a buildspec.yml file that set’s up the PlatformIO environment needed to compile the source code to a flashable binary. Can anyone point me in the right direction or share any similar examples?
In other words, if I gave you a PlatformIO project folder and a fresh VM (Ubuntu or Windows), how could the PlatformIO dev environment be setup in a few CLI commands so that you could compile the source over CLI.
Perhaps I should be manually setting up a container first with VSCode & PlatformIO, and then launching instances of that custom container from codebuild? The buildspec can instruct the container to unzip source code, open that folder with VSCode, compile with PlatformIO.
Alternatively, I could skip this step by compiling the new binary here in my local environment, pushing that binary to the repo and setting up my pipeline to source from only that binary file. Rather than the whole git branch. Is this a better option?