From 646f91894d2e8841237456f5d1035e76571546d5 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 7 Jun 2021 22:28:47 +0200 Subject: [PATCH] ci: add python file checks to ci --- .drone.jsonnet | 22 ++++++++++++++++++++++ .drone.yml | 18 +++++++++++++++++- molecule/centos7/tests/test_default.py | 8 ++------ 3 files changed, 41 insertions(+), 7 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 1eb7ac6..1e67de0 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: cbe5bdb72ce1a6c73ae63dca7eaca9b7586f6a8d1cd82c47fda1d32bec23fc1a +hmac: fcb0bf5dd18ee6c7886e510ace856b5c0f37c6da61f2684bb2535a9daf27b1cc ... diff --git a/molecule/centos7/tests/test_default.py b/molecule/centos7/tests/test_default.py index 9404886..f6e3511 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_nginx_is_installed(host):