Blame | Last modification | View Log | RSS feed
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.jsonname: (ESP32) Build dev with PlatformIOon:workflow_dispatch:push:branches:- devpull_request:concurrency:group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}cancel-in-progress: truejobs:# Build with PlatformIO - ESP32 Arduino Latestplatformio-esp32-arduino-latest:name: ESP32 (pio) - Arduino Latest (board=${{ matrix.board }}, shard=${{ matrix.shard }})if: github.event_name == 'workflow_dispatch' || vars.ENABLE_BUILDS == 'true'runs-on: ubuntu-lateststrategy:fail-fast: falsematrix:board:- esp32dev- esp32-s3-devkitc-1shard: [1, 2, 3, 4]steps:- name: Checkoutuses: actions/checkout@v4- name: Cache PlatformIOuses: actions/cache@v4with:key: ${{ runner.os }}-piopath: |~/.cache/pip~/.platformio- name: Pythonuses: actions/setup-python@v5with:python-version: "3.13"- name: Install PIOrun: |python -m pip install --upgrade pippip install --upgrade platformio- name: Build Examplesrun: |set -uo pipefailtotal_shards=4shard="${{ matrix.shard }}"report_file="build-report-${{ matrix.board }}-shard${{ matrix.shard }}.txt": > "$report_file"failures=0total=0index=0for dir in examples/*; doif [[ ! -d "$dir" ]]; thencontinuefiexample="$(basename "$dir")"board_to_use="${{ matrix.board }}"# Split examples across shards for faster CI.index=$((index + 1))example_shard=$(( (index - 1) % total_shards + 1 ))if [[ "$example_shard" != "$shard" ]]; thencontinuefi# Avoid duplicating esp32-cam across the board matrix.if [[ "$example" == "esp32-cam" && "${{ matrix.board }}" != "esp32dev" ]]; thenprintf '%-25s : SKIP (board-specific)\n' "${example}" >> "$report_file"continuefi# Some examples are board-specificif [[ "$example" == "esp32-cam" ]]; thenboard_to_use="esp32cam"fitotal=$((total + 1))echo "============================================================="echo "Building examples/${example} (board=${board_to_use})..."echo "============================================================="echo "::group::pio run - examples/${example}"set +e# Use a per-example build directory to avoid cross-example artefacts.PLATFORMIO_BUILD_DIR=".pio/build-${board_to_use}-${example}" \PLATFORMIO_SRC_DIR="examples/${example}" PIO_BOARD="${board_to_use}" \pio run -e ci-arduino-3-latestrc=$?set -eecho "::endgroup::"if [[ $rc -eq 0 ]]; thenprintf '%-25s : OK\n' "${example}" >> "$report_file"elsefailures=$((failures + 1))printf '%-25s : FAIL (exit=%s)\n' "${example}" "$rc" >> "$report_file"fidoneecho ""echo "==================== Build report (board=${{ matrix.board }}) ===================="cat "$report_file"echo "============================================================================="echo "Total attempted: ${total} | Failures: ${failures}"# Do not fail the job here: the final report job will decide.- name: Upload build reportif: always()uses: actions/upload-artifact@v4with:name: pio-esp32-report-${{ matrix.board }}-shard${{ matrix.shard }}path: build-report-${{ matrix.board }}-shard${{ matrix.shard }}.txtreport:name: ESP32 (pio) - Final reportruns-on: ubuntu-latestneeds: platformio-esp32-arduino-latestif: always() && needs.platformio-esp32-arduino-latest.result != 'skipped'steps:- name: Download all reportsuses: actions/download-artifact@v4with:pattern: pio-esp32-report-*merge-multiple: truepath: reports- name: Print final report and set statusrun: |set -uo pipefailecho "==================== Final build report (ESP32/pio) ===================="failures=0files=0shopt -s nullglobfor f in reports/*.txt; dofiles=$((files + 1))echo "--- ${f} ---"cat "$f"if grep -q " : FAIL" "$f"; thenfailures=$((failures + 1))fidoneif [[ $files -eq 0 ]]; thenecho "No report files found (artifact download failed?)"exit 1fiecho "======================================================================="if [[ $failures -gt 0 ]]; thenecho "One or more shards reported FAIL."exit 1fi