From cccbdda3dc1b9f5d7c8172e6799ba5ef6bab61b3 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 7 Jun 2021 22:28:59 +0200 Subject: [PATCH] ci: add python file checks to ci --- .drone.jsonnet | 22 ++++++++++++++++++++++ .drone.yml | 20 ++++++++++++++++++-- molecule/centos7/tests/test_default.py | 8 ++------ 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 7eb7c0b..ecf6cd6 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -13,6 +13,28 @@ local PipelineLinting = { 'ansible-later', ], }, + { + name: 'python-format', + image: 'python:3.9', + environment: { + PY_COLORS: 1, + }, + commands: [ + 'pip install -qq yapf', + 'yapf -dr ./', + ], + }, + { + name: 'python-flake8', + image: 'python:3.9', + environment: { + PY_COLORS: 1, + }, + commands: [ + 'pip install -qq flake8', + 'flake8', + ], + }, ], trigger: { ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'], diff --git a/.drone.yml b/.drone.yml index 736285d..34e50bc 100644 --- a/.drone.yml +++ b/.drone.yml @@ -12,6 +12,22 @@ steps: commands: - ansible-later +- name: python-format + image: python:3.9 + commands: + - pip install -qq yapf + - yapf -dr ./ + environment: + PY_COLORS: 1 + +- name: python-flake8 + image: python:3.9 + commands: + - pip install -qq flake8 + - flake8 + environment: + PY_COLORS: 1 + trigger: ref: - refs/heads/master @@ -35,7 +51,7 @@ workspace: steps: - name: ansible-molecule - image: thegeeklab/molecule:latest + image: thegeeklab/molecule:3 commands: - molecule test -s centos7 environment: @@ -131,6 +147,6 @@ depends_on: --- kind: signature -hmac: 5378b444f4da52d003a1be26b94a69577c2306d6ccad58150fd019954ae852f4 +hmac: e07a7f0edb5c259c1b17f33b40d353c57cf932cbf933f2033f634f79aa82ad80 ... diff --git a/molecule/centos7/tests/test_default.py b/molecule/centos7/tests/test_default.py index 380054c..13c52d4 100644 --- a/molecule/centos7/tests/test_default.py +++ b/molecule/centos7/tests/test_default.py @@ -2,13 +2,9 @@ import os import testinfra.utils.ansible_runner -import warnings - -warnings.filterwarnings("ignore", category=DeprecationWarning) - testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE'] -).get_hosts('all') + os.environ["MOLECULE_INVENTORY_FILE"] +).get_hosts("all") def test_renovate_running_and_enabled(host):