Files
esphome-configs/.github/workflows/ci.yml
T
randy 70d1079ccd
CI / YAML lint (push) Successful in 7s
CI / ESPHome config validation (push) Successful in 1m0s
CI: skip configs whose included package sets a Zephyr platform (XIAO STM32C5 nodes)
2026-12-04 11:54:56 +01:00

65 lines
2.2 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
jobs:
yamllint:
name: YAML lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Get changed YAML files
id: changed
uses: tj-actions/changed-files@v47
with:
files: "**/*.yaml"
# yamllint straight from pip: Gitea's runner image doesn't ship it like GitHub's does
- name: Lint changed YAML files
if: steps.changed.outputs.any_changed == 'true'
env:
PIP_BREAK_SYSTEM_PACKAGES: "1"
run: |
pip install --ignore-installed yamllint
yamllint -c .yamllint.yml -f parsable ${{ steps.changed.outputs.all_changed_files }}
validate:
name: ESPHome config validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Get changed device configs
id: changed
uses: tj-actions/changed-files@v47
with:
files: "mcu-*.yaml"
- name: Install ESPHome (dev)
if: steps.changed.outputs.any_changed == 'true'
# Gitea's runner image marks the system Python as externally managed (PEP 668)
# and has Debian packages pip can't uninstall (pyparsing), so don't touch them
env:
PIP_BREAK_SYSTEM_PACKAGES: "1"
run: pip install --ignore-installed git+https://github.com/esphome/esphome.git@dev
- name: Prepare secrets
if: steps.changed.outputs.any_changed == 'true'
run: cp secrets.yaml.default secrets.yaml
- name: Validate changed configs
if: steps.changed.outputs.any_changed == 'true'
run: |
for f in ${{ steps.changed.outputs.all_changed_files }}; do
# Zephyr RTOS platforms need the esphomeplatformzephyr fork, upstream doesn't know them yet
# (the platform key may also come from an !include'd package, e.g. common/xiao_stm32c5_canopen.yaml)
files="$f $(grep -oE '!include [^ ]+' "$f" | cut -d' ' -f2)"
if grep -qsE '^(nrf|stm32|nxp|renesas|silabs):' $files; then echo "Skipping $f (zephyr fork)"; continue; fi
echo "Validating $f..."
esphome config "$f"
done