]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
gitlabci: unify pylint, flake8 and lua linters
authorTomas Krizek <tomas.krizek@nic.cz>
Thu, 21 Feb 2019 16:06:44 +0000 (17:06 +0100)
committerTomas Krizek <tomas.krizek@nic.cz>
Tue, 12 Mar 2019 09:43:36 +0000 (10:43 +0100)
.gitlab-ci.yml
ci/pytests/lint.sh [deleted file]
ci/pytests/run-extended.sh [deleted file]
ci/pytests/run.sh [deleted file]
meson.build
scripts/run-pylint.sh [moved from ci/pytests/pylint-run.sh with 78% similarity]

index 358ef4b6c6ba007f504bb55d8aced4d455dfd799..d667fdba2194bf46bfdc42ec8cdd7155b7cc4763 100644 (file)
@@ -150,12 +150,14 @@ lint:pedantic:
       -Wpedantic -Wno-newline-eof -Wno-gnu-zero-variadic-macro-arguments -Wno-gnu-folding-constant'
     - ninja -C build_pedantic_clang
 
-lint:luacheck:
+lint:other:
   <<: *test_nodep
   stage: test
   script:
-    - meson build_ci_luacheck
-    - ninja -C build_ci_luacheck luacheck
+    - meson build_ci_lint
+    - ninja -C build_ci* pylint
+    - ninja -C build_ci* flake8
+    - ninja -C build_ci* luacheck
 
 lint:scan-build:
   <<: *test
diff --git a/ci/pytests/lint.sh b/ci/pytests/lint.sh
deleted file mode 100755 (executable)
index b6c0bfc..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-python3 -m flake8 --max-line-length=100 tests/pytests
-FLAKE8=$?
-
-ci/pytests/pylint-run.sh
-PYLINT=$?
-
-if [ $PYLINT -ne 0 ]; then
-       exit 1
-fi
-if [ $FLAKE8 -ne 0 ]; then
-       exit 1
-fi
-
-exit 0
diff --git a/ci/pytests/run-extended.sh b/ci/pytests/run-extended.sh
deleted file mode 100755 (executable)
index 694fba5..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-# Execute extended, long-running test suite
-
-python3 -m pytest -ra --capture=no tests/pytests/conn_flood.py
diff --git a/ci/pytests/run.sh b/ci/pytests/run.sh
deleted file mode 100755 (executable)
index e1b55af..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-python3 -m pytest --html pytests.html --self-contained-html -dn 24 tests/pytests
index 656e6dadb5ec9f36a3aa0136f463667ed941b4b9..a653d24acdc5407f3bf2f99271e5a7d6f3ffc6d3 100644 (file)
@@ -20,13 +20,6 @@ luajit = dependency('luajit')
 message('------------------------------')
 
 
-# TODO coverage
-#lcov = find_program('lcov', required: false)
-#luacov = find_program('luacov', required: false)
-
-# TODO lint
-
-
 # Variables
 libkres_soversion = 9
 
@@ -183,6 +176,8 @@ install_data(
 message('--- lint dependencies ---')
 clangtidy = find_program('clang-tidy', required: false)
 luacheck = find_program('luacheck', required: false)
+flake8 = find_program('flake8', required: false)
+pylint_run = find_program('scripts/run-pylint.sh')
 message('-------------------------')
 
 if clangtidy.found()
@@ -207,6 +202,22 @@ if luacheck.found()
   )
 endif
 
+if flake8.found()
+  run_target(
+    'flake8',
+    command: [
+      flake8,
+      '--max-line-length=100',
+      join_paths(meson.source_root(), 'tests', 'pytests'),
+    ],
+  )
+endif
+
+run_target(
+  'pylint',
+  command: pylint_run,
+)
+
 
 # Summary message
 # NOTE: ternary operator in format() not supported
@@ -217,6 +228,7 @@ s_build_client = build_client ? 'enabled' : 'disabled'
 s_build_unit_tests = build_unit_tests ? 'enabled' : 'disabled'
 s_build_postinstall_tests = build_postinstall_tests ? 'enabled' : 'disabled'
 s_install_kresd_conf = install_kresd_conf ? 'enabled' : 'disabled'
+# TODO mention dnstap installation?
 message('''
 
 ======================= SUMMARY =======================
similarity index 78%
rename from ci/pytests/pylint-run.sh
rename to scripts/run-pylint.sh
index 159a8305374a28629dbac78d53bed43f7f90f7e2..412ce496a4f45c0e3468b1ce1cb6a9a394fec8ef 100755 (executable)
@@ -1,5 +1,7 @@
-#!/usr/bin/env bash
-set -e
+#!/bin/bash
+set -o errexit -o nounset
+
+cd "$(dirname ${0})/.."
 
 # Find Python modules and standalone Python scripts
 FILES=$(find ./tests/pytests \