Compare commits

...
4 changed files with 64 additions and 1 deletions
+14
View File
@@ -0,0 +1,14 @@
esphome:
name: cmake-idf
esp32:
board: esp32dev
framework:
type: esp-idf
logger:
api:
wifi:
ssid: cmake
password: cmakepassword
+43
View File
@@ -0,0 +1,43 @@
name: Windows cmake lookup check
on:
push:
branches:
- windows_cmake_lookup_ci
workflow_dispatch:
permissions:
contents: read
jobs:
compile:
name: esp-idf native without host cmake
runs-on: windows-latest
timeout-minutes: 120
steps:
- name: Check out code from GitHub
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.13"
# cmd throughout: idf_tools.py refuses to run under MSYS, which the
# bash shell announces, and users build from a plain Windows shell
- name: Install esphome
shell: cmd
run: |
python -m venv venv
call venv\Scripts\activate.bat
pip install -r requirements.txt
pip install -e .
# The runner image has cmake preinstalled on PATH, which would mask
# the bug: users of the builder install have no host cmake. Strip
# PATH to the interpreter, git and the system dirs, then prove it.
# ninja stays reachable through the venv, as in a real install: the
# pip ninja package from requirements.txt puts it in Scripts.
- name: Compile without cmake on the host PATH
shell: cmd
run: |
set "PATH=%CD%\venv\Scripts;%pythonLocation%;%pythonLocation%\Scripts;C:\Program Files\Git\cmd;%SystemRoot%\system32;%SystemRoot%"
where cmake && echo cmake still on PATH, test is invalid && exit /b 1
esphome compile .github/cmake_windows/idf.yaml
+3 -1
View File
@@ -138,7 +138,9 @@ def _get_cmake_output(build_dir) -> str:
if not (Path(build_dir) / "CMakeCache.txt").is_file():
raise EsphomeError(f"No ESP-IDF build found in {build_dir}")
cmd = ["cmake", "-LA", "-N", "."]
# Resolve to an absolute path: Windows locates a child process
# through the parent's PATH, not the env passed to it.
cmd = [_get_idf_tool("cmake"), "-LA", "-N", "."]
env = _get_idf_env()
result = subprocess.run(
@@ -264,6 +264,7 @@ def test_get_cmake_output_with_configured_build(setup_core: Path) -> None:
)
with (
patch.object(toolchain, "_get_idf_env", return_value={}),
patch.object(toolchain, "_get_idf_tool", return_value="/idf/tools/cmake"),
patch.object(toolchain.subprocess, "run", return_value=completed) as mock_run,
):
assert toolchain._get_cmake_output(build_dir) == completed.stdout
@@ -271,6 +272,9 @@ def test_get_cmake_output_with_configured_build(setup_core: Path) -> None:
assert toolchain._get_cmake_output(build_dir) == completed.stdout
mock_run.assert_called_once()
# The resolved path, never a bare "cmake": Windows locates the child
# through the parent's PATH, where the IDF-managed cmake is missing.
assert mock_run.call_args.args[0][0] == "/idf/tools/cmake"
assert toolchain._get_cmake_tool_path("CMAKE_ADDR2LINE") == Path("/tool/addr2line")