From a740ccec1c9f2b5593a2bb2b873dfe3720d971f6 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 7 Jun 2021 22:28:29 +0200 Subject: [PATCH] ci: add python file checks to ci --- .drone.jsonnet | 22 ++++++++++++++++++++++ .drone.yml | 18 +++++++++++++++++- molecule/centos7/tests/test_default.py | 3 --- 3 files changed, 39 insertions(+), 4 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 274c880..a6069f2 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 @@ -131,6 +147,6 @@ depends_on: --- kind: signature -hmac: b90472d1b824f04c176b46218d5d4274697eec11d8262223eb0d156e9ae73abc +hmac: 773afb4c5c687880a6d2a5df0c84cb1166e26e5af3a301b00e4dfc7d00994a19 ... diff --git a/molecule/centos7/tests/test_default.py b/molecule/centos7/tests/test_default.py index b9868c7..f42c49d 100644 --- a/molecule/centos7/tests/test_default.py +++ b/molecule/centos7/tests/test_default.py @@ -1,10 +1,7 @@ import os -import warnings import testinfra.utils.ansible_runner -warnings.filterwarnings("ignore", category=DeprecationWarning) - testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( os.environ["MOLECULE_INVENTORY_FILE"] ).get_hosts("all")