blob: 0ade9b4983209d36f21dea21b339fe6f8c5a3ee3 [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
Oliver Smith507b5272022-10-18 16:48:52 +02009export PYTHONUNBUFFERED=1
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
Vadim Yanitskiy7800f9d2022-08-30 01:32:57 +070020pip install -r requirements.txt
Alexander Couzens47312322018-07-19 23:31:39 +020021
Vadim Yanitskiy4ae7c492021-03-11 23:17:27 +010022# Execute automatically discovered unit tests first
Vadim Yanitskiyd61da8a2021-03-12 01:13:05 +010023python -m unittest discover -v -s tests/
Vadim Yanitskiy4ae7c492021-03-11 23:17:27 +010024
Vadim Yanitskiye9fe09b2021-05-02 01:46:55 +020025# Run pylint to find potential errors
26# Ignore E1102: not-callable
27# pySim/filesystem.py: E1102: method is not callable (not-callable)
28# Ignore E0401: import-error
29# pySim/utils.py:276: E0401: Unable to import 'Crypto.Cipher' (import-error)
30# pySim/utils.py:277: E0401: Unable to import 'Crypto.Util.strxor' (import-error)
Vadim Yanitskiy4e64e722022-09-06 15:29:49 +070031pip install pylint
Vadim Yanitskiyb3ea0212022-08-30 17:15:51 +070032python -m pylint -j0 --errors-only \
Vadim Yanitskiye9fe09b2021-05-02 01:46:55 +020033 --disable E1102 \
34 --disable E0401 \
Vadim Yanitskiyfc769e22021-11-05 16:05:20 +030035 --enable W0301 \
Vadim Yanitskiye9fe09b2021-05-02 01:46:55 +020036 pySim *.py
37
Harald Welte5da7a722021-04-03 20:21:02 +020038# attempt to build documentation
39pip install sphinx
40pip install sphinxcontrib-napoleon
Harald Welted36f6942021-04-04 14:37:55 +020041pip3 install -e 'git+https://github.com/osmocom/sphinx-argparse@master#egg=sphinx-argparse'
Harald Weltee4759fd2021-04-11 10:58:30 +020042(cd docs && make html latexpdf)
Harald Welte5da7a722021-04-03 20:21:02 +020043
Harald Weltee4759fd2021-04-11 10:58:30 +020044if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then
Harald Welte362d2d02022-02-09 21:01:00 +010045 make -C "docs" publish publish-html
Harald Weltee4759fd2021-04-11 10:58:30 +020046fi
Harald Welte6b08fc32022-02-09 17:01:46 +010047
48# run the test with physical cards
49cd pysim-testdata
50../tests/pysim-test.sh