upgrade #24
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: [ main, master ] | |
| tags: ['v*'] | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| unit-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Configure CMake | |
| run: cmake -S . -B build | |
| - name: Build tests | |
| run: cmake --build build | |
| - name: Run tests | |
| run: ctest --test-dir build --output-on-failure | |
| build-examples: | |
| runs-on: ubuntu-latest | |
| needs: unit-tests | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| board: [esp32dev, esp32-s3-devkitc-1, esp32-c3-devkitm-1] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Cache PlatformIO | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.platformio | |
| key: ${{ runner.os }}-platformio-${{ hashFiles('**/library.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-platformio- | |
| - name: Install PlatformIO | |
| run: pip install --upgrade platformio | |
| - name: Build library examples (ESP32 Arduino) | |
| run: | | |
| set -e | |
| for d in examples/*; do | |
| if [ -d "$d" ]; then | |
| echo "Building $d on ${{ matrix.board }} via PlatformIO CI" | |
| pio ci "$d" \ | |
| --board ${{ matrix.board }} \ | |
| --lib="." \ | |
| --project-option "build_unflags=-std=gnu++11" \ | |
| --project-option "build_flags=-std=gnu++17" | |
| fi | |
| done | |
| arduino-cli: | |
| runs-on: ubuntu-latest | |
| needs: unit-tests | |
| env: | |
| ESP32_CORE_VERSION: 3.0.7 | |
| ESP32_CORE_URL: https://espressif.github.io/arduino-esp32/package_esp32_index.json | |
| ARDUINO_BOARDS: | | |
| esp32:esp32:esp32 esp32dev | |
| esp32:esp32:esp32s3 esp32-s3-devkitc-1 | |
| esp32:esp32:esp32c3 esp32-c3-devkitm-1 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Arduino CLI | |
| uses: arduino/setup-arduino-cli@v1 | |
| - name: Prepare Arduino directories | |
| run: | | |
| mkdir -p "${HOME}/.arduino15" | |
| mkdir -p "${HOME}/Arduino/libraries" | |
| - name: Cache Arduino dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.arduino15 | |
| ~/Arduino/libraries | |
| key: ${{ runner.os }}-arduino-esp32-${{ env.ESP32_CORE_VERSION }}-${{ hashFiles('library.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-arduino-esp32-${{ env.ESP32_CORE_VERSION }}- | |
| ${{ runner.os }}-arduino-esp32- | |
| - name: Install ESP32 core | |
| run: | | |
| set -e | |
| arduino-cli core update-index --additional-urls "${ESP32_CORE_URL}" | |
| # Retry once to dodge transient network drops/timeouts on large downloads | |
| if ! arduino-cli core install --additional-urls "${ESP32_CORE_URL}" "esp32:esp32@${ESP32_CORE_VERSION}"; then | |
| echo "Retrying ESP32 core install after transient failure..." | |
| arduino-cli core install --additional-urls "${ESP32_CORE_URL}" "esp32:esp32@${ESP32_CORE_VERSION}" | |
| fi | |
| - name: Add local library to sketchbook | |
| run: | | |
| set -e | |
| SKETCHBOOK_DIR="${HOME}/Arduino" | |
| mkdir -p "$SKETCHBOOK_DIR/libraries/ESPMemoryMonitor" | |
| rsync -a --delete --exclude ".git" ./ "$SKETCHBOOK_DIR/libraries/ESPMemoryMonitor/" | |
| - name: Build examples | |
| env: | |
| BOARDS: ${{ env.ARDUINO_BOARDS }} | |
| run: | | |
| set -euo pipefail | |
| while read -r fqbn board_name; do | |
| if [ -z "$fqbn" ]; then | |
| continue | |
| fi | |
| echo "::group::Compiling examples for ${board_name} (${fqbn})" | |
| for d in examples/*; do | |
| if [ -d "$d" ]; then | |
| echo "Compiling $d" | |
| arduino-cli compile --fqbn "$fqbn" "$d" | |
| fi | |
| done | |
| echo "::endgroup::" | |
| done <<< "$BOARDS" |