Skip to content

Commit f019dd5

Browse files
committed
Updating makefile
1 parent 2b95c8a commit f019dd5

File tree

1 file changed

+30
-15
lines changed

1 file changed

+30
-15
lines changed

Makefile

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,58 @@ archive_file_name="dss-plugin-${plugin_id}-${plugin_version}.zip"
55
remote_url=`git config --get remote.origin.url`
66
last_commit_id=`git rev-parse HEAD`
77

8+
.DEFAULT_GOAL := plugin
89

9-
plugin:
10+
plugin: dist-clean
1011
@echo "[START] Archiving plugin to dist/ folder..."
1112
@cat plugin.json | json_pp > /dev/null
12-
@rm -rf dist
1313
@mkdir dist
1414
@echo "{\"remote_url\":\"${remote_url}\",\"last_commit_id\":\"${last_commit_id}\"}" > release_info.json
1515
@git archive -v -9 --format zip -o dist/${archive_file_name} HEAD
16+
@if [[ -d tests ]]; then \
17+
zip --delete dist/${archive_file_name} "tests/*"; \
18+
fi
1619
@zip -u dist/${archive_file_name} release_info.json
1720
@rm release_info.json
1821
@echo "[SUCCESS] Archiving plugin to dist/ folder: Done!"
1922

23+
dev: dist-clean
24+
@echo "[START] Archiving plugin to dist/ folder... (dev mode)"
25+
@cat plugin.json | json_pp > /dev/null
26+
@mkdir dist
27+
@zip -v -9 dist/${archive_file_name} -r . --exclude "tests/*" "env/*" ".git/*" ".pytest_cache/*" ".idea/*" "dist/*"
28+
@echo "[SUCCESS] Archiving plugin to dist/ folder: Done!"
29+
2030
unit-tests:
21-
@echo "[START] Running unit tests..."
31+
@echo "Running unit tests..."
2232
@( \
23-
PYTHON_VERSION=`python3 -V 2>&1 | sed 's/[^0-9]*//g' | cut -c 1,2`; \
24-
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']]);"`; \
25-
if [ ! $$PYTHON_VERSION_IS_CORRECT ]; then echo "Python version $$PYTHON_VERSION is not in acceptedPythonInterpreters"; exit 1; fi; \
33+
PYTHON_VERSION=`python3 -c "import sys; print('PYTHON{}{}'.format(sys.version_info.major, sys.version_info.minor))"`; \
34+
PYTHON_VERSION_IS_CORRECT=`cat code-env/python/desc.json | python3 -c "import sys, json; print('$$PYTHON_VERSION' in json.load(sys.stdin)['acceptedPythonInterpreters']);"`; \
35+
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; \
2636
)
2737
@( \
38+
rm -rf ./env/; \
2839
python3 -m venv env/; \
2940
source env/bin/activate; \
30-
pip3 install --upgrade pip; \
31-
pip install --no-cache-dir -r tests/python/requirements.txt; \
41+
pip install --upgrade pip;\
42+
pip install --no-cache-dir -r tests/python/unit/requirements.txt; \
3243
pip install --no-cache-dir -r code-env/python/spec/requirements.txt; \
3344
export PYTHONPATH="$(PYTHONPATH):$(PWD)/python-lib"; \
34-
pytest -o junit_family=xunit2 --junitxml=unit.xml tests/python/unit || true; \
35-
deactivate; \
45+
python3 -m pytest tests/python/unit --alluredir=tests/allure_report || ret=$$?; exit $$ret \
3646
)
37-
@echo "[SUCCESS] Running unit tests: Done!"
3847

3948
integration-tests:
40-
@echo "[START] Running integration tests..."
41-
# TODO add integration tests
42-
@echo "[SUCCESS] Running integration tests: Done!"
49+
@echo "Running integration tests..."
50+
@( \
51+
rm -rf ./env/; \
52+
python3 -m venv env/; \
53+
source env/bin/activate; \
54+
pip3 install --upgrade pip;\
55+
pip install --no-cache-dir -r tests/python/integration/requirements.txt; \
56+
python3 -m pytest tests/python/integration --alluredir=tests/allure_report || ret=$$?; exit $$ret \
57+
)
4358

4459
tests: unit-tests integration-tests
4560

4661
dist-clean:
47-
rm -rf dist
62+
rm -rf dist

0 commit comments

Comments
 (0)