Skip to content

Commit bb134b6

Browse files
author
Ubuntu
committed
Merge upstream/main into fork (resolve valve.py conflict by taking upstream)
2 parents eab6538 + 544e75f commit bb134b6

54 files changed

Lines changed: 6162 additions & 2078 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer.json

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,52 @@
11
{
2-
"name": "sebr/bhyve-home-assistant",
3-
"image": "mcr.microsoft.com/vscode/devcontainers/python:0-3.11-bullseye",
4-
"postCreateCommand": "scripts/setup",
5-
"forwardPorts": [
6-
8123
7-
],
8-
"remoteEnv": {
9-
"TZ": "Australia/Sydney"
10-
},
11-
"portsAttributes": {
12-
"8123": {
13-
"label": "Home Assistant",
14-
"onAutoForward": "notify"
15-
}
16-
},
17-
"customizations": {
18-
"vscode": {
19-
"extensions": [
20-
"ms-python.python",
21-
"ms-python.vscode-pylance"
22-
],
23-
"settings": {
24-
"files.eol": "\n",
25-
"editor.tabSize": 4,
26-
"python.pythonPath": "/usr/bin/python3",
27-
"python.analysis.autoSearchPaths": false,
28-
"python.linting.pylintEnabled": true,
29-
"python.linting.enabled": true,
30-
"python.formatting.provider": "black",
31-
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
32-
"editor.formatOnPaste": false,
33-
"editor.formatOnSave": true,
34-
"editor.formatOnType": true,
35-
"files.trimTrailingWhitespace": true
36-
}
37-
}
38-
},
39-
"remoteUser": "vscode",
40-
"features": {
41-
"ghcr.io/devcontainers/features/rust:1": {
42-
43-
}
44-
}
2+
"name": "ludeeus/integration_blueprint",
3+
"image": "mcr.microsoft.com/devcontainers/python:3.13",
4+
"postCreateCommand": "scripts/setup",
5+
"forwardPorts": [
6+
8123
7+
],
8+
"portsAttributes": {
9+
"8123": {
10+
"label": "Home Assistant",
11+
"onAutoForward": "notify"
12+
}
13+
},
14+
"customizations": {
15+
"vscode": {
16+
"extensions": [
17+
"charliermarsh.ruff",
18+
"github.vscode-pull-request-github",
19+
"ms-python.python",
20+
"ms-python.vscode-pylance",
21+
"ryanluker.vscode-coverage-gutters"
22+
],
23+
"settings": {
24+
"files.eol": "\n",
25+
"editor.tabSize": 4,
26+
"editor.formatOnPaste": true,
27+
"editor.formatOnSave": true,
28+
"editor.formatOnType": false,
29+
"files.trimTrailingWhitespace": true,
30+
"python.analysis.typeCheckingMode": "basic",
31+
"python.analysis.autoImportCompletions": true,
32+
"python.defaultInterpreterPath": "/usr/local/bin/python",
33+
"[python]": {
34+
"editor.defaultFormatter": "charliermarsh.ruff"
35+
}
36+
}
37+
}
38+
},
39+
"remoteUser": "vscode",
40+
"features": {
41+
"ghcr.io/devcontainers-extra/features/apt-packages:1": {
42+
"packages": "ffmpeg,libturbojpeg0,libpcap-dev"
43+
},
44+
"ghcr.io/devcontainers/features/git:1": {}
45+
},
46+
"remoteEnv": {
47+
"PATH": "${containerEnv:PATH}:/home/vscode/.local/bin"
48+
},
49+
"mounts": [
50+
"source=claude-config,target=/home/vscode/.config/claude,type=volume"
51+
]
4552
}

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/dependabot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
2+
version: 2
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
9+
- package-ecosystem: "pip"
10+
directory: "/"
11+
schedule:
12+
interval: "weekly"
13+
ignore:
14+
# Dependabot should not update Home Assistant as that should match the homeassistant key in hacs.json
15+
- dependency-name: "homeassistant"

