build: add controller_discovery and controller_manual to root CMake b… #128
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: CI | |
| on: | |
| push: | |
| branches: [dev, main] | |
| pull_request: | |
| branches: [dev, main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Cache APT packages | |
| uses: awalsh128/cache-apt-pkgs-action@latest | |
| with: | |
| packages: build-essential cmake ninja-build git pkg-config libi2c-dev libudev-dev | |
| version: 1.0 | |
| - name: Install Python | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y python3-pip | |
| # --------------------------------------------------------------------- | |
| # Build & install linux-wire | |
| # --------------------------------------------------------------------- | |
| - name: Cache linux-wire | |
| id: cache-linux-wire | |
| uses: actions/cache@v4 | |
| with: | |
| path: third_party/linux-wire/install | |
| key: linux-wire-${{ runner.os }}-v1 | |
| - name: Build linux-wire | |
| if: steps.cache-linux-wire.outputs.cache-hit != 'true' | |
| run: | | |
| git clone --depth=1 https://github.com/FEASTorg/linux-wire.git third_party/linux-wire | |
| cmake -S third_party/linux-wire -B third_party/linux-wire/build \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/third_party/linux-wire/install | |
| cmake --build third_party/linux-wire/build --parallel | |
| cmake --install third_party/linux-wire/build | |
| # --------------------------------------------------------------------- | |
| # Build & test CRUMBS | |
| # --------------------------------------------------------------------- | |
| - name: Configure CRUMBS (with Linux HAL) | |
| env: | |
| CMAKE_PREFIX_PATH: ${{ github.workspace }}/third_party/linux-wire/install | |
| run: | | |
| cmake -S . -B build \ | |
| -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCRUMBS_ENABLE_TESTS=ON \ | |
| -DCRUMBS_ENABLE_LINUX_HAL=ON \ | |
| -DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" | |
| - name: Build CRUMBS | |
| run: cmake --build build --parallel | |
| - name: Run CRUMBS tests | |
| run: ctest --test-dir build --output-on-failure | |
| # --------------------------------------------------------------------- | |
| # Out-of-tree example builds (Linux) | |
| # --------------------------------------------------------------------- | |
| - name: Install CRUMBS locally | |
| run: cmake --install build --prefix ${{ github.workspace }}/install | |
| - name: Build Linux simple_controller (core_usage) | |
| env: | |
| CMAKE_PREFIX_PATH: ${{ github.workspace }}/third_party/linux-wire/install:${{ github.workspace }}/install | |
| run: | | |
| cmake -S examples/core_usage/linux/simple_controller -B build-simple-controller \ | |
| -DCRUMBS_BUILD_IN_TREE=OFF \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" | |
| cmake --build build-simple-controller --parallel | |
| - name: Build Linux mock_controller (handlers_usage) | |
| env: | |
| CMAKE_PREFIX_PATH: ${{ github.workspace }}/third_party/linux-wire/install:${{ github.workspace }}/install | |
| run: | | |
| cmake -S examples/handlers_usage/linux/mock_controller -B build-mock-controller \ | |
| -DCRUMBS_BUILD_IN_TREE=OFF \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" | |
| cmake --build build-mock-controller --parallel | |
| - name: Build Linux controller_discovery (families_usage) | |
| env: | |
| CMAKE_PREFIX_PATH: ${{ github.workspace }}/third_party/linux-wire/install:${{ github.workspace }}/install | |
| run: | | |
| cmake -S examples/families_usage/controller_discovery -B build-controller-discovery \ | |
| -DCRUMBS_BUILD_IN_TREE=OFF \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" | |
| cmake --build build-controller-discovery --parallel | |
| - name: Build Linux controller_manual (families_usage) | |
| env: | |
| CMAKE_PREFIX_PATH: ${{ github.workspace }}/third_party/linux-wire/install:${{ github.workspace }}/install | |
| run: | | |
| cmake -S examples/families_usage/controller_manual -B build-controller-manual \ | |
| -DCRUMBS_BUILD_IN_TREE=OFF \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" | |
| cmake --build build-controller-manual --parallel | |
| # --------------------------------------------------------------------------- | |
| # PlatformIO Builds | |
| # --------------------------------------------------------------------------- | |
| platformio: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Cache PlatformIO | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/pip | |
| ~/.platformio | |
| key: pio-${{ runner.os }}-${{ hashFiles('examples/**/platformio.ini') }} | |
| restore-keys: | | |
| pio-${{ runner.os }}- | |
| - name: Install PlatformIO | |
| run: | | |
| python -m pip install -U pip | |
| python -m pip install -U platformio | |
| - name: Build simple_controller (core_usage) | |
| run: pio run -d examples/core_usage/platformio/simple_controller -e nanoatmega328new | |
| - name: Build simple_peripheral (core_usage) | |
| run: pio run -d examples/core_usage/platformio/simple_peripheral -e nanoatmega328new | |
| - name: Build mock_controller (handlers_usage) | |
| run: pio run -d examples/handlers_usage/platformio/mock_controller -e nanoatmega328new | |
| - name: Build mock_peripheral (handlers_usage) | |
| run: pio run -d examples/handlers_usage/platformio/mock_peripheral -e nanoatmega328new | |
| - name: Build calculator peripheral (families_usage) | |
| run: pio run -d examples/families_usage/lhwit_family/calculator -e nanoatmega328new | |
| - name: Build LED peripheral (families_usage) | |
| run: pio run -d examples/families_usage/lhwit_family/led -e nanoatmega328new | |
| - name: Build servo peripheral (families_usage) | |
| run: pio run -d examples/families_usage/lhwit_family/servo -e nanoatmega328new | |
| - name: Build display peripheral (families_usage) | |
| run: pio run -d examples/families_usage/lhwit_family/display -e nanoatmega328new | |
| # ESP32 build validation | |
| - name: Build simple_controller (core_usage, ESP32) | |
| run: pio run -d examples/core_usage/platformio/simple_controller -e esp32dev | |
| - name: Build simple_peripheral (core_usage, ESP32) | |
| run: pio run -d examples/core_usage/platformio/simple_peripheral -e esp32dev | |
| - name: Build mock_controller (handlers_usage, ESP32) | |
| run: pio run -d examples/handlers_usage/platformio/mock_controller -e esp32dev | |
| - name: Build mock_peripheral (handlers_usage, ESP32) | |
| run: pio run -d examples/handlers_usage/platformio/mock_peripheral -e esp32dev | |
| - name: Build calculator peripheral (families_usage, ESP32) | |
| run: pio run -d examples/families_usage/lhwit_family/calculator -e esp32dev | |
| - name: Build LED peripheral (families_usage, ESP32) | |
| run: pio run -d examples/families_usage/lhwit_family/led -e esp32dev | |
| - name: Build servo peripheral (families_usage, ESP32) | |
| run: pio run -d examples/families_usage/lhwit_family/servo -e esp32dev | |
| - name: Build display peripheral (families_usage, ESP32) | |
| run: pio run -d examples/families_usage/lhwit_family/display -e esp32dev |