mirror of
https://github.com/randybb/esphome-configs.git
synced 2026-10-14 08:35:12 +02:00
Install yamllint with pip instead of ibiqlik/action-yamllint, which expects it preinstalled like on GitHub's runner, and pip install with --ignore-installed so pip doesn't try to remove Debian's packages.
61 lines
1.8 KiB
YAML
61 lines
1.8 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
|
|
echo "Validating $f..."
|
|
esphome config "$f"
|
|
done
|