Files
ha-gronod-addons/.gitea/workflows/validate.yml
T
gronod e6b6968b5e
Validate add-ons / YAML and layout (pull_request) Failing after 26s
Validate add-ons / emby-mcp Go (pull_request) Failing after 57s
Validate add-ons / openai-codex-proxy (pull_request) Successful in 1m47s
Validate add-ons / n95-mqtt-bridge pin and upstream tests (pull_request) Failing after 44s
ci: add Gitea Actions validation for add-ons
Run YAML/config checks, emby-mcp gofmt/vet/build/test, proxy
entrypoint syntax, and n95 upstream pin + go test on push and PR
to develop/main.
2026-09-25 20:17:08 +00:00

133 lines
4.3 KiB
YAML

name: Validate add-ons
on:
push:
branches: [develop, main]
pull_request:
branches: [develop, main]
workflow_dispatch:
jobs:
yaml:
name: YAML and layout
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Parse add-on YAML
run: |
set -euo pipefail
python3 - <<'PY'
import pathlib, sys
try:
import yaml
except ImportError:
import subprocess
subprocess.check_call([sys.executable, "-m", "pip", "install", "--quiet", "pyyaml"])
import yaml
root = pathlib.Path(".")
files = [root / "repository.yaml"]
for addon in sorted(p for p in root.iterdir() if p.is_dir() and (p / "config.yaml").exists()):
files.append(addon / "config.yaml")
by = addon / "build.yaml"
if by.exists():
files.append(by)
failed = False
required = ("name", "version", "slug", "arch")
for f in files:
print(f"parse {f}")
with f.open() as fh:
data = yaml.safe_load(fh)
if f.name == "config.yaml":
missing = [k for k in required if k not in (data or {})]
if missing:
print(f"ERROR {f}: missing {missing}")
failed = True
version = (addon_version := (f.parent / "VERSION"))
if version.exists():
disk = version.read_text().strip()
cfg = str(data.get("version", "")).strip()
if disk != cfg:
print(f"ERROR {f}: version {cfg!r} != VERSION {disk!r}")
failed = True
if failed:
sys.exit(1)
print("ok")
PY
emby-mcp:
name: emby-mcp Go
runs-on: ubuntu-latest
defaults:
run:
working-directory: emby-mcp
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: emby-mcp/go.mod
cache-dependency-path: emby-mcp/go.sum
- name: gofmt
run: |
dirty="$(gofmt -l .)"
if [ -n "$dirty" ]; then
echo "gofmt needed:"
echo "$dirty"
exit 1
fi
- name: go vet
run: go vet ./...
- name: go build
run: go build ./...
- name: go test
run: go test ./...
timeout-minutes: 8
openai-codex-proxy:
name: openai-codex-proxy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
- name: syntax-check entrypoint
run: node --check openai-codex-proxy/rootfs/entrypoint.js
n95-mqtt-bridge:
name: n95-mqtt-bridge pin and upstream tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Verify upstream pin
id: pin
run: |
set -euo pipefail
ref="$(awk -F'"' '/UPSTREAM_REF:/ {print $2; exit}' n95-mqtt-bridge/build.yaml)"
commit="$(awk -F'"' '/UPSTREAM_COMMIT:/ {print $2; exit}' n95-mqtt-bridge/build.yaml)"
df_ref="$(awk -F= '/^ARG UPSTREAM_REF=/ {print $2; exit}' n95-mqtt-bridge/Dockerfile)"
df_commit="$(awk -F= '/^ARG UPSTREAM_COMMIT=/ {print $2; exit}' n95-mqtt-bridge/Dockerfile)"
echo "build.yaml ref=$ref commit=$commit"
echo "Dockerfile ref=$df_ref commit=$df_commit"
test -n "$ref" && test -n "$commit"
test "$ref" = "$df_ref"
test "$commit" = "$df_commit"
echo "ref=$ref" >> "$GITHUB_OUTPUT"
echo "commit=$commit" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@v5
with:
go-version: "1.27.1"
- name: Test pinned upstream
run: |
set -euo pipefail
git clone --depth 1 --branch "${{ steps.pin.outputs.ref }}" \
https://git.i3omb.com/gronod/ha-n95-local-control.git /tmp/n95
cd /tmp/n95
got="$(git rev-parse HEAD)"
want="${{ steps.pin.outputs.commit }}"
if [ "$got" != "$want" ]; then
echo "tag ${{ steps.pin.outputs.ref }} is $got, build.yaml wants $want"
exit 1
fi
go test ./...
timeout-minutes: 8