Skip to content

CI

CI #3

Workflow file for this run

name: CI
on:
push:
branches:
- main
- dev
tags-ignore:
- "**"
pull_request:
workflow_dispatch:
env:
#CACHE_VERSION: 11
#UV_CACHE_VERSION: 1
#MYPY_CACHE_VERSION: 9
#HA_SHORT_VERSION: "2025.2"
DEFAULT_PYTHON: "3.12"
jobs:
info:
name: Collect information
outputs:
python_cache_key: ${{ steps.generate_python_cache_key.outputs.key }}
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4.2.2
- name: Generate Python venv restore key
id: generate_python_cache_key
run: |
echo "key=venv-${{
hashFiles('requirements.test.txt') }}-${{
hashFiles('requirements.txt') }}" >> $GITHUB_OUTPUT
homeassistant:
name: HA validation
runs-on: ubuntu-latest
steps:
- name: HACS
uses: hacs/action@main
with:
category: integration
- name: Check out code
uses: actions/checkout@v4
- name: hassfest
uses: home-assistant/actions/hassfest@master
prepare:
name: Prepare
runs-on: ubuntu-latest
needs:
- info
steps:
- name: Check out code
uses: actions/checkout@v4.2.2
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v5.3.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Restore Python virtual environment
id: cache-venv
uses: actions/cache@v4.2.0
with:
path: venv
key: >-
${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ needs.info.outputs.python_cache_key }}
- name: Create Python virtual environment
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
python -m venv venv
. venv/bin/activate
python --version
pip install -r requirements.txt
pip install -r requirements.test.txt
mypy:
name: Check mypy
runs-on: ubuntu-latest
needs:
- info
- prepare
steps:
- name: Check out code
uses: actions/checkout@v4.2.2
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v5.3.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Restore Python ${{ env.DEFAULT_PYTHON }} virtual environment
id: cache-venv
uses: actions/cache/restore@v4.2.0
with:
path: venv
fail-on-cache-miss: true
key: >-
${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ needs.info.outputs.python_cache_key }}
- name: Register mypy problem matcher
run: |
echo "::add-matcher::.github/workflows/matchers/mypy.json"
- name: Run mypy
run: |
. venv/bin/activate
python --version
mypy custom_components tests