Blame | Last modification | View Log | RSS feed
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.jsonname: (ESP8266) Build 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-esp8266:name: ESP8266 (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-esp8266-${{ hashFiles('.github/workflows/cli-build-esp8266.yml') }}-${{ github.run_id }}-${{ matrix.shard }}restore-keys: |${{ runner.os }}-arduino-esp8266-${{ hashFiles('.github/workflows/cli-build-esp8266.yml') }}-${{ runner.os }}-arduino-esp8266-path: |~/.arduino15~/Arduino~/.cache/arduino-cli- name: Update core indexrun: arduino-cli core update-index --additional-urls https://arduino.esp8266.com/stable/package_esp8266com_index.json- name: Install corerun: arduino-cli core install --additional-urls https://arduino.esp8266.com/stable/package_esp8266com_index.json esp8266:esp8266- name: Install ESPAsyncTCP (ESP8266)run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/ESP32Async/ESPAsyncTCP#v2.0.0- name: Install ESPAsyncWebServerrun: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/ESP32Async/ESPAsyncWebServer#v3.7.3- name: Install ArduinoJsonrun: arduino-cli lib install ArduinoJson- 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-arduino-cli-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" ]]; 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 esp8266:esp8266:huzzah \"$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 (esp8266/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-esp8266-report-shard${{ matrix.shard }}path: build-report-esp8266-arduino-cli-shard${{ matrix.shard }}.txtreport:name: ESP8266 (arduino-cli) - Final reportruns-on: ubuntu-latestneeds: arduino-esp8266if: always() && needs.arduino-esp8266.result != 'skipped'steps:- name: Download all reportsuses: actions/download-artifact@v4with:pattern: arduino-cli-esp8266-report-*merge-multiple: truepath: reports- name: Print final report and set statusrun: |set -uo pipefailecho "==================== Final build report (ESP8266/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