-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
91 lines (73 loc) · 3.35 KB
/
Makefile
File metadata and controls
91 lines (73 loc) · 3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
.DEFAULT_GOAL := plugin
# Makefile variables set automatically
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`
HYPER_API_ZIP_URL := https://downloads.tableau.com/tssoftware//tableauhyperapi-java-linux-x86_64-release-main.0.0.22502.r99d1cc31.zip
HYPER_API_ZIP_FILE := tableauhyperapi.zip
HYPERD_TARGET_BINARY := java-lib/hyper/hyperd
$(HYPERD_TARGET_BINARY):
@echo "[DEPENDENCY] Downloading Tableau Hyper API binary..."
@mkdir -p $(dir $(HYPERD_TARGET_BINARY))
@curl -L -o $(HYPER_API_ZIP_FILE) $(HYPER_API_ZIP_URL)
@mkdir -p tmp_unzip
@unzip -q $(HYPER_API_ZIP_FILE) -d tmp_unzip
@mv tmp_unzip/*/lib/hyper/hyperd $(HYPERD_TARGET_BINARY)
@chmod +x $(HYPERD_TARGET_BINARY)
@rm $(HYPER_API_ZIP_FILE)
@rm -rf tmp_unzip
@echo "[DEPENDENCY] Tableau Hyper API binary is ready at $(HYPERD_TARGET_BINARY)"
download-deps: $(HYPERD_TARGET_BINARY)
@ant download-test-deps
build:
@ant clean
@ant
plugin: $(HYPERD_TARGET_BINARY) build
@echo "[START] Archiving plugin to dist/ folder..."
@rm -rf dist
@mkdir dist
@echo "{\"remote_url\":\"${remote_url}\",\"last_commit_id\":\"${last_commit_id}\"}" > release_info.json
@zip -r -9 dist/$(archive_file_name) . -x ".git/*" "dist/*" "env/*" "tmp_unzip/*" "tests/*" "data/*" "*.zip" ".idea/*" "*.DS_Store" "Makefile" "build.xml" "Jenkinsfile" ".gitignore"
@zip -g -j dist/$(archive_file_name) release_info.json
@rm release_info.json
@echo "[SUCCESS] Archiving plugin to dist/ folder: Done!"
unit-tests: java-unit-tests python-unit-tests
@echo "[SUCCESS] All unit tests completed!"
java-unit-tests:
@echo "[START] Running Java unit tests..."
@ant test
@echo "[SUCCESS] Java unit tests: Done!"
python-unit-tests:
@echo "[START] Running Python unit tests..."
@( \
PYTHON_VERSION=`python3 -V 2>&1 | sed 's/[^0-9]*//g' | cut -c 1,2`; \
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']]);"`; \
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; \
)
@( \
python3 -m venv env/; \
source env/bin/activate; \
pip3 install --upgrade pip; \
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 \
)
@echo "[SUCCESS] Python unit tests: Done!"
integration-tests:
@echo "Running integration tests..."
@( \
rm -rf ./env/; \
python3 -m venv env/; \
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 \
)
tests: unit-tests integration-tests
dist-clean:
rm -rf dist
clean: dist-clean
@ant clean