52 lines
1.3 KiB
YAML
52 lines
1.3 KiB
YAML
name: validate
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "**"
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
yaml:
|
|
runs-on: [self-hosted, linux, arch, homelab]
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Lint YAML syntax
|
|
shell: bash
|
|
run: |
|
|
command -v yamllint >/dev/null 2>&1 || {
|
|
echo "yamllint is required on PATH but was not found."
|
|
exit 1
|
|
}
|
|
|
|
yamllint -c .yamllint .
|
|
|
|
k8s:
|
|
runs-on: [self-hosted, linux, arch, homelab]
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Validate Kubernetes manifests
|
|
shell: bash
|
|
run: |
|
|
mapfile -t manifests < <(
|
|
git ls-files ':(glob)**/k8s/**/*.yaml' ':(glob)**/k8s/**/*.yml' \
|
|
| grep -Ev '(^|/)(kustomization\.ya?ml|.*\.example\.ya?ml|.*values\.ya?ml|patch-.*\.ya?ml)$'
|
|
)
|
|
|
|
if [ "${#manifests[@]}" -eq 0 ]; then
|
|
echo "No Kubernetes manifests found."
|
|
exit 0
|
|
fi
|
|
|
|
command -v kubeconform >/dev/null 2>&1 || {
|
|
echo "kubeconform is required on PATH but was not found."
|
|
exit 1
|
|
}
|
|
|
|
kubeconform -strict -ignore-missing-schemas -summary "${manifests[@]}"
|