214 lines
7.3 KiB
YAML
214 lines
7.3 KiB
YAML
---
|
||
name: Validate ESPHome
|
||
|
||
permissions:
|
||
contents: read
|
||
pull-requests: read
|
||
|
||
on: # yamllint disable-line rule:truthy
|
||
push:
|
||
paths:
|
||
- "**/*.yml"
|
||
- "**/*.yaml"
|
||
- "**/*.h"
|
||
- "**/*.cpp"
|
||
- "**/*.c"
|
||
- "**/*.py"
|
||
|
||
pull_request:
|
||
paths:
|
||
- "**/*.yml"
|
||
- "**/*.yaml"
|
||
- "**/*.h"
|
||
- "**/*.cpp"
|
||
- "**/*.c"
|
||
- "**/*.py"
|
||
|
||
workflow_dispatch:
|
||
inputs:
|
||
skip_dev:
|
||
description: 'Skip dev testing (test only on latest)'
|
||
required: false
|
||
default: false
|
||
type: boolean
|
||
|
||
concurrency:
|
||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||
cancel-in-progress: true
|
||
|
||
jobs:
|
||
code_scan:
|
||
name: Code scan (YAML)
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Checkout Code
|
||
uses: actions/checkout@main
|
||
- name: Setup Python
|
||
uses: actions/setup-python@main
|
||
with:
|
||
python-version: '3.11'
|
||
- name: Install Yamllint
|
||
run: pip install yamllint
|
||
- name: Validate YAML files
|
||
run: find . -name "*.yaml" -exec yamllint -c ./.rules/yamllint.yml {} +
|
||
|
||
# Foundation Testing - Latest only (fast, stable)
|
||
build_core:
|
||
name: "🏗️ Core (${{ matrix.framework }})"
|
||
needs: code_scan
|
||
runs-on: ubuntu-latest
|
||
strategy:
|
||
fail-fast: true
|
||
max-parallel: 2
|
||
matrix:
|
||
framework: [idf, ard]
|
||
steps:
|
||
- uses: actions/checkout@main
|
||
- name: Build Core
|
||
uses: esphome/build-action@main
|
||
with:
|
||
yaml-file: ".test/esphome_${{ matrix.framework }}_core.yaml"
|
||
version: latest
|
||
|
||
build_basic:
|
||
name: "📦 Basic (${{ matrix.framework }})"
|
||
needs: build_core
|
||
if: success()
|
||
runs-on: ubuntu-latest
|
||
strategy:
|
||
fail-fast: true
|
||
max-parallel: 2
|
||
matrix:
|
||
framework: [idf, ard]
|
||
steps:
|
||
- uses: actions/checkout@main
|
||
- name: Build Basic
|
||
uses: esphome/build-action@main
|
||
with:
|
||
yaml-file: ".test/esphome_${{ matrix.framework }}_basic.yaml"
|
||
version: latest
|
||
|
||
build_hardware:
|
||
name: "🔌 ${{ matrix.target }} (${{ matrix.framework }})"
|
||
needs: [build_core, build_basic]
|
||
if: success()
|
||
runs-on: ubuntu-latest
|
||
strategy:
|
||
fail-fast: false
|
||
max-parallel: 4
|
||
matrix:
|
||
framework: [idf, ard]
|
||
target: [hw_relays, hw_speaker, hw_vibration]
|
||
steps:
|
||
- uses: actions/checkout@main
|
||
- name: Build Hardware
|
||
uses: esphome/build-action@main
|
||
with:
|
||
yaml-file: ".test/esphome_${{ matrix.framework }}_${{ matrix.target }}.yaml"
|
||
version: latest
|
||
|
||
build_features:
|
||
name: "⚡ ${{ matrix.target }} (${{ matrix.framework }})"
|
||
needs: [build_core, build_basic, build_hardware]
|
||
if: success()
|
||
runs-on: ubuntu-latest
|
||
strategy:
|
||
fail-fast: false
|
||
max-parallel: 4
|
||
matrix:
|
||
framework: [idf, ard]
|
||
target: [ble_proxy, media_player]
|
||
steps:
|
||
- uses: actions/checkout@main
|
||
- name: Build Features
|
||
uses: esphome/build-action@main
|
||
with:
|
||
yaml-file: ".test/esphome_${{ matrix.framework }}_${{ matrix.target }}.yaml"
|
||
version: latest
|
||
|
||
# Comprehensive Testing - Only after everything works
|
||
# Test complete system on latest (stable) + dev (bleeding edge)
|
||
build_comprehensive:
|
||
name: "🌍 Complete (${{ matrix.framework }}-${{ matrix.version }})"
|
||
needs: [build_core, build_basic, build_hardware, build_features]
|
||
if: success() && !inputs.skip_dev
|
||
runs-on: ubuntu-latest
|
||
strategy:
|
||
fail-fast: false
|
||
max-parallel: 4
|
||
matrix:
|
||
framework: [idf, ard]
|
||
version: [latest, dev] # Only two versions: stable + cutting-edge
|
||
steps:
|
||
- uses: actions/checkout@main
|
||
- name: Build Complete System
|
||
uses: esphome/build-action@main
|
||
with:
|
||
yaml-file: ".test/esphome_${{ matrix.framework }}_basic.yaml"
|
||
version: ${{ matrix.version }}
|
||
|
||
build_summary:
|
||
name: "📊 Summary"
|
||
needs: [build_core, build_basic, build_hardware, build_features, build_comprehensive]
|
||
if: always()
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Results
|
||
run: |
|
||
echo "## 📋 Build Summary" >> $GITHUB_STEP_SUMMARY
|
||
echo "" >> $GITHUB_STEP_SUMMARY
|
||
echo "**Strategy: Foundation on stable, validation on stable + dev**" >> $GITHUB_STEP_SUMMARY
|
||
echo "**Build Order: Core → Basic → Hardware → Features → Complete**" >> $GITHUB_STEP_SUMMARY
|
||
echo "" >> $GITHUB_STEP_SUMMARY
|
||
|
||
# Build counts
|
||
FOUNDATION_BUILDS=14 # 2+2+6+4
|
||
COMPREHENSIVE_BUILDS=4 # 2 frameworks × 2 versions
|
||
|
||
if [ "${{ needs.build_comprehensive.result }}" == "skipped" ]; then
|
||
TOTAL=$FOUNDATION_BUILDS
|
||
echo "**Builds run:** $TOTAL (foundation only)" >> $GITHUB_STEP_SUMMARY
|
||
else
|
||
TOTAL=$((FOUNDATION_BUILDS + COMPREHENSIVE_BUILDS))
|
||
echo "**Builds run:** $TOTAL ($FOUNDATION_BUILDS foundation + $COMPREHENSIVE_BUILDS comprehensive)" >> $GITHUB_STEP_SUMMARY
|
||
fi
|
||
|
||
echo "**Efficiency:** $((100 - (TOTAL * 100 / 42)))% fewer builds than full matrix" >> $GITHUB_STEP_SUMMARY
|
||
echo "" >> $GITHUB_STEP_SUMMARY
|
||
|
||
# Results
|
||
echo "| Stage | Result |" >> $GITHUB_STEP_SUMMARY
|
||
echo "|-------|--------|" >> $GITHUB_STEP_SUMMARY
|
||
echo "| 🏗️ Foundation | ${{ needs.build_core.result }} |" >> $GITHUB_STEP_SUMMARY
|
||
echo "| 📦 Basic (Most Common) | ${{ needs.build_basic.result }} |" >> $GITHUB_STEP_SUMMARY
|
||
echo "| 🔌 Hardware | ${{ needs.build_hardware.result }} |" >> $GITHUB_STEP_SUMMARY
|
||
echo "| ⚡ Features | ${{ needs.build_features.result }} |" >> $GITHUB_STEP_SUMMARY
|
||
echo "| 🌍 Multi-version | ${{ needs.build_comprehensive.result }} |" >> $GITHUB_STEP_SUMMARY
|
||
|
||
# Final status
|
||
if [ "${{ needs.build_core.result }}" != "success" ]; then
|
||
echo "" >> $GITHUB_STEP_SUMMARY
|
||
echo "❌ **Core foundation failed** - Fix core components first" >> $GITHUB_STEP_SUMMARY
|
||
exit 1
|
||
elif [ "${{ needs.build_basic.result }}" != "success" ]; then
|
||
echo "" >> $GITHUB_STEP_SUMMARY
|
||
echo "❌ **Basic build failed** - Most common configuration has issues" >> $GITHUB_STEP_SUMMARY
|
||
exit 1
|
||
elif [ "${{ needs.build_hardware.result }}" != "success" ]; then
|
||
echo "" >> $GITHUB_STEP_SUMMARY
|
||
echo "❌ **Hardware builds failed** - Individual components have issues" >> $GITHUB_STEP_SUMMARY
|
||
exit 1
|
||
elif [ "${{ needs.build_features.result }}" != "success" ]; then
|
||
echo "" >> $GITHUB_STEP_SUMMARY
|
||
echo "❌ **Feature builds failed** - Advanced features have issues" >> $GITHUB_STEP_SUMMARY
|
||
exit 1
|
||
elif [ "${{ needs.build_comprehensive.result }}" == "failure" ]; then
|
||
echo "" >> $GITHUB_STEP_SUMMARY
|
||
echo "⚠️ **Multi-version testing failed** - Works on latest, issues with dev" >> $GITHUB_STEP_SUMMARY
|
||
exit 1
|
||
else
|
||
echo "" >> $GITHUB_STEP_SUMMARY
|
||
echo "✅ **All builds passed!** Ready for production 🚀" >> $GITHUB_STEP_SUMMARY
|
||
fi
|
||
...
|