.github/workflows/hassfest.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: "Lint"
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
pull_request:
8+
branches:
9+
- "main"
10+
11+
jobs:
12+
lint:
13+
name: "Lint"
14+
runs-on: "ubuntu-latest"
15+
steps:
16+
- name: "Checkout the repository"
17+
uses: "actions/checkout@v6.0.2"
18+
19+
- name: "Set up Python"
20+
uses: actions/setup-python@v6.2.0
21+
with:
22+
python-version: "3.13"
23+
cache: "pip"
24+
25+
- name: "Install requirements"
26+
run: python3 -m pip install -r requirements.txt
27+
28+
- name: "Lint"
29+
run: python3 -m ruff check .
30+
31+
- name: "Format"
32+
run: python3 -m ruff format . --check

.github/workflows/release.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: "Release"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
draft:
7+
description: 'Create as draft release?'
8+
required: false
9+
default: false
10+
type: boolean
11+
custom_notes:
12+
description: 'Custom release notes (optional, prepended to auto-generated)'
13+
required: false
14+
type: string
15+
16+
jobs:
17+
release:
18+
name: "Create Release"
19+
runs-on: "ubuntu-latest"
20+
permissions:
21+
contents: write
22+
steps:
23+
- name: "Checkout the repository"
24+
uses: "actions/checkout@v6.0.2"
25+
with:
26+
fetch-depth: 0 # Fetch all history for release notes
27+
28+
- name: "Read version from manifest"
29+
id: version
30+
run: |
31+
# Extract version from manifest.json
32+
VERSION=$(jq -r '.version' custom_components/bhyve/manifest.json)
33+
echo "version=$VERSION" >> $GITHUB_OUTPUT
34+
echo "📦 Version: $VERSION"
35+
36+
# Validate version format (semver with optional prerelease)
37+
if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?$'; then
38+
echo "❌ ERROR: Invalid version format: $VERSION"
39+
echo "Expected format: X.Y.Z or X.Y.Z-suffix (e.g., 4.1.0 or 4.1.0-beta1)"
40+
exit 1
41+
fi
42+
43+
# Detect prerelease
44+
if [[ "$VERSION" =~ -beta|-alpha|-rc ]]; then
45+
echo "prerelease=true" >> $GITHUB_OUTPUT
46+
echo "🔶 This will be marked as a prerelease"
47+
else
48+
echo "prerelease=false" >> $GITHUB_OUTPUT
49+
echo "✅ This will be a stable release"
50+
fi
51+
52+
- name: "Check if tag exists"
53+
id: check_tag
54+
run: |
55+
if git rev-parse "${{ steps.version.outputs.version }}" >/dev/null 2>&1; then
56+
echo "❌ ERROR: Tag ${{ steps.version.outputs.version }} already exists"
57+
echo "Please update the version in manifest.json or delete the existing tag"
58+
exit 1
59+
fi
60+
echo "✅ Tag does not exist, safe to proceed"
61+
62+
- name: "Create and push tag"
63+
run: |
64+
git config user.name "github-actions[bot]"
65+
git config user.email "github-actions[bot]@users.noreply.github.com"
66+
git tag -a "${{ steps.version.outputs.version }}" -m "Release ${{ steps.version.outputs.version }}"
67+
git push origin "${{ steps.version.outputs.version }}"
68+
echo "🏷️ Created and pushed tag: ${{ steps.version.outputs.version }}"
69+
70+
- name: "Generate release notes"
71+
id: notes
72+
uses: actions/github-script@v8
73+
with:
74+
script: |
75+
const version = '${{ steps.version.outputs.version }}';
76+
77+
try {
78+
// Generate release notes using GitHub's API
79+
const { data } = await github.rest.repos.generateReleaseNotes({
80+
owner: context.repo.owner,
81+
repo: context.repo.repo,
82+
tag_name: version,
83+
});
84+
85+
// Optionally prepend custom notes
86+
const customNotes = `${{ inputs.custom_notes }}`.trim();
87+
let fullNotes = data.body;
88+
89+
if (customNotes) {
90+
fullNotes = customNotes + '\n\n---\n\n' + data.body;
91+
}
92+
93+
core.setOutput('notes', fullNotes);
94+
console.log('✅ Release notes generated successfully');
95+
} catch (error) {
96+
// Fallback if release notes generation fails
97+
console.log('⚠️ Could not generate release notes, using fallback');
98+
const customNotes = `${{ inputs.custom_notes }}`.trim();
99+
const fallbackNotes = customNotes || `Release ${version}`;
100+
core.setOutput('notes', fallbackNotes);
101+
}
102+
103+
- name: "Create ZIP file"
104+
run: |
105+
cd custom_components/bhyve
106+
zip -r ../../bhyve.zip ./ -x "*.pyc" -x "__pycache__/*" -x "*.pyo"
107+
cd ../..
108+
echo "📦 ZIP file created:"
109+
ls -lh bhyve.zip
110+
111+
- name: "Create GitHub Release"
112+
uses: softprops/action-gh-release@v2.6.1
113+
with:
114+
tag_name: ${{ steps.version.outputs.version }}
115+
name: Release ${{ steps.version.outputs.version }}
116+
body: ${{ steps.notes.outputs.notes }}
117+
files: bhyve.zip
118+
draft: ${{ inputs.draft }}
119+
prerelease: ${{ steps.version.outputs.prerelease }}
120+
121+
- name: "Release summary"
122+
run: |
123+
echo "## ✅ Release Created Successfully" >> $GITHUB_STEP_SUMMARY
124+
echo "" >> $GITHUB_STEP_SUMMARY
125+
echo "- **Version:** ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
126+
echo "- **Type:** ${{ steps.version.outputs.prerelease == 'true' && 'Prerelease' || 'Stable' }}" >> $GITHUB_STEP_SUMMARY
127+
echo "- **Draft:** ${{ inputs.draft }}" >> $GITHUB_STEP_SUMMARY
128+
echo "" >> $GITHUB_STEP_SUMMARY
129+
echo "[View Release](https://github.com/${{ github.repository }}/releases/tag/${{ steps.version.outputs.version }})" >> $GITHUB_STEP_SUMMARY

