diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..2b122b3 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,21 @@ +--- +name: pre-commit + +on: + pull_request: + +permissions: + contents: read + +jobs: + pre-commit: + name: Run pre-commit hooks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.x" + - uses: pre-commit/action@v3.0.1 + env: + SKIP: circleci-validate diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..229cfcc --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,45 @@ +--- +repos: + - repo: https://github.com/adrienverge/yamllint + rev: v1.38.0 + hooks: + - id: yamllint + types: [yaml] + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + + # DISABLED (hadolint-docker): pre-commit failed — uncomment to re-enable +# - repo: https://github.com/hadolint/hadolint +# rev: v2.14.0 +# hooks: +# # DISABLED (hadolint-docker): uncomment this block to re-enable +# # - id: hadolint-docker +# # types: [dockerfile] +# # args: [--ignore, DL3007, --ignore, DL3025, --ignore, DL3062] + + - repo: local + hooks: + - id: circleci-validate + name: CircleCI pipeline validation + language: system + entry: bash -c 'for file in "$@"; do circleci config validate --org-slug github/lightspeedretail "$file"; done' -- + pass_filenames: true + files: ^.circleci/.*\.yml$ + + - id: helm-lint + name: Helm lint (api-server chart) + language: system + files: ^api-server/charts/.*\.ya?ml$ + pass_filenames: false + entry: helm lint api-server/charts + + - id: helm-template + name: Helm template (api-server chart, all envs) + language: script + files: ^api-server/charts/.*\.ya?ml$ + pass_filenames: false + entry: api-server/scripts/check-helm-charts.sh diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 0000000..5034c51 --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,17 @@ +--- +extends: default + +ignore: | + node_modules/ + vendor/ + charts/ + +rules: + line-length: + max: 120 + level: warning + ignore: + - .circleci/*.yml + braces: + min-spaces-inside: 0 + max-spaces-inside: 2