blob: 37d1d4dd98ec4ddb1cea774695db97af7abbdd3c [file] [log] [blame]
Alexander Couzens47312322018-07-19 23:31:39 +02001#!/bin/sh
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
9set -e
10
Harald Welte91d4ec72019-05-10 16:20:54 +020011if [ ! -d "./pysim-testdata/" ] ; then
Alexander Couzens47312322018-07-19 23:31:39 +020012 echo "###############################################"
Harald Welte91d4ec72019-05-10 16:20:54 +020013 echo "Please call from pySim-prog top directory"
Alexander Couzens47312322018-07-19 23:31:39 +020014 echo "###############################################"
15 exit 1
16fi
17
Daniel Willmannde07b952020-10-19 10:32:34 +020018virtualenv -p python3 venv --system-site-packages
Alexander Couzens47312322018-07-19 23:31:39 +020019. venv/bin/activate
20pip install pytlv
Harald Weltef03894a2022-02-09 13:57:15 +000021pip install 'pyyaml>=5.1'
Harald Welte1a4e9fd2021-06-11 23:45:26 +020022pip install cmd2==1.5
Harald Welte0d4e98a2021-04-07 00:14:40 +020023pip install jsonpath-ng
Harald Weltee0f9ef12021-04-10 17:22:35 +020024pip install construct
Harald Welte4ae228a2021-05-02 21:29:04 +020025pip install bidict
Robert Falkenbergb07a3e92021-05-07 15:23:20 +020026pip install gsm0338
Alexander Couzens47312322018-07-19 23:31:39 +020027
Vadim Yanitskiy4ae7c492021-03-11 23:17:27 +010028# Execute automatically discovered unit tests first
Vadim Yanitskiyd61da8a2021-03-12 01:13:05 +010029python -m unittest discover -v -s tests/
Vadim Yanitskiy4ae7c492021-03-11 23:17:27 +010030
Vadim Yanitskiye9fe09b2021-05-02 01:46:55 +020031# Run pylint to find potential errors
32# Ignore E1102: not-callable
33# pySim/filesystem.py: E1102: method is not callable (not-callable)
34# Ignore E0401: import-error
35# pySim/utils.py:276: E0401: Unable to import 'Crypto.Cipher' (import-error)
36# pySim/utils.py:277: E0401: Unable to import 'Crypto.Util.strxor' (import-error)
37pip install pylint
38python -m pylint --errors-only \
39 --disable E1102 \
40 --disable E0401 \
Vadim Yanitskiyfc769e22021-11-05 16:05:20 +030041 --enable W0301 \
Vadim Yanitskiye9fe09b2021-05-02 01:46:55 +020042 pySim *.py
43
Harald Welte5da7a722021-04-03 20:21:02 +020044# attempt to build documentation
45pip install sphinx
46pip install sphinxcontrib-napoleon
Harald Welted36f6942021-04-04 14:37:55 +020047pip3 install -e 'git+https://github.com/osmocom/sphinx-argparse@master#egg=sphinx-argparse'
Harald Weltee4759fd2021-04-11 10:58:30 +020048(cd docs && make html latexpdf)
Harald Welte5da7a722021-04-03 20:21:02 +020049
Harald Weltee4759fd2021-04-11 10:58:30 +020050if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then
Harald Welte362d2d02022-02-09 21:01:00 +010051 make -C "docs" publish publish-html
Harald Weltee4759fd2021-04-11 10:58:30 +020052fi
Harald Welte6b08fc32022-02-09 17:01:46 +010053
54# run the test with physical cards
55cd pysim-testdata
56../tests/pysim-test.sh