Repository navigation
90 lines (82 loc) · 2.79 KB
/
Copy pathci.yml
File metadata and controls
90 lines (82 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Checks every PR and push to dev, the main branch. Make the jobs below required
# checks on dev.
#
# This workflow deliberately has no schedule: GitHub auto-disables scheduled
# workflows after 60 days without repo activity, which also stops their
# push/pull_request triggers. Nightly jobs live in compat.yml instead.
name: CI
on:
pull_request:
push:
branches: [dev]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
hacs:
name: HACS validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: hacs/action@22.5.0
with:
category: integration
ignore: brands
hassfest:
name: Hassfest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
# Runs the same image as home-assistant/actions/hassfest (latest rules),
# but lets our pyhive-integration pin differ from core hive's. See CLAUDE.md.
- run: python3 .github/scripts/hassfest.py
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v10.3.3
- name: Ruff version from requirements_test.txt
id: ruff
run: echo "spec=$(grep '^ruff==' requirements_test.txt)" >> "$GITHUB_OUTPUT"
- run: uvx "${{ steps.ruff.outputs.spec }}" check --output-format=github .
- run: uvx "${{ steps.ruff.outputs.spec }}" format --check .
test:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v10.3.3
with:
python-version: "3.14"
activate-environment: true
enable-cache: true
cache-dependency-glob: |
requirements_test.txt
custom_components/hive/manifest.json
- name: Install dependencies
run: uv pip install -r requirements_test.txt $(jq -r '.requirements[]' custom_components/hive/manifest.json)
- run: python -m pytest
enable-scheduled-workflows:
# Self-heal: switch nightly/weekly workflows back on if GitHub disabled them
# for inactivity, so they don't stay off unnoticed like they did in 2026.
name: Re-enable scheduled workflows
if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
actions: write
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
steps:
- run: |
for workflow in compat.yml stale.yml pyhive_bump.yml; do
state=$(gh api "repos/$GH_REPO/actions/workflows/$workflow" --jq .state)
if [ "$state" = "disabled_inactivity" ]; then
gh workflow enable "$workflow"
echo "::notice::Re-enabled $workflow (was disabled for inactivity)"
fi
done