181 lines
6.8 KiB
YAML
181 lines
6.8 KiB
YAML
name: ESP32 Build & Quality Check
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
push:
|
|
branches: [ '*' ]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
# ============================================================================
|
|
# Code Quality & Linting
|
|
# ============================================================================
|
|
quality-check:
|
|
strategy:
|
|
matrix:
|
|
os-hosts:
|
|
- ubuntu-latest
|
|
- windows-latest
|
|
|
|
name: Arduino Lint Check
|
|
runs-on: ${{ matrix.os-hosts }}
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
|
|
- uses: arduino/setup-arduino-cli@v2
|
|
|
|
- name: Restore Arduino Core Cache
|
|
id: cache-core
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
path: |
|
|
~/.arduino15/packages
|
|
~/.arduino15/cache
|
|
key: arduino-core-${{ runner.os }}-esp32-v1
|
|
restore-keys: |
|
|
arduino-core-${{ runner.os }}-
|
|
|
|
- name: Install ESP32 Core
|
|
if: steps.cache-core.outputs.cache-hit != 'true'
|
|
run: |
|
|
arduino-cli core update-index --additional-urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
|
|
arduino-cli core install esp32:esp32
|
|
|
|
- name: Save Arduino Core Cache
|
|
if: always() && steps.cache-core.outputs.cache-hit != 'true'
|
|
uses: actions/cache/save@v4
|
|
with:
|
|
path: |
|
|
~/.arduino15/packages
|
|
~/.arduino15/cache
|
|
key: arduino-core-${{ runner.os }}-esp32-v1
|
|
|
|
- uses: arduino/arduino-lint-action@v2
|
|
with:
|
|
path: ${{ github.workspace }}
|
|
compliance: strict
|
|
library-manager: update
|
|
verbose: true
|
|
|
|
# ============================================================================
|
|
# Compilation Test
|
|
# ============================================================================
|
|
compile-test:
|
|
strategy:
|
|
matrix:
|
|
example:
|
|
- examples/dshot300/dshot300.ino
|
|
os-hosts:
|
|
- ubuntu-latest
|
|
- windows-latest
|
|
|
|
name: Compile Sketches
|
|
runs-on: ${{ matrix.os-hosts }}
|
|
timeout-minutes: 15
|
|
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
|
|
- uses: arduino/setup-arduino-cli@v2
|
|
|
|
- name: Restore Arduino Core & Libraries Cache
|
|
id: cache-all
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
path: |
|
|
~/.arduino15/packages
|
|
~/.arduino15/cache
|
|
~/Arduino/libraries
|
|
key: arduino-full-${{ runner.os }}-esp32-v1
|
|
restore-keys: |
|
|
arduino-full-${{ runner.os }}-
|
|
|
|
- name: Install ESP32 Core and Dependencies (Linux)
|
|
if: steps.cache-all.outputs.cache-hit != 'true' && runner.os == 'Linux'
|
|
run: |
|
|
arduino-cli core update-index --additional-urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
|
|
arduino-cli core install esp32:esp32
|
|
|
|
mkdir -p ~/Arduino/libraries
|
|
|
|
if [ ! -d ~/Arduino/libraries/ArduinoJson ]; then
|
|
git clone --depth=1 https://github.com/bblanchon/ArduinoJson.git ~/Arduino/libraries/ArduinoJson
|
|
fi
|
|
if [ ! -d ~/Arduino/libraries/ESPAsyncWebServer ]; then
|
|
git clone --depth=1 https://github.com/ESP32Async/ESPAsyncWebServer ~/Arduino/libraries/ESPAsyncWebServer
|
|
fi
|
|
if [ ! -d ~/Arduino/libraries/AsyncTCP ]; then
|
|
git clone --depth=1 https://github.com/ESP32Async/AsyncTCP ~/Arduino/libraries/AsyncTCP
|
|
fi
|
|
|
|
- name: Install ESP32 Core and Dependencies (Windows)
|
|
if: steps.cache-all.outputs.cache-hit != 'true' && runner.os == 'Windows'
|
|
run: |
|
|
arduino-cli core update-index --additional-urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
|
|
arduino-cli core install esp32:esp32
|
|
|
|
# PowerShell If-Bedingungen, um nur fehlende Bibliotheken zu klonen
|
|
if (-not (Test-Path -Path "$env:USERPROFILE/Arduino/libraries/ArduinoJson")) {
|
|
git clone --depth=1 https://github.com/bblanchon/ArduinoJson.git "$env:USERPROFILE/Arduino/libraries/ArduinoJson"
|
|
}
|
|
if (-not (Test-Path -Path "$env:USERPROFILE/Arduino/libraries/ESPAsyncWebServer")) {
|
|
git clone --depth=1 https://github.com/ESP32Async/ESPAsyncWebServer "$env:USERPROFILE/Arduino/libraries/ESPAsyncWebServer"
|
|
}
|
|
if (-not (Test-Path -Path "$env:USERPROFILE/Arduino/libraries/AsyncTCP")) {
|
|
git clone --depth=1 https://github.com/ESP32Async/AsyncTCP "$env:USERPROFILE/Arduino/libraries/AsyncTCP"
|
|
}
|
|
shell: pwsh
|
|
|
|
- name: Save Arduino Core & Libraries Cache
|
|
if: always() && steps.cache-all.outputs.cache-hit != 'true'
|
|
uses: actions/cache/save@v4
|
|
with:
|
|
path: |
|
|
~/.arduino15/packages
|
|
~/.arduino15/cache
|
|
~/Arduino/libraries
|
|
key: arduino-full-${{ runner.os }}-esp32-v1
|
|
|
|
- name: Compile Sketch
|
|
run: |
|
|
arduino-cli compile --fqbn esp32:esp32:esp32 --library ${{ github.workspace }} ${{ matrix.example }}
|
|
|
|
# ============================================================================
|
|
# Build Status Report
|
|
# ============================================================================
|
|
build-summary:
|
|
name: Build Summary
|
|
runs-on: ubuntu-latest
|
|
if: always()
|
|
needs: [quality-check, compile-test]
|
|
|
|
steps:
|
|
- name: Create Build Summary
|
|
run: |
|
|
echo "# 🔧 DShotRMT Build Report" >> $GITHUB_STEP_SUMMARY
|
|
echo "| Check | Status | Details |" >> $GITHUB_STEP_SUMMARY
|
|
echo "|-------|--------|---------|" >> $GITHUB_STEP_SUMMARY
|
|
|
|
[[ "${{ needs.quality-check.result }}" == "success" ]] \
|
|
&& echo "| 📋 Quality Check | ✅ Passed | Arduino Lint completed successfully |" >> $GITHUB_STEP_SUMMARY \
|
|
|| echo "| 📋 Quality Check | ❌ Failed | Check Arduino Lint report |" >> $GITHUB_STEP_SUMMARY
|
|
|
|
[[ "${{ needs.compile-test.result }}" == "success" ]] \
|
|
&& echo "| 🔨 Compilation | ✅ Passed | All examples compiled successfully |" >> $GITHUB_STEP_SUMMARY \
|
|
|| echo "| 🔨 Compilation | ❌ Failed | Compilation errors detected |" >> $GITHUB_STEP_SUMMARY
|
|
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
|
|
[[ "${{ needs.quality-check.result }}" == "success" && "${{ needs.compile-test.result }}" == "success" ]] \
|
|
&& echo "## 🎉 All Checks Passed!" >> $GITHUB_STEP_SUMMARY \
|
|
&& echo "Your DShotRMT library is ready for deployment." >> $GITHUB_STEP_SUMMARY \
|
|
|| echo "## ⚠️ Action Required" >> $GITHUB_STEP_SUMMARY \
|
|
&& echo "Please review the failed checks and address any issues." >> $GITHUB_STEP_SUMMARY
|
|
|