Files
homelab/.gitea/workflows/lint.yaml
T
forust 8e72e0a920
lint / prettier (push) Failing after 2s
lint / ruff (push) Successful in 2s
lint / yamllint (push) Successful in 3s
lint / hadolint (push) Failing after 2s
validate / yaml (push) Successful in 2s
validate / k8s (push) Failing after 1s
ci: run lint and validate tools locally
2026-06-30 00:14:14 +02:00

94 lines
2.3 KiB
YAML

name: lint
on:
push:
branches:
- "**"
pull_request:
workflow_dispatch:
jobs:
prettier:
runs-on: [self-hosted, linux, arch, homelab]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check formatting with Prettier
shell: bash
run: |
mapfile -t prettier_files < <(
git ls-files \
| grep -E '\.(md|json|ya?ml|html|css)$' \
| grep -Ev '^(\.docs/|\.zed/|errorpages/html/|homepages/(forust_files|xdfnx_files)/)'
)
if [ "${#prettier_files[@]}" -eq 0 ]; then
echo "No Prettier-managed files found."
exit 0
fi
command -v prettier >/dev/null 2>&1 || {
echo "prettier is required on PATH but was not found."
exit 1
}
prettier --check --ignore-unknown "${prettier_files[@]}"
ruff:
runs-on: [self-hosted, linux, arch, homelab]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Lint Python with Ruff
shell: bash
run: |
command -v ruff >/dev/null 2>&1 || {
echo "ruff is required on PATH but was not found."
exit 1
}
ruff check .
yamllint:
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 .
hadolint:
runs-on: [self-hosted, linux, arch, homelab]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Lint Dockerfiles
shell: bash
run: |
mapfile -t dockerfiles < <(
git ls-files ':(glob)**/Dockerfile' ':(glob)**/Dockerfile.*'
)
if [ "${#dockerfiles[@]}" -eq 0 ]; then
echo "No Dockerfiles found."
exit 0
fi
command -v hadolint >/dev/null 2>&1 || {
echo "hadolint is required on PATH but was not found."
exit 1
}
hadolint -c .hadolint.yaml "${dockerfiles[@]}"