From 3cec274259ecf5c09cd2023faf8db0b52ca26d21 Mon Sep 17 00:00:00 2001 From: Agate Date: Wed, 6 Jul 2022 15:42:30 +0200 Subject: [PATCH] ci: speed up CI using multiple processes with pylint and pytest (#67080) --- Jenkinsfile | 2 +- pylint.sh | 3 +-- tox.ini | 5 ++++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c205260e..82ede2f5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { stages { stage('Unit Tests') { steps { - sh 'tox -rv' + sh 'NUMPROCESSES=6 tox -rv ' } post { always { diff --git a/pylint.sh b/pylint.sh index ba7a6c3a..507d78c0 100755 --- a/pylint.sh +++ b/pylint.sh @@ -1,5 +1,4 @@ #!/bin/bash set -e -x env - -pylint -f parseable --rcfile pylint.rc "$@" | tee pylint.out; test $PIPESTATUS -eq 0 +pylint --jobs ${NUMPROCESSES:-1} -f parseable --rcfile pylint.rc "$@" | tee pylint.out; test $PIPESTATUS -eq 0 diff --git a/tox.ini b/tox.ini index ee05ea9d..c83fb852 100644 --- a/tox.ini +++ b/tox.ini @@ -10,6 +10,7 @@ setenv = BRANCH_NAME={env:BRANCH_NAME:} WCSCTL=wcs/wcsctl.py SETUPTOOLS_USE_DISTUTILS=stdlib + NUMPROCESSES={env:NUMPROCESSES:1} fast: FAST=--nomigrations coverage: COVERAGE=--junitxml=junit-{envname}.xml --cov-report xml --cov-report html --cov=passerelle/ --cov-config .coveragerc -Wignore deps = @@ -19,6 +20,7 @@ deps = psycopg2-binary<2.9 pytest-cov pytest-django + pytest-xdist pytest!=6.0.0 WebTest mock<4 @@ -41,7 +43,7 @@ deps = codestyle: pre-commit commands = ./get_wcs.sh - py.test {posargs: {env:FAST:} {env:COVERAGE:} {env:JUNIT:} tests/} + py.test {posargs: --numprocesses {env:NUMPROCESSES:1} --dist loadfile {env:FAST:} {env:COVERAGE:} {env:JUNIT:} tests/} codestyle: pre-commit run --all-files --show-diff-on-failure [pytest] @@ -60,6 +62,7 @@ setenv = PASSERELLE_SETTINGS_FILE=tests/settings.py BRANCH_NAME={env:BRANCH_NAME:} SETUPTOOLS_USE_DISTUTILS=stdlib + NUMPROCESSES={env:NUMPROCESSES:6} deps = pytest-django pytest!=6.0.0