190 lines
6.2 KiB
YAML
190 lines
6.2 KiB
YAML
name: ESP32 Build & Quality Check
|
|
|
|
on:
|
|
push:
|
|
branches: [ '*' ]
|
|
release:
|
|
types: [ published ]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
# ============================================================================
|
|
# Code Quality & Linting
|
|
# ============================================================================
|
|
quality-check:
|
|
name: 'Code Quality'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Arduino CLI
|
|
uses: arduino/setup-arduino-cli@v2
|
|
|
|
- name: Cache Arduino data
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/
|
|
key: ${{ runner.os }}-arduino-${{ hashFiles('**/libraries/**') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-arduino-
|
|
|
|
- name: Install ESP32 core
|
|
run: |
|
|
arduino-cli core update-index
|
|
arduino-cli core install esp32:esp32
|
|
|
|
- name: Arduino Lint
|
|
uses: arduino/arduino-lint-action@v1
|
|
with:
|
|
path: ${{ github.workspace }}
|
|
compliance: strict
|
|
library-manager: update
|
|
verbose: true
|
|
|
|
# ============================================================================
|
|
# Compilation Test
|
|
# ============================================================================
|
|
compile-test:
|
|
name: 'Compile Example Sketch'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
example:
|
|
- "examples/dshot300/dshot300.ino"
|
|
- "examples/command_manager/command_manager.ino"
|
|
build-flags:
|
|
- name: "Release"
|
|
flags: "Automated Build"
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Arduino CLI
|
|
uses: arduino/setup-arduino-cli@v2
|
|
|
|
- name: Cache Arduino data
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/
|
|
key: ${{ runner.os }}-arduino-${{ hashFiles('**/libraries/**') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-arduino-
|
|
|
|
- name: Install ESP32 core
|
|
run: |
|
|
arduino-cli core update-index
|
|
arduino-cli core install esp32:esp32
|
|
|
|
- name: Install Repo as Library
|
|
run: |
|
|
mkdir -p $HOME/Arduino/libraries
|
|
ln -s $PWD $HOME/Arduino/libraries/DShotRMT
|
|
|
|
- name: Compile Example (${{ matrix.build-flags.name }})
|
|
run: |
|
|
arduino-cli compile --fqbn esp32:esp32:esp32 ${{ matrix.example }}
|
|
|
|
# ============================================================================
|
|
# Static Code Analysis
|
|
# ============================================================================
|
|
static-analysis:
|
|
name: 'Static Analysis'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Arduino CLI
|
|
uses: arduino/setup-arduino-cli@v2
|
|
|
|
- name: Cache Arduino data
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/
|
|
key: ${{ runner.os }}-arduino-${{ hashFiles('**/libraries/**') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-arduino-
|
|
|
|
- name: Install ESP32 core
|
|
run: |
|
|
arduino-cli core update-index
|
|
arduino-cli core install esp32:esp32
|
|
|
|
- name: Install Cppcheck
|
|
run: sudo apt-get update && sudo apt-get install -y cppcheck
|
|
|
|
- name: Run Cppcheck
|
|
run: |
|
|
cppcheck --enable=warning,performance \
|
|
--std=c++17 \
|
|
--language=c++ \
|
|
--platform=unix32 \
|
|
--inline-suppr \
|
|
./DShotRMT.cpp ./DShotRMT.h \
|
|
./DShotCommandManager.cpp ./DShotCommandManager.h
|
|
|
|
# ============================================================================
|
|
# Build Status Report
|
|
# ============================================================================
|
|
build-summary:
|
|
name: 'Build Summary'
|
|
runs-on: ubuntu-latest
|
|
if: always()
|
|
needs: [quality-check, compile-test, static-analysis]
|
|
|
|
steps:
|
|
- name: Create Build Summary
|
|
run: |
|
|
echo "# 🔧 DShotRMT Build Report" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "| Check | Status | Details |" >> $GITHUB_STEP_SUMMARY
|
|
echo "|-------|--------|---------|" >> $GITHUB_STEP_SUMMARY
|
|
|
|
# Quality Check Status
|
|
if [[ "${{ needs.quality-check.result }}" == "success" ]]; then
|
|
echo "| 📋 Quality Check | ✅ Passed | Arduino Lint completed successfully |" >> $GITHUB_STEP_SUMMARY
|
|
else
|
|
echo "| 📋 Quality Check | ❌ Failed | Check Arduino Lint report |" >> $GITHUB_STEP_SUMMARY
|
|
fi
|
|
|
|
# Compile Test Status
|
|
if [[ "${{ needs.compile-test.result }}" == "success" ]]; then
|
|
echo "| 🔨 Compilation | ✅ Passed | All examples compiled successfully |" >> $GITHUB_STEP_SUMMARY
|
|
else
|
|
echo "| 🔨 Compilation | ❌ Failed | Compilation errors detected |" >> $GITHUB_STEP_SUMMARY
|
|
fi
|
|
|
|
# Static Analysis Status
|
|
if [[ "${{ needs.static-analysis.result }}" == "success" ]]; then
|
|
echo "| 🔍 Static Analysis | ✅ Passed | No critical issues found |" >> $GITHUB_STEP_SUMMARY
|
|
else
|
|
echo "| 🔍 Static Analysis | ❌ Failed | Issues detected by CPPCheck |" >> $GITHUB_STEP_SUMMARY
|
|
fi
|
|
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
|
|
# Overall Status
|
|
if [[ "${{ needs.quality-check.result }}" == "success" &&
|
|
"${{ needs.compile-test.result }}" == "success" &&
|
|
"${{ needs.static-analysis.result }}" == "success" ]]; then
|
|
echo "## 🎉 All Checks Passed!" >> $GITHUB_STEP_SUMMARY
|
|
echo "Your DShotRMT library is ready for deployment." >> $GITHUB_STEP_SUMMARY
|
|
else
|
|
echo "## ⚠️ Action Required" >> $GITHUB_STEP_SUMMARY
|
|
echo "Please review the failed checks and address any issues."
|
|
fi
|