Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/issue-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Configuration for github/issue-labeler - body-based labels
# See: https://github.com/github/issue-labeler
# Uses regex patterns to match PR/issue body content
# Note: [xX] matches both lowercase and uppercase X in checkboxes
---
bug:
- '\[[xX]\]\s*[Bb]ugfix'

enhancement:
- '\[[xX]\]\s*[Nn]ew [Ff]eature'

breaking-change:
- '\[[xX]\]\s*[Bb]reaking [Cc]hange'

code-quality:
- '\[[xX]\]\s*[Cc]ode [Qq]uality'
54 changes: 54 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Configuration for actions/labeler - file-based labels
# See: https://github.com/actions/labeler
---
pre-commit:
- changed-files:
- any-glob-to-any-file: '.pre-commit-config.yaml'

javascript:
- changed-files:
- any-glob-to-any-file:
- '*.ts'
- '*.js'
- 'ts/**/*'
- '.eslintrc.cjs'
- 'tsconfig.json'
- 'rollup.config.js'
- 'package.json'
- 'package-lock.json'
- 'yarn.lock'

python:
- changed-files:
- any-glob-to-any-file:
- '*.py'
- 'custom_components/**/*.py'
- 'tests/**/*.py'
- 'tox.ini'
- 'requirements*.txt'
- 'pyproject.toml'
- 'Pipfile'
- 'Pipfile.lock'

github_actions:
- changed-files:
- any-glob-to-any-file: '.github/workflows/**/*'

dependencies:
- changed-files:
- any-glob-to-any-file:
- 'requirements*.txt'
- 'pyproject.toml'
- 'Pipfile'
- 'Pipfile.lock'
- 'package.json'
- 'package-lock.json'
- 'yarn.lock'
- '.pre-commit-config.yaml'
Comment thread
raman325 marked this conversation as resolved.

documentation:
- changed-files:
- any-glob-to-any-file:
- '*.md'
- '**/*.md'
- 'docs/**/*'
61 changes: 4 additions & 57 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,10 @@ name-template: "$RESOLVED_VERSION"
tag-template: "$RESOLVED_VERSION"
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
sort-direction: ascending
autolabeler:
- label: 'pre-commit'
files:
- '.pre-commit-config.yaml'
- label: 'javascript'
files:
- '*.ts'
- '*.js'
- 'ts/**/*'
- '.eslintrc.cjs'
- 'tsconfig.json'
- 'rollup.config.js'
- 'package.json'
- 'package-lock.json'
- 'yarn.lock'
- label: 'python'
files:
- '*.py'
- 'custom_components/**/*.py'
- 'tests/**/*.py'
- 'tox.ini'
- 'requirements*.txt'
- 'pyproject.toml'
- 'Pipfile'
- 'Pipfile.lock'
- label: 'github_actions'
files:
- '.github/workflows/**/*'
- label: 'dependencies'
files:
- 'requirements*.txt'
- 'pyproject.toml'
- 'Pipfile'
- 'Pipfile.lock'
- 'package.json'
- 'package-lock.json'
- 'yarn.lock'
- '.pre-commit-config.yaml'
body:
- '/\[x\] dependency/i'
- label: 'documentation'
files:
- '*.md'
- '**/*.md'
- 'docs/**/*'
- label: 'bug'
body:
- '/\[x\] bugfix/i'
- label: 'enhancement'
body:
- '/\[x\] new feature/i'
- label: 'breaking-change'
body:
- '/\[x\] breaking change/i'
- label: 'code-quality'
body:
- '/\[x\] code quality/i'

# Note: Autolabeling is handled by .github/workflows/labeler.yaml
# using actions/labeler (file-based) and github/issue-labeler (body-based)
# These support sync-labels to remove labels when patterns no longer match.

version-resolver:
major:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,8 @@
---
name: Frontend
name: Frontend Checks

# yamllint disable-line rule:truthy
on:
push:
branches: [main]
paths:
- "**.js"
- "**.ts"
- "ts/**"
- ".eslintrc.cjs"
- "package.json"
- "rollup.config.js"
- "tsconfig.json"
- "vitest.config.ts"
- ".github/workflows/frontend.yaml"
pull_request:
branches: [main]
paths:
- "**.js"
- "**.ts"
- "ts/**"
- ".eslintrc.cjs"
- "package.json"
- "rollup.config.js"
- "tsconfig.json"
- "vitest.config.ts"
- ".github/workflows/frontend.yaml"
workflow_call:

