Add lint workflow
This commit is contained in:
51
.gitea/workflows/lint.yml
Normal file
51
.gitea/workflows/lint.yml
Normal file
@@ -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 .
|
||||
21
.yamllint.yml
Normal file
21
.yamllint.yml
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user