Simplify the native dispatch and CI cache wiring

A cache-arduino8266 composite action mirrors cache-esp-idf (one key
resolver, dev-writes/PR-restores) and both jobs pin
ESPHOME_ARDUINO8266_PREFIX so YAML and Python agree on the path by
construction. esp32 provides the native_toolchain_module hook, so the
shared dispatcher never names a backend and the unclaimed-native raise
loses its esp-idf carve-out; the esp8266 decode and run_compile hooks
resolve through the same seam. run_compile resolves ccache once and
threads it to the generator, env, and idedata; the compdb rule names
follow the shared kinds; the pio-options warner inlines into the driver
and derives its consumed set from the core routing constant; the
per-toolchain CI narrowing shares one body; create_components_graph is
memoized per run; the decode rate-limit drops its math sentinel.
This commit is contained in:
J. Nick Koston
2026-08-21 20:55:27 -05:00
parent 16bc83032d
commit 17f718e8c9
10 changed files with 147 additions and 114 deletions
@@ -0,0 +1,36 @@
name: Cache Arduino ESP8266
description: >
Resolve the pinned Arduino core and xtensa toolchain versions and cache the
native ESP8266 install (~110 MB framework + toolchain; no ccache store, the
seed job saves before any compile runs). Callers must set env
ESPHOME_ARDUINO8266_PREFIX: ~/.esphome-arduino8266 and have the Python venv
already restored. Mirrors cache-esp-idf: only dev-branch pushes write the
shared cache, everything else restores.
runs:
using: composite
steps:
- name: Resolve the native toolchain cache key
# The versions are pinned in code, not in a hashable file, so resolve
# them for the key (actions/cache never overwrites a key, so a bump
# must change it). Assignment form so errexit catches a resolver
# failure; a nested $(...) inside echo would silently yield a
# degenerate key.
id: version
shell: bash
run: |
. venv/bin/activate
key=$(python -c 'from esphome.components.esp8266 import RECOMMENDED_ARDUINO_FRAMEWORK_VERSION as f; from esphome.arduino8266.framework import TOOLCHAIN_VERSION as t; print(f"{f}-{t}")')
[ -n "$key" ] || exit 1
echo "key=$key" >> "$GITHUB_OUTPUT"
- name: Cache the native toolchain (write on dev)
if: github.ref == 'refs/heads/dev'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.esphome-arduino8266
key: ${{ runner.os }}-esp8266-native-${{ steps.version.outputs.key }}
- name: Restore the native toolchain (off dev)
if: github.ref != 'refs/heads/dev'
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.esphome-arduino8266
key: ${{ runner.os }}-esp8266-native-${{ steps.version.outputs.key }}
+8 -36
View File
@@ -187,6 +187,10 @@ jobs:
# seed-apt-cache / cache-esp-idf).
if: github.event_name == 'push'
timeout-minutes: 15
env:
# The composite action and the install below agree on this path by
# construction, not by matching the Python-side default
ESPHOME_ARDUINO8266_PREFIX: ~/.esphome-arduino8266
steps:
- name: Check out code from GitHub
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -195,23 +199,9 @@ jobs:
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: Resolve the native toolchain cache key
id: esp8266-native-cache-key
run: |
. venv/bin/activate
# Assignment form so errexit catches a resolver failure; a nested
# $(...) inside echo would silently yield a degenerate key
key=$(python -c 'from esphome.components.esp8266 import RECOMMENDED_ARDUINO_FRAMEWORK_VERSION as f; from esphome.arduino8266.framework import TOOLCHAIN_VERSION as t; print(f"{f}-{t}")')
[ -n "$key" ] || exit 1
echo "key=esp8266-native-$key" >> $GITHUB_OUTPUT
- name: Cache the native toolchain
id: esp8266-native-cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/esphome/arduino8266
key: ${{ steps.esp8266-native-cache-key.outputs.key }}
uses: ./.github/actions/cache-arduino8266
- name: Install the native toolchain
if: steps.esp8266-native-cache.outputs.cache-hit != 'true'
run: |
. venv/bin/activate
python -c "from esphome.arduino8266.framework import check_and_install; from esphome.components.esp8266 import RECOMMENDED_ARDUINO_FRAMEWORK_VERSION; check_and_install(RECOMMENDED_ARDUINO_FRAMEWORK_VERSION)"
@@ -1181,6 +1171,7 @@ jobs:
# Single source of truth -- the full list lives in
# script/determine-jobs.py::ESP8266_NATIVE_TEST_COMPONENTS.
TEST_COMPONENTS: ${{ needs.determine-jobs.outputs.esp8266-native-components }}
ESPHOME_ARDUINO8266_PREFIX: ~/.esphome-arduino8266
steps:
- name: Check out code from GitHub
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -1191,27 +1182,8 @@ jobs:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
# ~110 MB of framework + toolchain (no ccache: the seed job saves
# before any compile runs, so the store would always be empty). The versions
# are pinned in code, not in a hashable file, so resolve them for the
# key (actions/cache never overwrites a key, so a bump must change it).
# PRs are restore-only; the shared entry is seeded on pushes to dev by
# seed-esp8266-native-cache, mirroring the seed-apt-cache scoping.
- name: Resolve the native toolchain cache key
id: esp8266-native-cache-key
run: |
. venv/bin/activate
# Assignment form so errexit catches a resolver failure; a nested
# $(...) inside echo would silently yield a degenerate key
key=$(python -c 'from esphome.components.esp8266 import RECOMMENDED_ARDUINO_FRAMEWORK_VERSION as f; from esphome.arduino8266.framework import TOOLCHAIN_VERSION as t; print(f"{f}-{t}")')
[ -n "$key" ] || exit 1
echo "key=esp8266-native-$key" >> $GITHUB_OUTPUT
- name: Restore the native toolchain
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/esphome/arduino8266
key: ${{ steps.esp8266-native-cache-key.outputs.key }}
- name: Cache the native toolchain
uses: ./.github/actions/cache-arduino8266
- name: Run native toolchain compile test
run: |