From 7be68c5ebcf323b970c859ae2359808941efd674 Mon Sep 17 00:00:00 2001 From: Nuno Marques Date: Thu, 7 May 2026 16:40:13 -0700 Subject: [PATCH] ci(macos): point cmake at the venv created by setup script The MacOS build job calls actions/setup-python before running Tools/setup/macos.sh, which creates a venv at .venv and installs all of PX4's Python deps (kconfiglib, empy, etc.) there. setup-python exports Python3_ROOT_DIR / Python_ROOT_DIR / pythonLocation pointing at the hostedtoolcache interpreter, and find_package(Python3) honours those hints over PATH search even with FIND_STRATEGY=LOCATION. Adding .venv/bin to GITHUB_PATH was therefore not enough -- cmake kept selecting /Users/runner/hostedtoolcache/Python/3.10.11/arm64/bin/python3.10, which has no kconfiglib, and configure failed at cmake/kconfig.cmake's import probe. Override Python3_ROOT_DIR / Python_ROOT_DIR / pythonLocation to the .venv and export VIRTUAL_ENV so Python3_FIND_VIRTUALENV=FIRST kicks in, making the venv interpreter the one cmake picks up. Signed-off-by: Nuno Marques --- .github/workflows/compile_macos.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/compile_macos.yml b/.github/workflows/compile_macos.yml index 899d21e3a0..81526eeeea 100644 --- a/.github/workflows/compile_macos.yml +++ b/.github/workflows/compile_macos.yml @@ -46,7 +46,18 @@ jobs: - name: setup run: | ./Tools/setup/macos.sh + # Make the venv created by macos.sh the active Python for all + # subsequent steps. Prepending .venv/bin to PATH alone is not + # enough: actions/setup-python exports Python3_ROOT_DIR / + # pythonLocation pointing at the hostedtoolcache interpreter, + # and find_package(Python3) honours those hints over PATH. The + # PX4 Python deps (kconfiglib, empy, etc.) only live in the + # venv, so configure fails at the kconfiglib import otherwise. echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH + echo "VIRTUAL_ENV=${{ github.workspace }}/.venv" >> $GITHUB_ENV + echo "Python3_ROOT_DIR=${{ github.workspace }}/.venv" >> $GITHUB_ENV + echo "Python_ROOT_DIR=${{ github.workspace }}/.venv" >> $GITHUB_ENV + echo "pythonLocation=${{ github.workspace }}/.venv" >> $GITHUB_ENV - uses: ./.github/actions/setup-ccache id: ccache