From 8e72e0a920e79ec756daa9f5b9d77dcc42ae2385 Mon Sep 17 00:00:00 2001 From: mr-forust Date: Tue, 30 Jun 2026 00:13:50 +0200 Subject: [PATCH] ci: run lint and validate tools locally --- .gitea/workflows/lint.yaml | 45 ++++++++++++++++++--------------- .gitea/workflows/validate.yaml | 25 +++++++++--------- .github/workflows/lint.yaml | 45 ++++++++++++++++++--------------- .github/workflows/validate.yaml | 25 +++++++++--------- 4 files changed, 72 insertions(+), 68 deletions(-) diff --git a/.gitea/workflows/lint.yaml b/.gitea/workflows/lint.yaml index 3b8e336..ca07230 100644 --- a/.gitea/workflows/lint.yaml +++ b/.gitea/workflows/lint.yaml @@ -28,11 +28,12 @@ jobs: exit 0 fi - docker run --rm \ - -v "$PWD:/work" \ - -w /work \ - node:22-alpine \ - sh -lc 'npx --yes prettier@3 --check --ignore-unknown "$@"' sh "${prettier_files[@]}" + 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] @@ -43,11 +44,12 @@ jobs: - name: Lint Python with Ruff shell: bash run: | - docker run --rm \ - -v "$PWD:/work" \ - -w /work \ - ghcr.io/astral-sh/ruff:latest \ - check . + 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] @@ -58,11 +60,12 @@ jobs: - name: Lint YAML syntax shell: bash run: | - docker run --rm \ - -v "$PWD:/work" \ - -w /work \ - cytopia/yamllint:latest \ - -c .yamllint . + 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] @@ -82,9 +85,9 @@ jobs: exit 0 fi - docker run --rm \ - -v "$PWD:/work" \ - -w /work \ - --entrypoint hadolint \ - hadolint/hadolint:latest-debian \ - -c .hadolint.yaml "${dockerfiles[@]}" + command -v hadolint >/dev/null 2>&1 || { + echo "hadolint is required on PATH but was not found." + exit 1 + } + + hadolint -c .hadolint.yaml "${dockerfiles[@]}" diff --git a/.gitea/workflows/validate.yaml b/.gitea/workflows/validate.yaml index f29dddd..9e717e0 100644 --- a/.gitea/workflows/validate.yaml +++ b/.gitea/workflows/validate.yaml @@ -17,11 +17,12 @@ jobs: - name: Lint YAML syntax shell: bash run: | - docker run --rm \ - -v "$PWD:/work" \ - -w /work \ - cytopia/yamllint:latest \ - -c .yamllint . + 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] @@ -42,11 +43,9 @@ jobs: exit 0 fi - docker run --rm \ - -v "$PWD:/work" \ - -w /work \ - ghcr.io/yannh/kubeconform:latest \ - -strict \ - -ignore-missing-schemas \ - -summary \ - "${manifests[@]}" + 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[@]}" diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 3b8e336..ca07230 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -28,11 +28,12 @@ jobs: exit 0 fi - docker run --rm \ - -v "$PWD:/work" \ - -w /work \ - node:22-alpine \ - sh -lc 'npx --yes prettier@3 --check --ignore-unknown "$@"' sh "${prettier_files[@]}" + 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] @@ -43,11 +44,12 @@ jobs: - name: Lint Python with Ruff shell: bash run: | - docker run --rm \ - -v "$PWD:/work" \ - -w /work \ - ghcr.io/astral-sh/ruff:latest \ - check . + 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] @@ -58,11 +60,12 @@ jobs: - name: Lint YAML syntax shell: bash run: | - docker run --rm \ - -v "$PWD:/work" \ - -w /work \ - cytopia/yamllint:latest \ - -c .yamllint . + 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] @@ -82,9 +85,9 @@ jobs: exit 0 fi - docker run --rm \ - -v "$PWD:/work" \ - -w /work \ - --entrypoint hadolint \ - hadolint/hadolint:latest-debian \ - -c .hadolint.yaml "${dockerfiles[@]}" + command -v hadolint >/dev/null 2>&1 || { + echo "hadolint is required on PATH but was not found." + exit 1 + } + + hadolint -c .hadolint.yaml "${dockerfiles[@]}" diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index f29dddd..9e717e0 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -17,11 +17,12 @@ jobs: - name: Lint YAML syntax shell: bash run: | - docker run --rm \ - -v "$PWD:/work" \ - -w /work \ - cytopia/yamllint:latest \ - -c .yamllint . + 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] @@ -42,11 +43,9 @@ jobs: exit 0 fi - docker run --rm \ - -v "$PWD:/work" \ - -w /work \ - ghcr.io/yannh/kubeconform:latest \ - -strict \ - -ignore-missing-schemas \ - -summary \ - "${manifests[@]}" + 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[@]}"