From 1d48454c3f6a82a565c8d670309261b27389f504 Mon Sep 17 00:00:00 2001 From: Piotr Stolarz Date: Mon, 30 Dec 2024 16:24:17 +0100 Subject: [PATCH] CI/CD: Pico SDK workflow refactored - cont. --- .github/picosdk-ci/Dockerfile | 17 ++++++---------- .github/workflows/picosdk-builds.yml | 29 +++++++++++++++++----------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/.github/picosdk-ci/Dockerfile b/.github/picosdk-ci/Dockerfile index 3761360..ab34a67 100644 --- a/.github/picosdk-ci/Dockerfile +++ b/.github/picosdk-ci/Dockerfile @@ -3,24 +3,19 @@ FROM ubuntu:latest ENV TZ=Europe/Warsaw RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone -RUN apt-get update && \ - apt-get install -y \ - git - -ENV PICO_SDK_PATH=/pico-sdk - -RUN cd / && \ - git clone https://github.com/raspberrypi/pico-sdk && \ - cd pico-sdk && \ - git submodule update --init --recursive - RUN apt-get update && \ apt-get install -y \ cmake \ g++ \ gcc-arm-none-eabi \ + git \ make \ nodejs \ python3 \ sudo RUN apt-get clean + +RUN git clone -- https://github.com/raspberrypi/pico-sdk /pico-sdk && \ + cd /pico-sdk && \ + git submodule update --init --recursive && \ + chmod --recursive a+rw . diff --git a/.github/workflows/picosdk-builds.yml b/.github/workflows/picosdk-builds.yml index a9b53e2..bb23fe4 100644 --- a/.github/workflows/picosdk-builds.yml +++ b/.github/workflows/picosdk-builds.yml @@ -1,6 +1,7 @@ name: Pico SDK builds env: SDK_VER: 2.1.0 + PICO_SDK_PATH: /pico-sdk on: push: branches: @@ -19,11 +20,11 @@ jobs: steps: - uses: actions/cache@v4 with: - path: /pico-sdk - key: pico_sdk_cache - - name: Set SDK version + path: ${{ env.PICO_SDK_PATH }} + key: sdk-${{ env.SDK_VER }} + - name: Pico SDK checkout run: | - cd /pico-sdk + cd ${PICO_SDK_PATH} git fetch || true git checkout -f ${SDK_VER} git submodule update -f --init --recursive @@ -34,10 +35,13 @@ jobs: steps: - uses: actions/cache@v4 with: - path: /pico-sdk - key: pico_sdk_cache - - name: SDK recent versions info - run: cd /pico-sdk && git tag | sort | awk "/$(git describe --tags)/ {f=1} f==1 {print}" + path: ${{ env.PICO_SDK_PATH }} + key: sdk-${{ env.SDK_VER }} + - name: Pico SDK recent versions info + run: | + cd ${PICO_SDK_PATH} + git fetch || true + git tag | sort | awk "/$(git describe --tags)/ {f=1} f==1 {print}" picosdk_build: runs-on: ubuntu-latest container: ghcr.io/pstolarz/picosdk-ci @@ -56,8 +60,8 @@ jobs: - uses: actions/checkout@v4 - uses: actions/cache@v4 with: - path: /pico-sdk - key: pico_sdk_cache + path: ${{ env.PICO_SDK_PATH }} + key: sdk-${{ env.SDK_VER }} - name: Build run: | repo_dir=$(pwd) @@ -67,4 +71,7 @@ jobs: ln -s ${repo_dir}/examples/pico-sdk/${{ matrix.example }}/CMakeLists.txt CMakeLists.txt ln -s ${repo_dir}/examples/pico-sdk/${{ matrix.example }}/pico_sdk_import.cmake pico_sdk_import.cmake mkdir build && cd build - sudo bash -c "PICO_SDK_PATH=/pico-sdk CXXFLAGS=\"${BUILD_FLAGS}\" CFLAGS=\"${BUILD_FLAGS}\" cmake .. && make" + export CXXFLAGS="${BUILD_FLAGS}" + export CFLAGS="${BUILD_FLAGS}" + cmake .. + make