Skip to content

Commit

Permalink
ci: Force Python 3.10 for testing
Browse files Browse the repository at this point in the history
Python 3.10 is currently the minimum Python version supported by Zephyr
and the version intended to be used with Zephyr SDK (note that `gdb-py`
links against `libpython3.10`), so test with Python 3.10 on all host
operating sytems.

As part of this, virtual environment usage is forced on Linux hosts in
order to ensure that the correct version and installation of Python is
used.

Signed-off-by: Stephanos Ioannidis <[email protected]>
  • Loading branch information
stephanosio committed Oct 28, 2024
1 parent c318ccf commit 597d42f
Showing 1 changed file with 8 additions and 20 deletions.
28 changes: 8 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1429,11 +1429,10 @@ jobs:

steps:
- name: Set up Python
if: ${{ runner.os == 'Windows' }}
uses: actions/setup-python@v5
with:
# Force Python 3.10 because the twister is not compatible with a Python
# version lower than 3.8 on Windows.
# Force Python 3.10, which is the minimum Python version supported by
# Zephyr and intended to be used with Zephyr SDK.
python-version: '3.10'

- name: Set up test environment (Linux)
Expand Down Expand Up @@ -1467,7 +1466,6 @@ jobs:
echo "ARTIFACT_ROOT=${GITHUB_WORKSPACE}/artifacts" >> $GITHUB_ENV
- name: Create Python virtual environment
if: ${{ runner.os != 'Linux' }}
run: |
# Create Python virtual environment
python3 -m venv ${GITHUB_WORKSPACE}/venv
Expand Down Expand Up @@ -1568,19 +1566,15 @@ jobs:
- name: Install west
run: |
# Activate Python virtual environment
if [ ! -z "${VENV_ACTIVATE}" ]; then
source ${VENV_ACTIVATE}
fi
source ${VENV_ACTIVATE}
# Install or upgrade west
pip3 install --upgrade west
- name: Set up Zephyr repository
run: |
# Activate Python virtual environment
if [ ! -z "${VENV_ACTIVATE}" ]; then
source ${VENV_ACTIVATE}
fi
source ${VENV_ACTIVATE}
# Create Zephyr workspace
ZEPHYR_WORKSPACE=${GITHUB_WORKSPACE}/zephyrproject
Expand Down Expand Up @@ -1610,21 +1604,15 @@ jobs:
- name: Install Python dependencies
run: |
# Activate Python virtual environment
if [ ! -z "${VENV_ACTIVATE}" ]; then
source ${VENV_ACTIVATE}
source ${VENV_ACTIVATE}
# Install Python dependencies from the checked out Zephyr repository
# if running inside a virtual environment; otherwise, it is assumed
# that the host already provides all the required dependencies.
pip3 install -r ${ZEPHYR_ROOT}/scripts/requirements.txt
fi
# Install Python dependencies from the checked out Zephyr repository.
pip3 install -r ${ZEPHYR_ROOT}/scripts/requirements.txt
- name: Run test suites
run: |
# Activate Python virtual environment
if [ ! -z "${VENV_ACTIVATE}" ]; then
source ${VENV_ACTIVATE}
fi
source ${VENV_ACTIVATE}
# Create working directory
mkdir -p test
Expand Down

0 comments on commit 597d42f

Please sign in to comment.