Alexander Couzens | 4731232 | 2018-07-19 23:31:39 +0200 | [diff] [blame] | 1 | #!/bin/sh |
Harald Welte | e4759fd | 2021-04-11 10:58:30 +0200 | [diff] [blame] | 2 | # 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 Couzens | 4731232 | 2018-07-19 23:31:39 +0200 | [diff] [blame] | 8 | |
| 9 | set -e |
| 10 | |
Harald Welte | 91d4ec7 | 2019-05-10 16:20:54 +0200 | [diff] [blame] | 11 | if [ ! -d "./pysim-testdata/" ] ; then |
Alexander Couzens | 4731232 | 2018-07-19 23:31:39 +0200 | [diff] [blame] | 12 | echo "###############################################" |
Harald Welte | 91d4ec7 | 2019-05-10 16:20:54 +0200 | [diff] [blame] | 13 | echo "Please call from pySim-prog top directory" |
Alexander Couzens | 4731232 | 2018-07-19 23:31:39 +0200 | [diff] [blame] | 14 | echo "###############################################" |
| 15 | exit 1 |
| 16 | fi |
| 17 | |
Daniel Willmann | de07b95 | 2020-10-19 10:32:34 +0200 | [diff] [blame] | 18 | virtualenv -p python3 venv --system-site-packages |
Alexander Couzens | 4731232 | 2018-07-19 23:31:39 +0200 | [diff] [blame] | 19 | . venv/bin/activate |
| 20 | pip install pytlv |
Philipp Maier | c5b422e | 2019-08-30 11:41:02 +0200 | [diff] [blame] | 21 | pip install pyyaml |
Harald Welte | 1a4e9fd | 2021-06-11 23:45:26 +0200 | [diff] [blame] | 22 | pip install cmd2==1.5 |
Harald Welte | 0d4e98a | 2021-04-07 00:14:40 +0200 | [diff] [blame] | 23 | pip install jsonpath-ng |
Harald Welte | e0f9ef1 | 2021-04-10 17:22:35 +0200 | [diff] [blame] | 24 | pip install construct |
Harald Welte | 4ae228a | 2021-05-02 21:29:04 +0200 | [diff] [blame] | 25 | pip install bidict |
Robert Falkenberg | b07a3e9 | 2021-05-07 15:23:20 +0200 | [diff] [blame] | 26 | pip install gsm0338 |
Alexander Couzens | 4731232 | 2018-07-19 23:31:39 +0200 | [diff] [blame] | 27 | |
Vadim Yanitskiy | 4ae7c49 | 2021-03-11 23:17:27 +0100 | [diff] [blame] | 28 | # Execute automatically discovered unit tests first |
Vadim Yanitskiy | d61da8a | 2021-03-12 01:13:05 +0100 | [diff] [blame] | 29 | python -m unittest discover -v -s tests/ |
Vadim Yanitskiy | 4ae7c49 | 2021-03-11 23:17:27 +0100 | [diff] [blame] | 30 | |
Vadim Yanitskiy | e9fe09b | 2021-05-02 01:46:55 +0200 | [diff] [blame] | 31 | # 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) |
| 37 | pip install pylint |
| 38 | python -m pylint --errors-only \ |
| 39 | --disable E1102 \ |
| 40 | --disable E0401 \ |
| 41 | pySim *.py |
| 42 | |
Harald Welte | 5da7a72 | 2021-04-03 20:21:02 +0200 | [diff] [blame] | 43 | # attempt to build documentation |
| 44 | pip install sphinx |
| 45 | pip install sphinxcontrib-napoleon |
Harald Welte | d36f694 | 2021-04-04 14:37:55 +0200 | [diff] [blame] | 46 | pip3 install -e 'git+https://github.com/osmocom/sphinx-argparse@master#egg=sphinx-argparse' |
Harald Welte | e4759fd | 2021-04-11 10:58:30 +0200 | [diff] [blame] | 47 | (cd docs && make html latexpdf) |
Harald Welte | 5da7a72 | 2021-04-03 20:21:02 +0200 | [diff] [blame] | 48 | |
| 49 | # run the test with physical cards |
Alexander Couzens | 4731232 | 2018-07-19 23:31:39 +0200 | [diff] [blame] | 50 | cd pysim-testdata |
| 51 | ../tests/pysim-test.sh |
Harald Welte | e4759fd | 2021-04-11 10:58:30 +0200 | [diff] [blame] | 52 | |
| 53 | if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then |
| 54 | make -C "$base/docs" publish |
| 55 | fi |