CI: Workaround CMake 4.0. #59
This file contains hidden or 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: CMake | |
| on: | |
| push: | |
| pull_request: | |
| release: | |
| types: [created] | |
| env: | |
| # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
| BUILD_TYPE: Release | |
| jobs: | |
| build: | |
| name: ${{matrix.name}} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-24.04 | |
| name: Linux | |
| cache-key: linux | |
| cmake-args: '-DPIMORONI_PICO_PATH=$GITHUB_WORKSPACE/pimoroni-pico -DPICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install' | |
| runs-on: ${{matrix.os}} | |
| env: | |
| PICO_SDK_PATH: $GITHUB_WORKSPACE/pico-sdk | |
| PIMORONI_PICO_LIBS: $GITHUB_WORKSPACE/pimoroni-pico | |
| RELEASE_FILE: ${{github.event.repository.name}}-${{github.event.release.tag_name}} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| with: | |
| path: project | |
| # Checkout the Pimoroni Pico Libraries | |
| - name: Checkout Pimoroni Pico Libraries | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: pimoroni/pimoroni-pico | |
| path: pimoroni-pico | |
| # Checkout the Pico SDK | |
| - name: Checkout Pico SDK | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: raspberrypi/pico-sdk | |
| path: pico-sdk | |
| ref: '2.1.1' | |
| submodules: true | |
| - name: Install Arm GNU Toolchain (arm-none-eabi-gcc) | |
| uses: carlosperate/arm-none-eabi-gcc-action@v1 | |
| with: | |
| release: '13.3.Rel1' | |
| # CMake 4.0 - erroneously introduced into GitHub runners? - | |
| # removed support for <3.5 and mbedtls hits this | |
| # https://github.com/raspberrypi/pico-sdk/issues/2391 | |
| # https://github.com/actions/runner-images/issues/11926 | |
| - name: Setup cmake | |
| uses: jwlawson/actions-setup-cmake@v2 | |
| with: | |
| cmake-version: '3.31.6' | |
| - name: CMake Version | |
| run: cmake --version | |
| - name: Create Build Environment | |
| run: cmake -E make_directory ${{runner.workspace}}/build | |
| - name: Configure CMake | |
| shell: bash | |
| working-directory: ${{runner.workspace}}/build | |
| run: cmake $GITHUB_WORKSPACE/project -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCPACK_PACKAGE_FILE_NAME=${{env.RELEASE_FILE}} ${{matrix.cmake-args}} | |
| - name: Build | |
| working-directory: ${{runner.workspace}}/build | |
| shell: bash | |
| run: | | |
| cmake --build . --config $BUILD_TYPE -j 2 | |
| - name: Build Release Packages | |
| if: github.event_name == 'release' | |
| working-directory: ${{runner.workspace}}/build | |
| shell: bash | |
| run: | | |
| cmake --build . --config $BUILD_TYPE --target package -j 2 | |
| - name: Upload .zip | |
| if: github.event_name == 'release' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: ${{runner.workspace}}/build/${{env.RELEASE_FILE}}.zip | |
| - name: Upload .tar.gz | |
| if: github.event_name == 'release' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: ${{runner.workspace}}/build/${{env.RELEASE_FILE}}.tar.gz |