blob: fbcd73c4ee2c3f44ebd659d5393e51ebf3c742ad [file] [log] [blame]
Vadim Yanitskiy7ce04a52022-08-30 01:30:37 +07001#!/bin/sh -xe
Harald Weltee4759fd2021-04-11 10:58:30 +02002# jenkins build helper script for pysim. This is how we build on jenkins.osmocom.org
3#
4# environment variables:
5# * WITH_MANUALS: build manual PDFs if set to "1"
6# * PUBLISH: upload manuals after building if set to "1" (ignored without WITH_MANUALS = "1")
7#
Alexander Couzens47312322018-07-19 23:31:39 +02008
Harald Welte91d4ec72019-05-10 16:20:54 +02009if [ ! -d "./pysim-testdata/" ] ; then
Alexander Couzens47312322018-07-19 23:31:39 +020010 echo "###############################################"
Harald Welte91d4ec72019-05-10 16:20:54 +020011 echo "Please call from pySim-prog top directory"
Alexander Couzens47312322018-07-19 23:31:39 +020012 echo "###############################################"
13 exit 1
14fi
15
Daniel Willmannde07b952020-10-19 10:32:34 +020016virtualenv -p python3 venv --system-site-packages
Alexander Couzens47312322018-07-19 23:31:39 +020017. venv/bin/activate
Vadim Yanitskiy7800f9d2022-08-30 01:32:57 +070018pip install -r requirements.txt
Alexander Couzens47312322018-07-19 23:31:39 +020019
Vadim Yanitskiy4ae7c492021-03-11 23:17:27 +010020# Execute automatically discovered unit tests first
Vadim Yanitskiyd61da8a2021-03-12 01:13:05 +010021python -m unittest discover -v -s tests/
Vadim Yanitskiy4ae7c492021-03-11 23:17:27 +010022
Vadim Yanitskiye9fe09b2021-05-02 01:46:55 +020023# Run pylint to find potential errors
24# Ignore E1102: not-callable
25# pySim/filesystem.py: E1102: method is not callable (not-callable)
26# Ignore E0401: import-error
27# pySim/utils.py:276: E0401: Unable to import 'Crypto.Cipher' (import-error)
28# pySim/utils.py:277: E0401: Unable to import 'Crypto.Util.strxor' (import-error)
Vadim Yanitskiy4e64e722022-09-06 15:29:49 +070029pip install pylint
Vadim Yanitskiyb3ea0212022-08-30 17:15:51 +070030python -m pylint -j0 --errors-only \
Vadim Yanitskiye9fe09b2021-05-02 01:46:55 +020031 --disable E1102 \
32 --disable E0401 \
Vadim Yanitskiyfc769e22021-11-05 16:05:20 +030033 --enable W0301 \
Vadim Yanitskiye9fe09b2021-05-02 01:46:55 +020034 pySim *.py
35
Harald Welte5da7a722021-04-03 20:21:02 +020036# attempt to build documentation
37pip install sphinx
38pip install sphinxcontrib-napoleon
Harald Welted36f6942021-04-04 14:37:55 +020039pip3 install -e 'git+https://github.com/osmocom/sphinx-argparse@master#egg=sphinx-argparse'
Harald Weltee4759fd2021-04-11 10:58:30 +020040(cd docs && make html latexpdf)
Harald Welte5da7a722021-04-03 20:21:02 +020041
Harald Weltee4759fd2021-04-11 10:58:30 +020042if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then
Harald Welte362d2d02022-02-09 21:01:00 +010043 make -C "docs" publish publish-html
Harald Weltee4759fd2021-04-11 10:58:30 +020044fi
Harald Welte6b08fc32022-02-09 17:01:46 +010045
46# run the test with physical cards
47cd pysim-testdata
48../tests/pysim-test.sh