jobs:
lint-and-build:
Expand Down Expand Up @@ -66,7 +42,7 @@ jobs:
script: |
core.setFailed('Repo is dirty after build! Run yarn build locally before pushing changes.')

test:
vitest:
name: Vitest
runs-on: ubuntu-latest
steps:
Expand Down
73 changes: 39 additions & 34 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,46 @@ name: Integration
on:
push:
branches: [main]
paths:
- "**.py"
- ".github/workflows/integration.yaml"
pull_request:
branches: [main]
paths:
- "**.py"
- "requirements*.txt"
- "pyproject.toml"
- ".github/workflows/integration.yaml"

jobs:
test:
name: Pytest
check-changes:
name: Check Changes
runs-on: ubuntu-latest
outputs:
python: ${{ steps.filter.outputs.python }}
frontend: ${{ steps.filter.outputs.frontend }}
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
- uses: dorny/paths-filter@v3
id: filter
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install libudev-dev
- name: Install dependencies
run: uv pip install --system -r requirements_dev.txt
- name: Run tests and generate coverage report
# CI-only deps installed separately to keep requirements_dev.txt lightweight
run: |
uv pip install --system pytest-cov pytest-github-actions-annotate-failures
pytest ./tests/ --cov=custom_components/lock_code_manager/ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: python
files: coverage.xml
filters: |
python:
- '**.py'
- 'requirements*.txt'
- 'pyproject.toml'
- '.github/workflows/integration.yaml'
- '.github/workflows/python-checks.yml'
frontend:
- '**.js'
- '**.ts'
- 'ts/**'
- '.eslintrc.cjs'
- 'package.json'
- 'rollup.config.js'
- 'tsconfig.json'
- 'vitest.config.ts'
- '.github/workflows/integration.yaml'
- '.github/workflows/frontend-checks.yml'

python:
name: Python
needs: check-changes
if: needs.check-changes.outputs.python == 'true'
uses: ./.github/workflows/python-checks.yml
secrets: inherit

hacs:
name: HACS
Expand All @@ -64,3 +62,10 @@ jobs:
steps:
- uses: actions/checkout@v6
- uses: home-assistant/actions/hassfest@master

frontend:
name: Frontend
needs: check-changes
if: needs.check-changes.outputs.frontend == 'true'
uses: ./.github/workflows/frontend-checks.yml
secrets: inherit
34 changes: 34 additions & 0 deletions .github/workflows/labeler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Labeler

# yamllint disable-line rule:truthy
on:
pull_request_target:
types:
- edited
- opened
- reopened
- synchronize

permissions:
contents: read
pull-requests: write

jobs:
label-files:
name: Label by Files
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
with:
sync-labels: true

label-body:
name: Label by Body
runs-on: ubuntu-latest
steps:
- uses: github/issue-labeler@v3
with:
configuration-path: .github/issue-labeler.yml
enable-versioned-regex: 0
sync-labels: 1
85 changes: 85 additions & 0 deletions .github/workflows/python-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
name: Python Checks

on:
workflow_call:

env:
# Target Python version for coverage and static analysis
TARGET_PYTHON: "3.13"
# Additional Python versions to test (JSON array, can be empty: '[]')
OTHER_PYTHON_VERSIONS: '["3.14"]'

jobs:
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
target-python: ${{ env.TARGET_PYTHON }}
python-versions: ${{ steps.versions.outputs.matrix }}
steps:
- name: Build version matrix
id: versions
run: |
# Combine target with other versions into a JSON array
MATRIX=$(echo '${{ env.OTHER_PYTHON_VERSIONS }}' | jq -c '. + ["${{ env.TARGET_PYTHON }}"] | unique | sort')
echo "matrix=$MATRIX" >> "$GITHUB_OUTPUT"

ruff:
name: Ruff
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ needs.setup.outputs.target-python }}
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install dependencies
run: uv pip install --system ruff
- name: Check formatting
run: ruff format --check .
- name: Check linting
run: ruff check .

pytest:
name: Pytest (${{ matrix.python-version }})
needs: setup
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJSON(needs.setup.outputs.python-versions) }}
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install libudev-dev
- name: Install dependencies
run: uv pip install --system -r requirements_dev.txt
- name: Run tests and generate coverage report
# CI-only deps installed separately to keep requirements_dev.txt lightweight
run: |
uv pip install --system pytest-cov pytest-github-actions-annotate-failures
pytest ./tests/ --cov=custom_components/lock_code_manager/ --cov-report=xml
- name: Upload coverage to Codecov
if: matrix.python-version == needs.setup.outputs.target-python
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: python
files: coverage.xml
Loading
Loading