Initial Commit #1
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: 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-20.04 | |
name: Linux | |
cache-key: linux | |
cmake-args: '-DPICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache' | |
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: Compiler Cache | |
uses: actions/cache@v4 | |
with: | |
path: /home/runner/.ccache | |
key: ccache-cmake-${{github.ref}}-${{matrix.board}}-${{github.sha}} | |
restore-keys: | | |
ccache-cmake-${{github.ref}}-${{matrix.board}} | |
ccache-cmake-${{github.ref}} | |
ccache-cmake | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
path: src | |
# Checkout the Pico SDK | |
- name: Checkout Pico SDK | |
uses: actions/checkout@v3 | |
with: | |
repository: raspberrypi/pico-sdk | |
path: pico-sdk | |
submodules: true | |
- name: Install Arm GNU Toolchain (arm-none-eabi-gcc) | |
uses: carlosperate/arm-none-eabi-gcc-action@v1 | |
with: | |
release: '13.3.Rel1' | |
- name: RP2350 - Create Build Environment | |
run: cmake -E make_directory ${{runner.workspace}}/build-rp2350 | |
- name: RP2350 - Configure CMake | |
shell: bash | |
working-directory: ${{runner.workspace}}/build-rp2350 | |
run: cmake $GITHUB_WORKSPACE/src ${{matrix.cmake-args}} -DPICO_BOARD=PICO2 | |
- name: RP2350 - Build | |
working-directory: ${{runner.workspace}}/build-rp2350 | |
shell: bash | |
run: | | |
ccache --zero-stats || true | |
cmake --build . --config $BUILD_TYPE -j 2 | |
ccache --show-stats || true | |
- name: RP2040 - Create Build Environment | |
run: cmake -E make_directory ${{runner.workspace}}/build-rp2040 | |
- name: RP2040 - Configure CMake | |
shell: bash | |
working-directory: ${{runner.workspace}}/build-rp2040 | |
run: cmake $GITHUB_WORKSPACE/src ${{matrix.cmake-args}} -DPICO_BOARD=PICO | |
- name: RP2040 - Build | |
working-directory: ${{runner.workspace}}/build-rp2040 | |
shell: bash | |
run: | | |
ccache --zero-stats || true | |
cmake --build . --config $BUILD_TYPE -j 2 | |
ccache --show-stats || true | |
- name: Combine Files | |
working-directory: ${{runner.workspace}} | |
run: | | |
cat build-rp2040/flash_nuke.uf2 build-rp2350/flash_nuke.uf2 > universal_flash_nuke.uf2 | |
zip universal_flash_nuke.zip universal_flash_nuke.uf2 | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: universal_flash_nuke | |
path: ${{runner.workspace}}/universal_flash_nuke.uf2 | |
- name: Upload Release | |
if: github.event_name == 'release' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
with: | |
asset_path: ${{runner.workspace}}/universal_flash_nuke.zip | |
upload_url: ${{github.event.release.upload_url}} | |
asset_name: universal_flash_nuke.zip | |
asset_content_type: application/zip |