117 lines
3.8 KiB
YAML
117 lines
3.8 KiB
YAML
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-22.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'
|
|
apt-packages: clang-tidy gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib
|
|
|
|
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@v3
|
|
with:
|
|
path: project
|
|
|
|
# Checkout the Pimoroni Pico Libraries
|
|
- name: Checkout Pimoroni Pico Libraries
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: pimoroni/pimoroni-pico
|
|
path: pimoroni-pico
|
|
|
|
# Checkout the Pico SDK
|
|
- name: Checkout Pico SDK
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: raspberrypi/pico-sdk
|
|
path: pico-sdk
|
|
submodules: true
|
|
|
|
# Linux deps
|
|
- name: Install deps
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt update && sudo apt install ${{matrix.apt-packages}}
|
|
mkdir toolchain
|
|
cd toolchain
|
|
wget https://buildbot.embecosm.com/job/riscv32-gcc-ubuntu2204-release/10/artifact/riscv32-embecosm-ubuntu2204-gcc13.2.0.tar.gz
|
|
tar xzf riscv32-embecosm-ubuntu2204-gcc13.2.0.tar.gz
|
|
|
|
- name: Create Build Environment
|
|
run: |
|
|
cmake -E make_directory ${{runner.workspace}}/build
|
|
cmake -E make_directory ${{runner.workspace}}/build-riscv
|
|
|
|
- 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: Configure CMake RiscV
|
|
shell: bash
|
|
working-directory: ${{runner.workspace}}/build-riscv
|
|
run: cmake $GITHUB_WORKSPACE/project -DPICO_PLATFORM=rp2350-riscv -DPICO_TOOLCHAIN_PATH=$GITHUB_WORKSPACE/toolchain/riscv32-embecosm-ubuntu2204-gcc13.2.0 -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCPACK_PACKAGE_FILE_NAME=${{env.RELEASE_FILE}} ${{matrix.cmake-args}}
|
|
|
|
- name: Build RiscV
|
|
working-directory: ${{runner.workspace}}/build-riscv
|
|
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: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
with:
|
|
asset_path: ${{runner.workspace}}/build/${{env.RELEASE_FILE}}.zip
|
|
upload_url: ${{github.event.release.upload_url}}
|
|
asset_name: ${{env.RELEASE_FILE}}.zip
|
|
asset_content_type: application/zip
|
|
|
|
- name: Upload .tar.gz
|
|
if: github.event_name == 'release'
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
with:
|
|
asset_path: ${{runner.workspace}}/build/${{env.RELEASE_FILE}}.tar.gz
|
|
upload_url: ${{github.event.release.upload_url}}
|
|
asset_name: ${{env.RELEASE_FILE}}.tar.gz
|
|
asset_content_type: application/octet-stream
|