CI/CD: Pico SDK workflow refactored #102
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pico SDK builds | |
env: | |
SDK_VER: 2.1.0 | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
picosdk_checkout: | |
runs-on: ubuntu-latest | |
container: ghcr.io/pstolarz/picosdk-ci | |
steps: | |
- uses: actions/cache@v4 | |
with: | |
path: /pico-sdk | |
key: pico_sdk_cache | |
- name: Set SDK version | |
run: | | |
cd /pico-sdk | |
git fetch || true | |
git checkout -f ${SDK_VER} | |
git submodule update -f --init --recursive | |
picosdk_info: | |
runs-on: ubuntu-latest | |
container: ghcr.io/pstolarz/picosdk-ci | |
needs: picosdk_checkout | |
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}" | |
picosdk_build: | |
runs-on: ubuntu-latest | |
container: ghcr.io/pstolarz/picosdk-ci | |
needs: picosdk_checkout | |
strategy: | |
matrix: | |
example: | |
- DallasTemperature | |
env: | |
BUILD_FLAGS: "\ | |
-DCONFIG_PWR_CTRL_ENABLED \ | |
-DCONFIG_OVERDRIVE_ENABLED \ | |
-DCONFIG_CRC16_ENABLED \ | |
-DCONFIG_ITERATION_RETRIES=1" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: /pico-sdk | |
key: pico_sdk_cache | |
- name: Build | |
run: | | |
repo_dir=$(pwd) | |
rm -rf /tmp/picosdk-build && mkdir /tmp/picosdk-build && cd /tmp/picosdk-build | |
ln -s ${repo_dir} OneWireNg | |
ln -s ${repo_dir}/examples/pico-sdk/${{ matrix.example }}/${{ matrix.example }}.cpp ${{ matrix.example }}.cpp | |
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" |