Vadim Yanitskiy | 7ce04a5 | 2022-08-30 01:30:37 +0700 | [diff] [blame] | 1 | #!/bin/sh -xe |
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 | |
Harald Welte | 91d4ec7 | 2019-05-10 16:20:54 +0200 | [diff] [blame] | 9 | if [ ! -d "./pysim-testdata/" ] ; then |
Alexander Couzens | 4731232 | 2018-07-19 23:31:39 +0200 | [diff] [blame] | 10 | echo "###############################################" |
Harald Welte | 91d4ec7 | 2019-05-10 16:20:54 +0200 | [diff] [blame] | 11 | echo "Please call from pySim-prog top directory" |
Alexander Couzens | 4731232 | 2018-07-19 23:31:39 +0200 | [diff] [blame] | 12 | echo "###############################################" |
| 13 | exit 1 |
| 14 | fi |
| 15 | |
Daniel Willmann | de07b95 | 2020-10-19 10:32:34 +0200 | [diff] [blame] | 16 | virtualenv -p python3 venv --system-site-packages |
Alexander Couzens | 4731232 | 2018-07-19 23:31:39 +0200 | [diff] [blame] | 17 | . venv/bin/activate |
Vadim Yanitskiy | 7800f9d | 2022-08-30 01:32:57 +0700 | [diff] [blame] | 18 | pip install -r requirements.txt |
Alexander Couzens | 4731232 | 2018-07-19 23:31:39 +0200 | [diff] [blame] | 19 | |
Vadim Yanitskiy | 4ae7c49 | 2021-03-11 23:17:27 +0100 | [diff] [blame] | 20 | # Execute automatically discovered unit tests first |
Vadim Yanitskiy | d61da8a | 2021-03-12 01:13:05 +0100 | [diff] [blame] | 21 | python -m unittest discover -v -s tests/ |
Vadim Yanitskiy | 4ae7c49 | 2021-03-11 23:17:27 +0100 | [diff] [blame] | 22 | |
Vadim Yanitskiy | e9fe09b | 2021-05-02 01:46:55 +0200 | [diff] [blame] | 23 | # Run pylint to find potential errors |
| 24 | # Ignore E1102: not-callable |
| 25 | # pySim/filesystem.py: E1102: method is not callable (not-callable) |
| 26 | # Ignore E0401: import-error |
| 27 | # pySim/utils.py:276: E0401: Unable to import 'Crypto.Cipher' (import-error) |
| 28 | # pySim/utils.py:277: E0401: Unable to import 'Crypto.Util.strxor' (import-error) |
Vadim Yanitskiy | 12175d3 | 2022-08-30 17:11:39 +0700 | [diff] [blame] | 29 | pip install pylint==2.14.5 # FIXME: 2.15 is crashing, see OS#5668 |
Vadim Yanitskiy | b3ea021 | 2022-08-30 17:15:51 +0700 | [diff] [blame] | 30 | python -m pylint -j0 --errors-only \ |
Vadim Yanitskiy | e9fe09b | 2021-05-02 01:46:55 +0200 | [diff] [blame] | 31 | --disable E1102 \ |
| 32 | --disable E0401 \ |
Vadim Yanitskiy | fc769e2 | 2021-11-05 16:05:20 +0300 | [diff] [blame] | 33 | --enable W0301 \ |
Vadim Yanitskiy | e9fe09b | 2021-05-02 01:46:55 +0200 | [diff] [blame] | 34 | pySim *.py |
| 35 | |
Harald Welte | 5da7a72 | 2021-04-03 20:21:02 +0200 | [diff] [blame] | 36 | # attempt to build documentation |
| 37 | pip install sphinx |
| 38 | pip install sphinxcontrib-napoleon |
Harald Welte | d36f694 | 2021-04-04 14:37:55 +0200 | [diff] [blame] | 39 | 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] | 40 | (cd docs && make html latexpdf) |
Harald Welte | 5da7a72 | 2021-04-03 20:21:02 +0200 | [diff] [blame] | 41 | |
Harald Welte | e4759fd | 2021-04-11 10:58:30 +0200 | [diff] [blame] | 42 | if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then |
Harald Welte | 362d2d0 | 2022-02-09 21:01:00 +0100 | [diff] [blame] | 43 | make -C "docs" publish publish-html |
Harald Welte | e4759fd | 2021-04-11 10:58:30 +0200 | [diff] [blame] | 44 | fi |
Harald Welte | 6b08fc3 | 2022-02-09 17:01:46 +0100 | [diff] [blame] | 45 | |
| 46 | # run the test with physical cards |
| 47 | cd pysim-testdata |
| 48 | ../tests/pysim-test.sh |