blob: 91dcdd2011df3159e5f0edd3f2ef92d101ead03a [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
Philipp Maierc5b422e2019-08-30 11:41:02 +020021pip install pyyaml
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 \
41 pySim *.py
42
Harald Welte5da7a722021-04-03 20:21:02 +020043# attempt to build documentation
44pip install sphinx
45pip install sphinxcontrib-napoleon
Harald Welted36f6942021-04-04 14:37:55 +020046pip3 install -e 'git+https://github.com/osmocom/sphinx-argparse@master#egg=sphinx-argparse'
Harald Weltee4759fd2021-04-11 10:58:30 +020047(cd docs && make html latexpdf)
Harald Welte5da7a722021-04-03 20:21:02 +020048
49# run the test with physical cards
Alexander Couzens47312322018-07-19 23:31:39 +020050cd pysim-testdata
51../tests/pysim-test.sh
Harald Weltee4759fd2021-04-11 10:58:30 +020052
53if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then
54 make -C "$base/docs" publish
55fi