Cache or pre-compile libraries and cores

I'm trying to optimize my CI pipeline for some Arduino libraries I maintain. I have over 80 examples that I'd like to compile for a handful different target boards and architectures each. In total, there are around 600 sketch/board combinations, so compiling all of them takes quite a bit of time.
Right now, I'm using the arduino-builder, but I'm planning to upgrade to the arduino-cli.

What I'm looking for is a way to compile the core and the libraries only once for each target. Compiling and re-using the core seems to be possible using the --build-cache-path option, but I can't seem to find a similar option for third-party libraries.
Is this at all possible using the arduino-cli?
Would it make sense to modify the of the libraries in question to include the precompiled option, and compile the libraries manually in advance?


What I'm looking for is a way to compile the core and the libraries only once for each target.

Once ever, or once per CI run?

Once ever, or once per CI run?

The main library under test once per CI run, but I might cache some third-party libraries or cores until I manually upgrade them to a new version.

Here's the GitHub Actions configuration I'm using: Control-Surface/examples.yaml at new-input · tttapa/Control-Surface · GitHub
It uses the following python script to run arduino-cli compile for multiple examples in parallel: Control-Surface/ at new-input · tttapa/Control-Surface · GitHub

I've cached the ~/.arduino15 folder so I don't have to install the cores each time, and the /tmp/arduino-sketch-* folders in the hope that it would speed up compilation, but the effect of the latter is almost not noticeable.

You can find a run of this Action here: Add methods to enable/disable display elements · tttapa/Control-Surface@d31b950 · GitHub
As you can see, compiling 66 examples for AVR takes 5m39s (~11s/example), while compiling 63 of these examples for Nano 33 BLE (mbed) takes over 45 minutes (~1m30s/example)!

Any ideas how to speed this up?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.