Skip to content

CI: migrate all QEMU emulation tests to fbuild for faster native-tooling builds #2287

Closed

Description

@zackees

Motivation

Our emulation test workflows currently compile firmware through PlatformIO, even in cases where fbuild (FastLED's native build tool) would be faster. fbuild drives the compiler directly — no PIO CLI wrapper, no Python platform-manager cycle, better cache behavior (sccache/ccache) — so moving QEMU builds to fbuild should cut per-run build time meaningfully and reduce tool-version flakiness (e.g. the class of problem that produced #2281).

State after #2285:

  • AVR8JS Uno: already compiles via fbuild; PR fix(ci): repair all four emulation workflows (ESP32 QEMU + AVR8JS Uno) #2285's _mirror_fbuild_artifacts_to_pio() copies firmware.elf/firmware.hex into the legacy .pio/build/<env>/ path that the workflow consumer reads. This half is done.
  • ESP32-DEV / C3 / S3 QEMU: build_with_merged_bin() in ci/compiler/pio.py explicitly forces use_fbuild=False. Reason: fbuild does not produce bootloader.bin or partitions.bin — only PlatformIO's ESP-IDF post-build step does — and QEMU needs a merged binary image to boot.

So the remaining work is purely on the ESP32 side, and the blocker is fbuild's lack of bootloader/partitions emission.

Goal

All four emulation workflows build via fbuild end-to-end on master:

  • ESP32-DEV QEMU Test
  • ESP32-C3 QEMU Test
  • ESP32-S3 QEMU Test
  • uno AVR8JS Test (already fbuild; keep as baseline)

Expected outcome: measurable wall-clock reduction per QEMU job and fewer PIO-toolchain-version flakes.

Blocker to resolve

ci/compiler/pio.py::build_with_merged_bin() currently contains a workaround (introduced in #2285) that forces PIO to run because fbuild does not emit the bootloader/partitions artifacts required by esptool merge_bin. Any of the following approaches would unblock the switch — an investigator should evaluate them and pick one:

  1. Have fbuild emit bootloader/partitions natively. Run the ESP-IDF bootloader and partition-table build steps from fbuild using the same toolchain it already drives. Most "correct" long-term answer; biggest up-front investment.
  2. Cache prebuilt bootloader + partitions per (board, IDF version, partition layout) tuple. Bootloader contents are deterministic for a given IDF version and board config; partitions come from partitions.csv. Build them once (via PIO or idf.py) and ship them in the repo or fetch from a cache server. Cheapest if the cache-key is small and stable.
  3. Call idf.py bootloader / idf.py partition-table as narrow shell-outs from fbuild. Hybrid: fbuild owns app compile and merged-bin assembly; idf.py builds only the two auxiliary artifacts. Avoids reimplementing ESP-IDF build logic inside fbuild.
  4. Teach esptool merge_bin to accept a pre-cached bootloader path via an environment override, so the workflow supplies a known-good bootloader binary and fbuild never has to produce one.

Approach (2) is probably the pragmatic starting point. Approach (1) is the cleanest.

Acceptance criteria

  • fbuild produces (or can source from cache) bootloader.bin + partitions.bin for each of esp32dev, esp32c3, esp32s3
  • build_with_merged_bin() no longer force-disables fbuild; it uses whichever build tool the caller asked for
  • All four emulation workflows pass on master using fbuild
  • _mirror_fbuild_artifacts_to_pio() remains only as a compatibility shim for consumers that still read .pio/build/<env>/ — or is removed entirely if those consumers are updated to read fbuild's native path
  • Benchmark: document the per-job wall-clock difference (PIO vs fbuild) for at least one of the three ESP32 workflows in the PR that lands this

Non-goals

  • Retiring PIO from other (non-emulation) workflows — out of scope for this issue. Hardware-style CI jobs can continue to use PIO.
  • Changing the QEMU / avr8js runner images themselves.

Related

Suggested kickoff

Start by reading ci/compiler/pio.py around build_with_merged_bin() and the _mirror_fbuild_artifacts_to_pio() helper, plus ci/util/fbuild_runner.py, to understand exactly where the PIO dependency is today. From there, evaluate approach (2) first — a cache of prebuilt bootloader/partitions artifacts is likely the smallest viable change.

Activity

  1. zackees commented on Apr 18, 2026

    @zackees
    MemberAuthor

    Resolved on master. The blocker this issue described — build_with_merged_bin() force-disabling fbuild because fbuild didn't emit bootloader/partitions — was already fixed by:

    The QEMU workflow templates already use fbuild test-emu. No caching layer is needed on current master; the benchmark ask in the original issue is also moot since there's no PIO-fallback path left to compare against.

    Closing as already-resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions