Skip to content

Commit

Permalink
pylint: Run test if .pylintrc changed
Browse files Browse the repository at this point in the history
- Cleaned up pylint test for python3 files

Change-Id: I1ddfca3435ec1a738fb3249bc68515ef5077b19b
  • Loading branch information
si-23 committed Aug 2, 2019
1 parent 8b9f57f commit a334aa5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions buildscripts/scripts/test-gerrit.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ node {
print "Changed python files: ${CHANGED_PYTHON_FILES}"
CHANGED_PYTHON3_FILES = sh(script: "tests-py3/find-python-files | grep -h ${GREP_PATTERNS} - || true", returnStdout: true).toString().trim()
print "Changed python3 files: ${CHANGED_PYTHON3_FILES}"
CHANGED_PYLINT_RC_FILE = sh(script: "echo '$CHANGED_FILES' | grep -h '${WORKSPACE}/.pylintrc' - || true", returnStdout: true).toString().trim()

stage("Python typing") {
if (CHANGED_PYTHON_FILES != "") {
Expand Down Expand Up @@ -78,7 +79,9 @@ node {
}

stage("Python linting") {
if (CHANGED_PYTHON_FILES != "") {
if (CHANGED_PYLINT_RC_FILE == "" && CHANGED_PYTHON_FILES == "") {
println "Neither .pylintrc nor python files changed. Skipping."
} else {
dir('tests') {
withEnv(["WORKDIR=${WORKSPACE}/tmp",
'PYLINT_ARGS=--output-format=cmk_parseable']) {
Expand All @@ -87,15 +90,17 @@ node {
sh ". /bauwelt/bin/bw-setup-jenkins-env && make -C .. --what-if Pipfile.lock .venv && make test-pylint"
}
}
} else {
println "No python files changed. Skipping."
}
}

stage("Python3 linting") {
if (CHANGED_PYLINT_RC_FILE == "" && CHANGED_PYTHON3_FILES == "") {
println "Neither .pylintrc nor python3 files changed. Skipping."
} else {
dir('tests-py3') {
sh 'make test-pylint'
}
}
}

stage("Python unit tests") {
Expand Down

0 comments on commit a334aa5

Please sign in to comment.