Skip to content

chore: add AGENTS.md guidelines for AI assistants #365

chore: add AGENTS.md guidelines for AI assistants

chore: add AGENTS.md guidelines for AI assistants #365

Workflow file for this run

name: ESPHome Full Build CI
on: [push, pull_request]
jobs:
# Step 1 : List all .yaml files
list-files:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v7
- name: 📄 Build matrix
id: set-matrix
run: |
# Liste les .yaml à la racine, exclut secrets.yaml
FILES=$(ls *.yaml | grep -v "secrets.yaml" | jq -R -s -c 'split("\n")[:-1]')
echo "matrix=$FILES" >> "$GITHUB_OUTPUT"
# Step 2 : Check Coverage
coverage:
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v7
- name: 🧪 Run Coverage Check
env:
TERM: xterm
run: ./tools/check_build_coverage.sh
# Step 3 : Build & Validate Documentation
docs:
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: 🐍 Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.x"
- name: 📦 Install dependencies
run: |
python -m pip install --upgrade pip
sed -i "/esphome/d" requirements.txt
pip install -r requirements.txt
- name: 📄 Check Documentation Coverage
run: ./tools/check_documentation_coverage.sh
- name: 🏗️ MkDocs Build
run: |
# The --strict flag causes the build to fail if any warnings or broken links are detected
mkdocs build --strict
# Step 4 : Compile files
build:
needs: list-files
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
file: ${{ fromJson(needs.list-files.outputs.matrix) }}
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v7
- name: 🔄 Point packages at the PR head repo & ref
env:
HEAD_REPO_URL: ${{ github.event.pull_request.head.repo.clone_url || format('https://github.com/{0}.git', github.repository) }}
HEAD_REF: ${{ github.event.pull_request.head.ref || github.ref_name }}
run: |
echo "Rewriting package source in ${{ matrix.file }} → $HEAD_REPO_URL @ $HEAD_REF"
sed -i \
-e "s@url: https://github.com/hacf-fr/Solar-Router-for-ESPHome/\?@url: ${HEAD_REPO_URL}@g" \
-e "s@ref: main@ref: ${HEAD_REF}@g" \
"${{ matrix.file }}"
- name: 🤫 Create dummy secrets.yaml
run: |
cat > secrets.yaml << 'EOF'
wifi_ssid: "ssid"
wifi_password: "password"
api_encryption_key: "/TQQDQvCLeJ1RfoihmoIUjSk+PtvOF9oUCoOGI53ie8="
proxy_api_encryption_key: "/TQQDQvCLeJ1RfoihmoIUjSk+PtvOF9oUCoOGI53ie8="
solar_water_heater_api_encryption_key: "/TQQDQvCLeJ1RfoihmoIUjSk+PtvOF9oUCoOGI53ie8="
wt32_eth01_api_encryption_key: "/TQQDQvCLeJ1RfoihmoIUjSk+PtvOF9oUCoOGI53ie8="
solar_router_ota_password: "/TQQDQvCLeJ1RfoihmoIUjSk+PtvOF9oUCoOGI53ie8="
solar_water_heater_ota_password: "/TQQDQvCLeJ1RfoihmoIUjSk+PtvOF9oUCoOGI53ie8="
wt32_eth01_ota_password: "/TQQDQvCLeJ1RfoihmoIUjSk+PtvOF9oUCoOGI53ie8="
EOF
- name: 🔍 Get ESPHome version
id: esphome-version
run: |
pip install esphome
VERSION=$(esphome version | awk '{print $2}')
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "ESPHome version: $VERSION"
- name: 💾 Cache PlatformIO & ESPHome (shared)
uses: actions/cache@v6
with:
path: |
~/.cache/pip
~/.platformio
.esphome
key: ${{ runner.os }}-esphome-${{ steps.esphome-version.outputs.version }}
restore-keys: |
${{ runner.os }}-esphome-${{ steps.esphome-version.outputs.version }}
${{ runner.os }}-esphome-
- name: 🚀 Build ESPHome Binary
uses: esphome/build-action@v7
with:
yaml-file: ${{ matrix.file }}
version: latest
# Décommente si tu veux récupérer les firmwares
# - name: 📦 Upload firmware
# uses: actions/upload-artifact@v4
# with:
# name: ${{ matrix.file }}-firmware
# path: .esphome/build/${{ matrix.file }}/**/firmware.bin
# if-no-files-found: error