From 4782f07d49daaa13d541087116689c66fce3df91 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Mon, 29 Apr 2024 14:34:33 +0200 Subject: [PATCH] fix(pio-build): use python venv See https://peps.python.org/pep-0668/ Signed-off-by: Frederic Pillon --- .github/actions/pio-build/Dockerfile | 6 ++---- .github/actions/pio-build/entrypoint.sh | 8 +++++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/actions/pio-build/Dockerfile b/.github/actions/pio-build/Dockerfile index edf0d63576..eb71603b52 100644 --- a/.github/actions/pio-build/Dockerfile +++ b/.github/actions/pio-build/Dockerfile @@ -5,14 +5,12 @@ ENV LANG C.UTF-8 ENV LC_ALL C.UTF-8 # Install prerequisites -RUN apt-get --quiet=2 update && apt-get install --quiet=2 --assume-yes git python3 python3-pip wget +RUN apt-get --quiet=2 update && apt-get install --quiet=2 --assume-yes git python3 python3-pip python3-venv wget -# Install PlatformIO -RUN pip3 install --quiet --upgrade platformio CMD /bin/bash # Copies your code file from your action repository to the filesystem path `/` of the container COPY entrypoint.sh /entrypoint.sh # Code file to execute when the docker container starts up (`entrypoint.sh`) -ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/pio-build/entrypoint.sh b/.github/actions/pio-build/entrypoint.sh index b03c9c9988..99b5cc7654 100755 --- a/.github/actions/pio-build/entrypoint.sh +++ b/.github/actions/pio-build/entrypoint.sh @@ -1,8 +1,14 @@ -#!/bin/bash +#!/bin/sh readonly CMSIS_VERSION="$1" readonly CMSIS_ARCHIVE="CMSIS-${CMSIS_VERSION}.tar.bz2" +# Use python venv +python3 -m venv "$HOME/venv" +. "$HOME/venv/bin/activate" +# Install PlatformIO +python3 -m pip install --quiet --upgrade platformio + # Install the development version of ststm32 platform platformio platform install "https://github.com/platformio/platform-ststm32.git" || { exit 1