From f51ad1cdd20374cddbdd16900b31f3e7c4842aa0 Mon Sep 17 00:00:00 2001 From: Patrik Polakovič Date: Nov 15 2021 07:47:44 +0000 Subject: Add files for Zuul to use --- diff --git a/.flake8 b/.flake8 index 2cdb126..0019b7c 100644 --- a/.flake8 +++ b/.flake8 @@ -1,3 +1,3 @@ [flake8] ignore = E128, W503 -max-line-length = 120 +max-line-length = 100 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c8cc69e..51ccaab 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,18 +1,38 @@ -# See https://pre-commit.com for more information -# See https://pre-commit.com/hooks.html for more hooks +--- repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.4.0 + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: stable hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: check-yaml - - id: check-added-large-files - - id: check-ast - - id: check-merge-conflict - - id: check-toml - - id: debug-statements -- repo: https://gitlab.com/PyCQA/flake8 - rev: master + - id: check-yaml + - id: check-added-large-files + - id: check-toml + - id: debug-statements + + - repo: https://gitlab.com/PyCQA/flake8 + rev: stable hooks: - - id: flake8 + - id: flake8 + + - repo: https://github.com/psf/black + rev: stable + hooks: + - id: black + args: + - --diff + - --check + + - repo: https://github.com/adrienverge/yamllint + rev: stable + hooks: + - id: yamllint + alias: yamllint-non-ansible + name: yamllint (non-Ansible) + files: '^[^(ci/)].*\.ya?ml$' + - id: yamllint + alias: yamllint-ansible + name: yamllint (Ansible) + files: '^ci/.*\.ya?ml$' + args: + - -c + - .yamllint-ansible.yaml +--- diff --git a/.yamllint-ansible.yaml b/.yamllint-ansible.yaml new file mode 100644 index 0000000..a31ec10 --- /dev/null +++ b/.yamllint-ansible.yaml @@ -0,0 +1,6 @@ +--- +extends: default +rules: + truthy: + allowed-values: ['true', 'false', 'yes', 'no'] +--- diff --git a/.zuul.yaml b/.zuul.yaml new file mode 100644 index 0000000..8fdc85d --- /dev/null +++ b/.zuul.yaml @@ -0,0 +1,11 @@ +--- +- job: + name: pre-commit + run: ci/pre-commit.yaml + nodeset: fedora-35-vm + +- project: + check: + jobs: + - pre-commit +--- diff --git a/ci/pre-commit.yaml b/ci/pre-commit.yaml new file mode 100644 index 0000000..ec872b7 --- /dev/null +++ b/ci/pre-commit.yaml @@ -0,0 +1,21 @@ +--- +- hosts: all + + tasks: + - name: List project directory on the test system + command: "ls -al {{ ansible_user_dir }}/{{ zuul.project.src_dir }}" + + - name: install pip + become: true + package: + name: python3-pip + state: present + + - name: install pre-commit + command: pip install pre-commit --user + + - name: run pre-commit + command: + chdir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}" + cmd: pre-commit run --all +--- diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..2096b4c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,2 @@ +[tool.black] + line_length = 100