platformio.ini at the repository root (or in a known subdirectory checked out by your workflow).
The firmngin/ota action auto-detects PlatformIO when platformio.ini is present and platform is auto (default).
When to use PlatformIO CI/CD
Project requirements
Your repository should include:
Example minimal
platformio.ini:
How auto-detection works
Whenplatform: auto (default):
- The action checks for
platformio.iniin the repository root. - If found, PlatformIO is selected.
- If
platformio-envis empty, the action resolves the environment in this order:default_envsfromplatformio.ini- First
[env:name]block in the file
- Runs
pio run --environment <env>. - Uploads the compiled firmware to firmngin.
Basic workflow
Firmware in a subdirectory
Ifplatformio.ini is not at the repo root:
platformio.ini must be inside firmware/.
Multiple environments
Option A: Matrix jobs (recommended)
Upload one artifact per hardware target:Option B: Single environment per workflow file
Maintain separate workflow files per product line, each with a fixedplatformio-env.
Board and model alignment
firmngin uses board name and board model to match firmware artifacts to devices. Your PlatformIOboard setting must correspond to the values configured on:
- The device template (fleet OTA), or
- The device (single-device OTA), or
- The
target-board/target-modelinputs (artifact-only upload).
If upload fails with a target mismatch error, compare your template or device board fields with the values sent by CI/CD.
Optimizing binary size
CI/CD uploads are limited to 10 MB. Common PlatformIO optimizations:- Disable verbose logging in release builds.
- Remove unused libraries from
lib_deps. - Use partition schemes appropriate for your flash size.
Build flags per environment
Use environment-specific sections for release vs debug:Caching PlatformIO dependencies (optional)
Speed up builds by caching PlatformIO packages:firmngin/ota action installs PlatformIO on each run; caching reduces download time for platforms and libraries.