Initial commit
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: github-actions
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
@@ -0,0 +1,66 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
tags-ignore:
|
||||
- "v*"
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Validate JSON
|
||||
run: |
|
||||
python -m json.tool hacs.json > /dev/null
|
||||
python -m json.tool repository.json > /dev/null
|
||||
python -m json.tool custom_components/elegoo_spaghetti_detection/manifest.json > /dev/null
|
||||
python -m json.tool custom_components/elegoo_spaghetti_detection/translations/en.json > /dev/null
|
||||
|
||||
- name: Validate Python syntax
|
||||
run: python -m compileall custom_components/elegoo_spaghetti_detection addon/rootfs/app
|
||||
|
||||
- name: Validate YAML
|
||||
run: |
|
||||
python -m pip install pyyaml
|
||||
python - <<'PY'
|
||||
from pathlib import Path
|
||||
import yaml
|
||||
|
||||
class Loader(yaml.SafeLoader):
|
||||
pass
|
||||
|
||||
def unknown_constructor(loader, tag_suffix, node):
|
||||
if isinstance(node, yaml.MappingNode):
|
||||
return loader.construct_mapping(node)
|
||||
if isinstance(node, yaml.SequenceNode):
|
||||
return loader.construct_sequence(node)
|
||||
return loader.construct_scalar(node)
|
||||
|
||||
Loader.add_multi_constructor("!", unknown_constructor)
|
||||
|
||||
paths = [
|
||||
Path("docker-compose.yaml"),
|
||||
Path("addon/config.yaml"),
|
||||
Path("custom_components/elegoo_spaghetti_detection/services.yaml"),
|
||||
Path(".github/workflows/ci.yaml"),
|
||||
Path(".github/workflows/hassfest.yaml"),
|
||||
Path(".github/workflows/validate.yaml"),
|
||||
Path(".github/dependabot.yml"),
|
||||
*Path("examples").glob("*.yaml"),
|
||||
]
|
||||
|
||||
for path in sorted(paths):
|
||||
with path.open("r", encoding="utf-8") as handle:
|
||||
yaml.load(handle, Loader=Loader)
|
||||
PY
|
||||
@@ -0,0 +1,20 @@
|
||||
name: Validate with hassfest
|
||||
|
||||
on:
|
||||
push:
|
||||
tags-ignore:
|
||||
- "v*"
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: home-assistant/actions/hassfest@master
|
||||
@@ -0,0 +1,23 @@
|
||||
name: Validate
|
||||
|
||||
on:
|
||||
push:
|
||||
tags-ignore:
|
||||
- "v*"
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
validate-hacs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- name: HACS validation
|
||||
uses: hacs/action@main
|
||||
with:
|
||||
category: integration
|
||||
Reference in New Issue
Block a user