Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
# Makefile variables set automatically
plugin_id=`cat plugin.json | python -c "import sys, json; print(str(json.load(sys.stdin)['id']).replace('/',''))"`
plugin_version=`cat plugin.json | python -c "import sys, json; print(str(json.load(sys.stdin)['version']).replace('/',''))"`
plugin_id=`cat plugin.json | python3 -c "import sys, json; print(str(json.load(sys.stdin)['id']).replace('/',''))"`
plugin_version=`cat plugin.json | python3 -c "import sys, json; print(str(json.load(sys.stdin)['version']).replace('/',''))"`
archive_file_name="dss-plugin-${plugin_id}-${plugin_version}.zip"
remote_url=`git config --get remote.origin.url`
last_commit_id=`git rev-parse HEAD`

.DEFAULT_GOAL := plugin

plugin:
plugin: dist-clean
@echo "[START] Archiving plugin to dist/ folder..."
@cat plugin.json | json_pp > /dev/null
@rm -rf dist
@mkdir dist
@echo "{\"remote_url\":\"${remote_url}\",\"last_commit_id\":\"${last_commit_id}\"}" > release_info.json
@git archive -v -9 --format zip -o dist/${archive_file_name} HEAD
@zip --delete dist/${archive_file_name} "tests/*"
@zip -u dist/${archive_file_name} release_info.json
@rm release_info.json
@if [[ -d tests ]]; then \
zip --delete dist/${archive_file_name} "tests/*"; \
fi
@echo "[SUCCESS] Archiving plugin to dist/ folder: Done!"

dev: dist-clean
@echo "[START] Archiving plugin to dist/ folder... (dev mode)"
@cat plugin.json | json_pp > /dev/null
@mkdir dist
@zip -v -9 dist/${archive_file_name} -r . --exclude "tests/*" "env/*" ".git/*" ".pytest_cache/*" ".idea/*" "dist/*"
@echo "[SUCCESS] Archiving plugin to dist/ folder: Done!"

unit-tests:
@echo "Running unit tests..."
@( \
PYTHON_VERSION=`python3 -c "import sys; print('%s%s' % (sys.version_info.major, sys.version_info.minor))"`; \
PYTHON_VERSION_IS_CORRECT=`cat code-env/python/desc.json | python3 -c "import sys, json; print('PYTHON' + str($$PYTHON_VERSION) in json.load(sys.stdin)['acceptedPythonInterpreters']);"`; \
PYTHON_VERSION=`python3 -c "import sys; print('PYTHON{}{}'.format(sys.version_info.major, sys.version_info.minor))"`; \
PYTHON_VERSION_IS_CORRECT=`cat code-env/python/desc.json | python3 -c "import sys, json; print('$$PYTHON_VERSION' in json.load(sys.stdin)['acceptedPythonInterpreters']);"`; \
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; \
)
@( \
Expand All @@ -33,7 +37,7 @@ unit-tests:
pip install --no-cache-dir -r tests/python/unit/requirements.txt; \
pip install --no-cache-dir -r code-env/python/spec/requirements.txt; \
export PYTHONPATH="$(PYTHONPATH):$(PWD)/python-lib"; \
pytest tests/python/unit --alluredir=tests/allure_report || ret=$$?; exit $$ret \
python3 -m pytest tests/python/unit --alluredir=tests/allure_report || ret=$$?; exit $$ret \
)

integration-tests:
Expand All @@ -44,10 +48,10 @@ integration-tests:
source env/bin/activate; \
pip3 install --upgrade pip;\
pip install --no-cache-dir -r tests/python/integration/requirements.txt; \
pytest tests/python/integration --alluredir=tests/allure_report || ret=$$?; exit $$ret \
python3 -m pytest tests/python/integration --alluredir=tests/allure_report || ret=$$?; exit $$ret \
)

tests: unit-tests integration-tests

dist-clean:
rm -rf dist
rm -rf dist
Loading