Skip to content

Home Assistant CI #2932

Home Assistant CI

Home Assistant CI #2932

---
name: Home Assistant CI
# yamllint disable-line rule:truthy
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: 0 12 * * *
jobs:
yamllint:
name: 🧹 YAML Lint
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v4.1.7
- name: 🚀 Run yamllint
uses: frenck/action-yamllint@v1.5.0
with:
config: ./.yamllint
remarklint:
name: 🧹 Remark Lint
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v4.1.7
- name: 🚀 Run Remark Lint
uses: "docker://pipelinecomponents/remark-lint:latest"
continue-on-error: true
with:
args: "remark --no-stdout --color --frail --use preset-lint-recommended ."
version_env:
name: Get Installed Version for Testing
runs-on: ubuntu-latest
needs: [yamllint]
outputs:
current_version: ${{ steps.currentver.outputs.current_version }}
steps:
- name: Get config from GitHub
uses: actions/checkout@v4.1.7
- name: Get Installed Version from .HA_VERSION
id: currentver
run: |
HA_VERSION=$(<.HA_VERSION)
echo $HA_VERSION
echo "current_version=$HA_VERSION" >> $GITHUB_OUTPUT
home_assistant:
name: "🏠 Home Assistant Core ${{ matrix.version }} Configuration Check"
runs-on: ubuntu-latest
needs: [yamllint, remarklint, version_env]
outputs:
config_location: ${{ steps.currlocn.outputs.config_location }}
strategy:
fail-fast: false
matrix:
version: [ "${{needs.version_env.outputs.current_version}}", "stable", "beta" ]
steps:
- name: ⤵️ Check out configuration from GitHub
uses: actions/checkout@v4.1.7
- name: ➕ Create dummy files
run: |
touch home-assistant.log
- name: Move files
run: |
(mkdir config && mv -f -v * config && cd config) || true
- name: Config Locn
id: currlocn
run: |
cd config
echo $PWD
echo "{config_location}={$PWD}" >> $GITHUB_OUTPUT
- name: 🚀 Run Home Assistant Configuration Check
uses: frenck/action-home-assistant@v1.4
with:
path: "./config"
secrets: fake_secrets.yaml
version: "${{ matrix.version }}"
esphome:
runs-on: ubuntu-latest
needs: [yamllint]
steps:
- name: ⤵️ Check out configuration from GitHub
uses: actions/checkout@v4.1.7
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install esphome
pip list
esphome version
- name: Copy secrets stub into configuration folder
run: cp ./esphome/secrets_fake.yaml ./esphome/secrets.yaml
- name: Run esphome on all files
# yamllint disable rule:line-length
run: |
for file in $(find ./config/esphome -type f -name "*.yaml" -maxdepth 1 -not -name "secrets.yaml"); do esphome "${file}" config; done