Blame | Last modification | View Log | RSS feed
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.jsonname: (ESP32) Build dev with Arduino CLIon:workflow_dispatch:push:branches:- devpull_request:concurrency:group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}cancel-in-progress: truejobs:arduino-esp32:name: ESP32 (arduino-cli) (shard=${{ matrix.shard }})if: github.event_name == 'workflow_dispatch' || vars.ENABLE_BUILDS == 'true'runs-on: ubuntu-lateststrategy:fail-fast: falsematrix:shard: [1, 2, 3, 4]steps:- name: Checkoutuses: actions/checkout@v4- name: Install arduino-clirun: curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=/usr/local/bin sh- name: Cache Arduino CLI datauses: actions/cache@v4with:key: ${{ runner.os }}-arduino-esp32-${{ hashFiles('.github/workflows/cli-build-esp32-dev.yml') }}-${{ github.run_id }}-${{ matrix.shard }}restore-keys: |${{ runner.os }}-arduino-esp32-${{ hashFiles('.github/workflows/cli-build-esp32-dev.yml') }}-${{ runner.os }}-arduino-esp32-path: |~/.arduino15~/Arduino~/.cache/arduino-cli- name: Update core indexrun: arduino-cli core update-index --additional-urls https://espressif.github.io/arduino-esp32/package_esp32_index.json- name: Install corerun: arduino-cli core install --additional-urls https://espressif.github.io/arduino-esp32/package_esp32_index.json esp32:esp32- name: Install AsyncTCP (ESP32)run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/ESP32Async/AsyncTCP#v3.4.10- name: Install ESPAsyncWebServerrun: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/ESP32Async/ESPAsyncWebServer#v3.9.5- name: Install ArduinoJsonrun: arduino-cli lib install ArduinoJson- name: Install Arduino-MySQLrun: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/cotestatnt/Arduino-MySQL- name: Install Arduino_MFRC522v2run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/OSSLibraries/Arduino_MFRC522v2- name: Install PubSubClientrun: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/knolleary/pubsubclient- name: Build Examplesrun: |set -uo pipefailtotal_shards=4shard="${{ matrix.shard }}"report_file="build-report-esp32-arduino-cli-shard${{ matrix.shard }}.txt": > "$report_file"failures=0total=0index=0for dir in examples/*; doif [[ ! -d "$dir" ]]; thencontinuefiexample="$(basename "$dir")"# Split examples across shards for faster CI.index=$((index + 1))example_shard=$(( (index - 1) % total_shards + 1 ))if [[ "$example_shard" != "$shard" ]]; thencontinuefisketch="examples/${example}/${example}.ino"total=$((total + 1))echo "============================================================="echo "Building ${sketch}..."echo "============================================================="if [[ ! -f "$sketch" ]]; thenfailures=$((failures + 1))printf '%-25s : FAIL (missing %s)\n' "${example}" "${sketch}" >> "$report_file"continuefiecho "::group::arduino-cli compile - ${example}"set +earduino-cli compile \--library . \--warnings none \--build-cache-path "$HOME/.cache/arduino-cli" \-b esp32:esp32:esp32 \"$sketch"rc=$?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 (arduino-cli) ===================="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: arduino-cli-esp32-report-shard${{ matrix.shard }}path: build-report-esp32-arduino-cli-shard${{ matrix.shard }}.txtreport:name: ESP32 (arduino-cli) - Final reportruns-on: ubuntu-latestneeds: arduino-esp32if: always() && needs.arduino-esp32.result != 'skipped'steps:- name: Download all reportsuses: actions/download-artifact@v4with:pattern: arduino-cli-esp32-report-*merge-multiple: truepath: reports- name: Print final report and set statusrun: |set -uo pipefailecho "==================== Final build report (ESP32/arduino-cli) ===================="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