From 6ff7a7e3b4ef8e6c021220cee2da31232b4390c8 Mon Sep 17 00:00:00 2001 From: Anton Vakhrushev Date: Fri, 28 Nov 2025 18:27:34 +0300 Subject: [PATCH] Add lint workflow --- .gitea/workflows/lint.yml | 51 +++++++++++++++++++++++++++++++++++++++ .yamllint.yml | 21 ++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 .gitea/workflows/lint.yml create mode 100644 .yamllint.yml diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml new file mode 100644 index 0000000..25749d3 --- /dev/null +++ b/.gitea/workflows/lint.yml @@ -0,0 +1,51 @@ +name: Linting + +on: + push + +jobs: + yamllint: + name: YAML Lint + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install yamllint + run: pip install yamllint + + - name: Run yamllint + run: yamllint . --format colored + + ansible-lint: + name: Ansible Lint + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies + run: pip install ansible ansible-lint + + # Создаем пустой vault password file если он указан в конфиге, но отсутствует + - name: Fix vault issue + run: | + if grep -q "vault_password_file" ansible.cfg && [ ! -f ansible-vault-password-file ]; then + echo "Creating empty vault password file for CI..." + echo "foobar" > ansible-vault-password-file + fi + + - name: Run ansible-lint + run: ansible-lint . diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 0000000..9119b52 --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,21 @@ +extends: default + +rules: + # Правила, требуемые ansible-lint + comments: + min-spaces-from-content: 1 + comments-indentation: false + braces: + max-spaces-inside: 1 + octal-values: + forbid-implicit-octal: true + forbid-explicit-octal: true + + # Дополнительные настройки (опционально) + line-length: + max: 120 + allow-non-breakable-words: true + allow-non-breakable-inline-mappings: true + document-start: disable # Не требовать --- в начале файла + truthy: + level: warning