.github/workflows/test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: "Test"
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
pull_request:
8+
branches:
9+
- "main"
10+
11+
jobs:
12+
test:
13+
name: "Test"
14+
runs-on: "ubuntu-latest"
15+
16+
steps:
17+
- name: "Checkout the repository"
18+
uses: "actions/checkout@v6.0.2"
19+
20+
- name: "Set up Python"
21+
uses: "actions/setup-python@v6.2.0"
22+
with:
23+
python-version: "3.13"
24+
cache: "pip"
25+
26+
- name: "Install requirements"
27+
run: python3 -m pip install -r requirements.txt
28+
29+
- name: "Run tests"
30+
run: python3 -m pytest tests/ -v --tb=short

.github/workflows/validate.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "Validate"
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 0 * * *"
7+
push:
8+
branches:
9+
- "main"
10+
pull_request:
11+
branches:
12+
- "main"
13+
14+
jobs:
15+
hassfest: # https://developers.home-assistant.io/blog/2020/04/16/hassfest
16+
name: "Hassfest Validation"
17+
runs-on: "ubuntu-latest"
18+
steps:
19+
- name: "Checkout the repository"
20+
uses: "actions/checkout@v6.0.2"
21+
22+
- name: "Run hassfest validation"
23+
uses: "home-assistant/actions/hassfest@master"
24+
25+
hacs: # https://github.com/hacs/action
26+
name: "HACS Validation"
27+
runs-on: "ubuntu-latest"
28+
steps:
29+
- name: "Checkout the repository"
30+
uses: "actions/checkout@v6.0.2"
31+
32+
- name: "Run HACS validation"
33+
uses: "hacs/action@main"
34+
with:
35+
category: "integration"

.gitignore

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1-
.DS_Store
1+
# artifacts
22
__pycache__
3-
*.pyc
3+
.pytest*
4+
*.egg-info
5+
*/build/*
6+
*/dist/*
7+
.DS_Store
48

5-
tmp
9+
10+
# misc
11+
.coverage
12+
.vscode
13+
coverage.xml
14+
.ruff_cache
615

716
debug/[0-9]*
817
debug/sync
918

1019
# Home Assistant configuration
1120
config/*
12-
!config/configuration.yaml
21+
!config/configuration.yaml
22+
core
23+
.venv
24+
25+
.claude/settings.local.json

0 commit comments

Comments
 (0)