feat: add ultra-fast pre-commit hooks pipeline
This commit is contained in:
parent
0ae8afa145
commit
087a65fdb8
|
|
@ -0,0 +1,37 @@
|
|||
name: Homelab Pipeline Pre-Commit
|
||||
description: Ultra-fast quality gates for homelab configurations.
|
||||
execution_params:
|
||||
default_language_version: python3.13
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.9.6
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [--fix, --exit-non-zero-on-fix]
|
||||
- id: ruff-format
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-shellcheck
|
||||
rev: v0.10.0
|
||||
hooks:
|
||||
- id: shellcheck
|
||||
|
||||
- repo: https://github.com/hashicorp/terraform-fmt
|
||||
rev: v1.7.0
|
||||
hooks:
|
||||
- id: terraform_fmt
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-terraform-validate
|
||||
rev: v1.7.0
|
||||
hooks:
|
||||
- id: terraform_validate
|
||||
|
||||
- repo: https://github.com/ansible/ansible-lint
|
||||
rev: v6.32.0
|
||||
hooks:
|
||||
- id: ansible-lint
|
||||
|
||||
- repo: https://github.com/gitleaks/gitleaks
|
||||
rev: v8.18.1
|
||||
hooks:
|
||||
- id: gitleaks
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Installation script for homelab pre-commit hooks
|
||||
# To be run manually once or integrated into a bootstrap process.
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "${REPO_ROOT}"
|
||||
|
||||
if ! command -v pre-commit >/dev/null 2>&1; then
|
||||
printf 'Installing pre-commit...\n'
|
||||
pip install --user pre-commit
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
fi
|
||||
|
||||
printf 'Installing git hooks...\n'
|
||||
pre-commit install
|
||||
|
||||
printf 'Running initial check on staged files...\n'
|
||||
pre-commit run --all-files
|
||||
|
||||
printf 'Pre-commit hooks installed and verified.\n'
|
||||
Loading…
Reference in New Issue