Merge branch 'master' of https://github.com/cotestatnt/async-esp-fs-w… #14
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
| # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
| name: (ESP32) Build dev with PlatformIO | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| - release/* | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # Build with PlatformIO - ESP32 Arduino Latest | |
| platformio-esp32-arduino-latest: | |
| name: ESP32 (pio) - Arduino Latest (board=${{ matrix.board }}, shard=${{ matrix.shard }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| board: | |
| - esp32dev | |
| - esp32-s3-devkitc-1 | |
| shard: [1, 2, 3, 4] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Cache PlatformIO | |
| uses: actions/cache@v4 | |
| with: | |
| key: ${{ runner.os }}-pio | |
| path: | | |
| ~/.cache/pip | |
| ~/.platformio | |
| - name: Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - name: Install PIO | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install --upgrade platformio | |
| - name: Build Examples | |
| run: | | |
| set -uo pipefail | |
| total_shards=4 | |
| shard="${{ matrix.shard }}" | |
| report_file="build-report-${{ matrix.board }}-shard${{ matrix.shard }}.txt" | |
| : > "$report_file" | |
| failures=0 | |
| total=0 | |
| index=0 | |
| for dir in examples/*; do | |
| if [[ ! -d "$dir" ]]; then | |
| continue | |
| fi | |
| example="$(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" ]]; then | |
| continue | |
| fi | |
| # Avoid duplicating esp32-cam across the board matrix. | |
| if [[ "$example" == "esp32-cam" && "${{ matrix.board }}" != "esp32dev" ]]; then | |
| printf '%-25s : SKIP (board-specific)\n' "${example}" >> "$report_file" | |
| continue | |
| fi | |
| # Some examples are board-specific | |
| if [[ "$example" == "esp32-cam" ]]; then | |
| board_to_use="esp32cam" | |
| fi | |
| total=$((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-latest | |
| rc=$? | |
| set -e | |
| echo "::endgroup::" | |
| if [[ $rc -eq 0 ]]; then | |
| printf '%-25s : OK\n' "${example}" >> "$report_file" | |
| else | |
| failures=$((failures + 1)) | |
| printf '%-25s : FAIL (exit=%s)\n' "${example}" "$rc" >> "$report_file" | |
| fi | |
| done | |
| echo "" | |
| 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 report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pio-esp32-report-${{ matrix.board }}-shard${{ matrix.shard }} | |
| path: build-report-${{ matrix.board }}-shard${{ matrix.shard }}.txt | |
| report: | |
| name: ESP32 (pio) - Final report | |
| runs-on: ubuntu-latest | |
| needs: platformio-esp32-arduino-latest | |
| if: always() | |
| steps: | |
| - name: Download all reports | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: pio-esp32-report-* | |
| merge-multiple: true | |
| path: reports | |
| - name: Print final report and set status | |
| run: | | |
| set -uo pipefail | |
| echo "==================== Final build report (ESP32/pio) ====================" | |
| failures=0 | |
| files=0 | |
| shopt -s nullglob | |
| for f in reports/*.txt; do | |
| files=$((files + 1)) | |
| echo "--- ${f} ---" | |
| cat "$f" | |
| if grep -q " : FAIL" "$f"; then | |
| failures=$((failures + 1)) | |
| fi | |
| done | |
| if [[ $files -eq 0 ]]; then | |
| echo "No report files found (artifact download failed?)" | |
| exit 1 | |
| fi | |
| echo "=======================================================================" | |
| if [[ $failures -gt 0 ]]; then | |
| echo "One or more shards reported FAIL." | |
| exit 1 | |
| fi | |