From 8e45b75711b4b767250870d4329f6ac2a8994740 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Tue, 18 Oct 2022 16:35:14 +0200 Subject: [PATCH] contrib/jenkins.sh: split test/pylint/docs Split the jenkins job up in three parts, so each of them can run in parallel, and the test part that has to run on a specific node (and blocks it while running), finishes faster. Don't install depends of pylint/docs jobs as they will run in docker and the depends get installed once in the container. Related: OS#5497 Depends: docker-playground Id5c75725d2fab46b29773fa4f637fa2d73fa7291 Depends: osmo-ci Iea4f15fd9c9f8f36cb8d638c48da000eafe746a4 Change-Id: I5245c529db729e209d78a02ab9c917a90d0e0206 --- contrib/jenkins.sh | 66 ++++++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 0ade9b49..34f47ea3 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -4,6 +4,7 @@ # environment variables: # * WITH_MANUALS: build manual PDFs if set to "1" # * PUBLISH: upload manuals after building if set to "1" (ignored without WITH_MANUALS = "1") +# * JOB_TYPE: one of 'test', 'pylint', 'docs' # export PYTHONUNBUFFERED=1 @@ -15,36 +16,43 @@ if [ ! -d "./pysim-testdata/" ] ; then exit 1 fi -virtualenv -p python3 venv --system-site-packages -. venv/bin/activate -pip install -r requirements.txt +case "$JOB_TYPE" in +"test") + virtualenv -p python3 venv --system-site-packages + . venv/bin/activate -# Execute automatically discovered unit tests first -python -m unittest discover -v -s tests/ + pip install -r requirements.txt -# Run pylint to find potential errors -# Ignore E1102: not-callable -# pySim/filesystem.py: E1102: method is not callable (not-callable) -# Ignore E0401: import-error -# pySim/utils.py:276: E0401: Unable to import 'Crypto.Cipher' (import-error) -# pySim/utils.py:277: E0401: Unable to import 'Crypto.Util.strxor' (import-error) -pip install pylint -python -m pylint -j0 --errors-only \ - --disable E1102 \ - --disable E0401 \ - --enable W0301 \ - pySim *.py + # Execute automatically discovered unit tests first + python -m unittest discover -v -s tests/ -# attempt to build documentation -pip install sphinx -pip install sphinxcontrib-napoleon -pip3 install -e 'git+https://github.com/osmocom/sphinx-argparse@master#egg=sphinx-argparse' -(cd docs && make html latexpdf) + # Run the test with physical cards + cd pysim-testdata + ../tests/pysim-test.sh + ;; +"pylint") + # Run pylint to find potential errors + # Ignore E1102: not-callable + # pySim/filesystem.py: E1102: method is not callable (not-callable) + # Ignore E0401: import-error + # pySim/utils.py:276: E0401: Unable to import 'Crypto.Cipher' (import-error) + # pySim/utils.py:277: E0401: Unable to import 'Crypto.Util.strxor' (import-error) + python3 -m pylint -j0 --errors-only \ + --disable E1102 \ + --disable E0401 \ + --enable W0301 \ + pySim *.py + ;; +"docs") + rm -rf docs/_build + make -C "docs" html latexpdf -if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then - make -C "docs" publish publish-html -fi - -# run the test with physical cards -cd pysim-testdata -../tests/pysim-test.sh + if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then + make -C "docs" publish publish-html + fi + ;; +*) + set +x + echo "ERROR: JOB_TYPE has unexpected value '$JOB_TYPE'." + exit 1 +esac