|
1 | | -PLUGIN_VERSION=1.0.5 |
2 | | -PLUGIN_ID=decision-tree-builder |
| 1 | +# Makefile variables set automatically |
| 2 | +plugin_id=`cat plugin.json | python -c "import sys, json; print(str(json.load(sys.stdin)['id']).replace('/',''))"` |
| 3 | +plugin_version=`cat plugin.json | python -c "import sys, json; print(str(json.load(sys.stdin)['version']).replace('/',''))"` |
| 4 | +archive_file_name="dss-plugin-${plugin_id}-${plugin_version}.zip" |
| 5 | +remote_url=`git config --get remote.origin.url` |
| 6 | +last_commit_id=`git rev-parse HEAD` |
| 7 | + |
3 | 8 |
|
4 | 9 | plugin: |
5 | | - cat plugin.json|json_pp > /dev/null |
| 10 | + @echo "[START] Archiving plugin to dist/ folder..." |
| 11 | + @cat plugin.json | json_pp > /dev/null |
| 12 | + @rm -rf dist |
| 13 | + @mkdir dist |
| 14 | + @echo "{\"remote_url\":\"${remote_url}\",\"last_commit_id\":\"${last_commit_id}\"}" > release_info.json |
| 15 | + @git archive -v -9 --format zip -o dist/${archive_file_name} HEAD |
| 16 | + @zip --delete dist/${archive_file_name} "tests/*" |
| 17 | + @zip -u dist/${archive_file_name} release_info.json |
| 18 | + @rm release_info.json |
| 19 | + @echo "[SUCCESS] Archiving plugin to dist/ folder: Done!" |
| 20 | + |
| 21 | +unit-tests: |
| 22 | + @echo "Running unit tests..." |
| 23 | + @( \ |
| 24 | + PYTHON_VERSION=`python3 -V 2>&1 | sed 's/[^0-9]*//g' | cut -c 1,2`; \ |
| 25 | + PYTHON_VERSION_IS_CORRECT=`cat code-env/python/desc.json | python3 -c "import sys, json; print(str($$PYTHON_VERSION) in [x[-2:] for x in json.load(sys.stdin)['acceptedPythonInterpreters']]);"`; \ |
| 26 | + if [ $$PYTHON_VERSION_IS_CORRECT == "False" ]; then echo "Python version $$PYTHON_VERSION is not in acceptedPythonInterpreters"; exit 1; else echo "Python version $$PYTHON_VERSION is in acceptedPythonInterpreters"; fi; \ |
| 27 | + ) |
| 28 | + @( \ |
| 29 | + rm -rf ./env/; \ |
| 30 | + python3 -m venv env/; \ |
| 31 | + source env/bin/activate; \ |
| 32 | + pip install --upgrade pip;\ |
| 33 | + pip install --no-cache-dir -r tests/python/unit/requirements.txt; \ |
| 34 | + pip install --no-cache-dir -r code-env/python/spec/requirements.txt; \ |
| 35 | + export PYTHONPATH="$(PYTHONPATH):$(PWD)/python-lib"; \ |
| 36 | + pytest tests/python/unit --alluredir=tests/allure_report || ret=$$?; exit $$ret \ |
| 37 | + ) |
| 38 | + |
| 39 | +integration-tests: |
| 40 | + @echo "Running integration tests..." |
| 41 | + @( \ |
| 42 | + rm -rf ./env/; \ |
| 43 | + python3 -m venv env/; \ |
| 44 | + source env/bin/activate; \ |
| 45 | + pip3 install --upgrade pip;\ |
| 46 | + pip install --no-cache-dir -r tests/python/integration/requirements.txt; \ |
| 47 | + pytest tests/python/integration --alluredir=tests/allure_report || ret=$$?; exit $$ret \ |
| 48 | + ) |
| 49 | + |
| 50 | +tests: unit-tests integration-tests |
| 51 | + |
| 52 | +dist-clean: |
6 | 53 | rm -rf dist |
7 | | - mkdir dist |
8 | | - zip --exclude "*.pyc" -r dist/dss-plugin-${PLUGIN_ID}-${PLUGIN_VERSION}.zip plugin.json python-lib custom-recipes resource webapps |
|
0 commit comments