51 lines
1.2 KiB
YAML
51 lines
1.2 KiB
YAML
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 .
|