blob: ed5ba2573d34c8b9c6aa0d4368f22003f1f419fd [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 Welteb2edd142021-01-08 23:29:35 +010022pip install cmd2
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
Alexander Couzens47312322018-07-19 23:31:39 +020026
Vadim Yanitskiy4ae7c492021-03-11 23:17:27 +010027# Execute automatically discovered unit tests first
Vadim Yanitskiyd61da8a2021-03-12 01:13:05 +010028python -m unittest discover -v -s tests/
Vadim Yanitskiy4ae7c492021-03-11 23:17:27 +010029
Vadim Yanitskiye9fe09b2021-05-02 01:46:55 +020030# Run pylint to find potential errors
31# Ignore E1102: not-callable
32# pySim/filesystem.py: E1102: method is not callable (not-callable)
33# Ignore E0401: import-error
34# pySim/utils.py:276: E0401: Unable to import 'Crypto.Cipher' (import-error)
35# pySim/utils.py:277: E0401: Unable to import 'Crypto.Util.strxor' (import-error)
36pip install pylint
37python -m pylint --errors-only \
38 --disable E1102 \
39 --disable E0401 \
40 pySim *.py
41
Harald Welte5da7a722021-04-03 20:21:02 +020042# attempt to build documentation
43pip install sphinx
44pip install sphinxcontrib-napoleon
Harald Welted36f6942021-04-04 14:37:55 +020045pip3 install -e 'git+https://github.com/osmocom/sphinx-argparse@master#egg=sphinx-argparse'
Harald Weltee4759fd2021-04-11 10:58:30 +020046(cd docs && make html latexpdf)
Harald Welte5da7a722021-04-03 20:21:02 +020047
48# run the test with physical cards
Alexander Couzens47312322018-07-19 23:31:39 +020049cd pysim-testdata
50../tests/pysim-test.sh
Harald Weltee4759fd2021-04-11 10:58:30 +020051
52if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then
53 make -C "$base/docs" publish
54fi