Blame | Last modification | View Log | RSS feed
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.jsonname: (ESP8266) Build with PlatformIOon:workflow_dispatch:push:branches:- devpull_request:concurrency:group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}cancel-in-progress: truejobs:platformio-esp8266:name: ESP8266 (pio) (board=${{ matrix.board }}, shard=${{ matrix.shard }})if: github.event_name == 'workflow_dispatch' || vars.ENABLE_BUILDS == 'true'runs-on: ubuntu-lateststrategy:fail-fast: falsematrix:board:- d1_minishard: [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.x"- name: Install PIOrun: |python -m pip install --upgrade pippip install --upgrade platformio- name: Build Examplesrun: |set -uo pipefailtotal_shards=4shard="${{ matrix.shard }}"# Examples not intended for ESP8266 / this jobEXCLUDE_EXAMPLES=(esp32-cambinaryWebSocketcsvLoggerSDlocalRFIDmysqlRFIDmqtt_webserver)report_file="build-report-esp8266-pio-${{ matrix.board }}-shard${{ matrix.shard }}.txt": > "$report_file"failures=0total=0index=0for dir in examples/*; doif [[ ! -d "$dir" ]]; thencontinuefiexample="$(basename "$dir")"if [[ " ${EXCLUDE_EXAMPLES[*]} " == *" ${example} "* ]]; thenecho "Skipping: ${example}"printf '%-25s : SKIP\n' "${example}" >> "$report_file"continuefi# Split examples across shards for faster CI.index=$((index + 1))example_shard=$(( (index - 1) % total_shards + 1 ))if [[ "$example_shard" != "$shard" ]]; thencontinuefitotal=$((total + 1))echo "============================================================="echo "Building examples/${example} (board=${{ matrix.board }}, shard=${shard})..."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-${{ matrix.board }}-${example}" \PLATFORMIO_SRC_DIR="examples/${example}" PIO_BOARD="${{ matrix.board }}" \pio run -e ci-esp8266rc=$?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 (esp8266/pio, board=${{ matrix.board }}, shard=${{ matrix.shard }}) ===================="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-esp8266-report-${{ matrix.board }}-shard${{ matrix.shard }}path: build-report-esp8266-pio-${{ matrix.board }}-shard${{ matrix.shard }}.txtreport:name: ESP8266 (pio) - Final reportruns-on: ubuntu-latestneeds: platformio-esp8266if: always() && needs.platformio-esp8266.result != 'skipped'steps:- name: Download all reportsuses: actions/download-artifact@v4with:pattern: pio-esp8266-report-*merge-multiple: truepath: reports- name: Print final report and set statusrun: |set -uo pipefailecho "==================== Final build report (ESP8266/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