Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
85 changes: 51 additions & 34 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,52 @@
{
"name": "custom-components/readme",
"image": "mcr.microsoft.com/devcontainers/python:3.12",
"postCreateCommand": "scripts/setup",
"forwardPorts": [
8123
],
"portsAttributes": {
"8123": {
"label": "Home Assistant",
"onAutoForward": "notify"
}
},
"customizations": {
"vscode": {
"extensions": [
"ms-python.python"
],
"settings": {
"files.eol": "\n",
"editor.tabSize": 4,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.formatOnType": false,
"files.trimTrailingWhitespace": true,
"python.formatting.provider": "black",
"python.analysis.typeCheckingMode": "basic",
"python.analysis.autoImportCompletions": true,
"python.defaultInterpreterPath": "/usr/local/bin/python"
}
}
},
"remoteUser": "vscode",
"features": {}
{
"name": "custom-components/readme",
"image": "mcr.microsoft.com/devcontainers/python:3.13",
"postCreateCommand": "scripts/setup",
"forwardPorts": [
8123
],
"portsAttributes": {
"8123": {
"label": "Home Assistant",
"onAutoForward": "notify"
}
},
"customizations": {
"vscode": {
"extensions": [
"charliermarsh.ruff",
"github.vscode-pull-request-github",
"ms-python.python",
"ms-python.vscode-pylance",
"ryanluker.vscode-coverage-gutters"
],
"settings": {
"files.eol": "\n",
"editor.tabSize": 4,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.formatOnType": false,
"files.trimTrailingWhitespace": true,
"python.analysis.typeCheckingMode": "basic",
"python.analysis.autoImportCompletions": true,
"python.defaultInterpreterPath": "/usr/local/bin/python",
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
}
}
}
},
"remoteUser": "vscode",
"features": {
"ghcr.io/devcontainers/features/python:1": {
"version": "3.13.2"
},
"ghcr.io/devcontainers-extra/features/apt-packages:1": {
"packages": [
"ffmpeg",
"libturbojpeg0",
"libpcap-dev"
]
}
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
ignore:
# Dependabot should not update Home Assistant as that should match the homeassistant key in hacs.json
- dependency-name: "homeassistant"
39 changes: 39 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
change-template: "- #$NUMBER $TITLE @$AUTHOR"
sort-direction: ascending
include-labels:
- "beta"
- "breaking-change"
- "bugfix"
- "dependencies"
- "enhancement"
- "feature"
- "refactor"
categories:
- title: "💥 Breaking changes"
label: "breaking-change"

- title: "🚧 Beta changes"
label: "beta"
collapse-after: 1

- title: "✨ New features"
label: "feature"

- title: "🚀 Performance"
label: "enhancement"

- title: "🔨 Refactor"
label: "refactor"

- title: "🐛 Bug fixes"
label: "bugfix"

- title: "⬆️ Dependency updates"
label: "dependencies"
collapse-after: 1

template: |
$CHANGES

***
If you are using this integration, please consider enabling [Home Assistant usage analytics](https://www.home-assistant.io/integrations/analytics/#usage-analytics).
34 changes: 34 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Lint

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"

permissions: {}

jobs:
ruff:
name: "Ruff"
runs-on: "ubuntu-latest"
steps:
- name: Checkout the repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.13"
cache: "pip"

- name: Install requirements
run: python3 -m pip install -r requirements.txt

- name: Lint
run: python3 -m ruff check .

- name: Format
run: python3 -m ruff format . --check
27 changes: 27 additions & 0 deletions .github/workflows/release-drafter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release Drafter

on:
push:
branches:
- main

jobs:
release-drafter:
name: Release Drafter
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/[email protected]

- name: Get next version
id: version
run: |
echo "version=$(jq .version -r ./custom_components/healthchecksio/manifest.json)" >> $GITHUB_OUTPUT

- name: Run Release Drafter
uses: release-drafter/[email protected]
with:
tag: ${{ steps.version.outputs.version }}
name: ${{ steps.version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82 changes: 38 additions & 44 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,61 +1,55 @@
name: Release Workflow
name: Publish

on:
release:
types:
- published
push:
branches:
- main

concurrency:
group: publish-${{ github.ref }}
cancel-in-progress: true

permissions: {}

jobs:
release:
name: Release
release_zip_file:
name: Publish readme zip file asset
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: 📥 Checkout the repository
uses: actions/checkout@v2
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: 🔢 Get release version
id: version
uses: home-assistant/actions/helpers/version@master
- name: 🛠️ Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.13"

- name: ℹ️ Get integration information
id: information
run: |
name=$(find custom_components/ -type d -maxdepth 1 | tail -n 1 | cut -d "/" -f2)
echo "::set-output name=name::$name"
- name: 🔢 Get version
if: ${{ github.event_name == 'release' }}
id: version
uses: home-assistant/actions/helpers/version@a19f5f4e08ef2786e4604a948f62addd937a6bc9 # master

- name: 🖊️ Set version number
# Pack the readme dir as a zip and upload to the release
- name: 📦 ZIP readme dir
run: |
sed -i '/INTEGRATION_VERSION = /c\INTEGRATION_VERSION = "${{ steps.version.outputs.version }}"' \
"${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/const.py"
jq '.version = "${{ steps.version.outputs.version }}"' \
"${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/manifest.json" > tmp \
&& mv -f tmp "${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/manifest.json"
cd ${{ github.workspace }}/custom_components/readme
zip readme.zip -r ./

- name: 👀 Validate data
run: |
if ! grep -q 'INTEGRATION_VERSION = "${{ steps.version.outputs.version }}"' ${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/const.py; then
echo "The version in custom_components/${{ steps.information.outputs.name }}/const.py was not correct"
cat ${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/const.py | grep INTEGRATION_VERSION
exit 1
fi
manifestversion=$(jq -r '.version' ${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/manifest.json)
if [ "$manifestversion" != "${{ steps.version.outputs.version }}" ]; then
echo "The version in custom_components/${{ steps.information.outputs.name }}/manifest.json was not correct"
echo "$manifestversion"
exit 1
fi

- name: 📦 Create zip file for the integration
run: |
cd "${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}"
zip ${{ steps.information.outputs.name }}.zip -r ./
- name: 📤 Upload zip to action
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: ${{ github.event_name == 'push' }}
with:
name: readme.zip
path: ${{ github.workspace }}/custom_components/readme/readme.zip
retention-days: 7

- name: 📤 Upload the zip file as a release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 📤 Upload zip to release
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
if: ${{ github.event_name == 'release' }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: "${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/${{ steps.information.outputs.name }}.zip"
asset_name: ${{ steps.information.outputs.name }}.zip
asset_content_type: application/zip
files: ${{ github.workspace }}/custom_components/readme/readme.zip
38 changes: 18 additions & 20 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,35 @@
name: Validate


on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 0 * * *"

permissions: {}

jobs:
validate-hassfest:
hassfest: # https://developers.home-assistant.io/blog/2020/04/16/hassfest
name: Hassfest validation
runs-on: ubuntu-latest
name: With hassfest
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Checkout the repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Hassfest validation
uses: "home-assistant/actions/hassfest@master"
- name: Run hassfest validation
uses: home-assistant/actions/hassfest@a19f5f4e08ef2786e4604a948f62addd937a6bc9 # master

validate-hacs:
hacs: # https://github.com/hacs/action
name: HACS validation
runs-on: ubuntu-latest
name: With HACS Action
steps:
- name: Check out repository
uses: actions/checkout@v2

- name: HACS validation
uses: hacs/action@main
with:
category: integration
comment: false
ignore: brands
- name: Run HACS validation
uses: hacs/action@d556e736723344f83838d08488c983a15381059a # 22.5.0
with:
category: integration
ignore: brands
Loading