Gate uploads on a built firmware, refuse unclaimed native builds, seed the CI toolchain cache from dev

The upload path now checks CORE.firmware_bin exists before invoking
esptool and names the fix (compile first) instead of failing inside
esptool. compile_program raises when a native toolchain resolved but no
platform backend claimed the build rather than falling through to a
mis-configured PlatformIO project. The addr2line failure warning now
includes the exception so the cause is visible without debug logging.

CI: the native toolchain cache is restore-only on PRs and seeded by a
new dev-push job, mirroring seed-apt-cache; the key resolves the pinned
core and toolchain versions from code instead of hashing framework.py.
determine-jobs main() output tests now pin the esp8266_native pair.
This commit is contained in:
J. Nick Koston
2026-08-21 00:05:23 -05:00
parent 01923ff22a
commit aae5538fd5
5 changed files with 110 additions and 9 deletions
+50 -5
View File
@@ -177,6 +177,41 @@ jobs:
path: .temp/components_graph.json
key: components-graph-${{ hashFiles('esphome/components/**/*.py') }}
seed-esp8266-native-cache:
name: Seed the esp8266 native toolchain cache
runs-on: ubuntu-24.04
needs:
- common
# PR-branch cache saves are invisible to other PRs, so pushes seed the
# shared entry test-esp8266-native restores (same pattern as
# seed-apt-cache / cache-esp-idf).
if: github.event_name == 'push'
timeout-minutes: 15
steps:
- name: Check out code from GitHub
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Restore Python
uses: ./.github/actions/restore-python
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
echo "key=esp8266-native-$(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}")')" >> $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 }}
- 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)"
ci-custom:
name: Run script/ci-custom
runs-on: ubuntu-24.04
@@ -1152,13 +1187,22 @@ jobs:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
# ~110 MB of framework + toolchain plus the ccache store; keyed on the
# pinned versions in arduino8266/framework.py so a bump re-downloads
- name: Cache the native toolchain and ccache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
# ~110 MB of framework + toolchain plus the ccache store. 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
echo "key=esp8266-native-$(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}")')" >> $GITHUB_OUTPUT
- name: Restore the native toolchain and ccache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/esphome/arduino8266
key: esp8266-native-${{ hashFiles('esphome/arduino8266/framework.py') }}
key: ${{ steps.esp8266-native-cache-key.outputs.key }}
- name: Run native toolchain compile test
run: |
@@ -1533,6 +1577,7 @@ jobs:
needs:
- common
- seed-apt-cache
- seed-esp8266-native-cache
- determine-jobs
- ci-custom
- pylint