Skip to content

Commit f6d6216

Browse files
committed
[scripts/release_tests] Add local install script
1 parent 0d7d797 commit f6d6216

1 file changed

Lines changed: 103 additions & 0 deletions

File tree

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#!/usr/bin/env bash
2+
3+
echo
4+
echo "-- MAKE SURE TO RUN THIS SCRIPT IN INTERACTIVE MODE '-i' --"
5+
6+
PY_VER_ARRAY=("|3.5|3.6|3.7|3.8|3.9|")
7+
8+
if [[ $# != 1 ]]; then
9+
echo
10+
echo "-- [FAILED] Please provide a valid Python version: ${PY_VER_ARRAY}"
11+
exit 1
12+
fi
13+
14+
PYVER=$1
15+
16+
if [[ ! "${PY_VER_ARRAY}" =~ "|${PYVER}|" ]]; then
17+
echo
18+
echo "-- [FAILED] Please provide a valid Python version: ${PY_VER_ARRAY}"
19+
exit 1
20+
fi
21+
22+
echo
23+
echo "-- Using Python version ${PYVER}"
24+
25+
SCRIPT_DIR=$(pwd)
26+
cd ../..
27+
ROOT_DIR=$(pwd)
28+
29+
echo
30+
echo "-- Running directory check: ${ROOT_DIR}"
31+
CHECK_DIR=$(basename ${ROOT_DIR})
32+
if [[ ! "$CHECK_DIR" = "python-odml" ]]; then
33+
echo "-- [FAILED] In wrong directory ${ROOT_DIR}"
34+
exit 1
35+
fi
36+
37+
echo
38+
echo "-- Running active conda env check: ${CONDA_PREFIX}"
39+
if [[ ! -z "${CONDA_PREFIX}" ]]; then
40+
echo "-- Deactivating conda env: ${CONDA_PREFIX}"
41+
conda deactivate
42+
fi
43+
44+
CONDA_ENV_SETUP=odmlsetup${PYVER}
45+
CONDA_ENV_PIP=odmlpip${PYVER}
46+
47+
echo
48+
echo "-- Testing local pip installation"
49+
echo "-- Cleanup previous conda environment and create new one"
50+
echo
51+
conda remove -q -n ${CONDA_ENV_PIP} --all -y
52+
conda create -q -n ${CONDA_ENV_PIP} python=${PYVER} -y
53+
54+
conda activate ${CONDA_ENV_PIP}
55+
pip install -q --upgrade pip
56+
57+
echo
58+
echo "-- Local installation (pip)"
59+
echo
60+
pip install .
61+
62+
echo
63+
echo "-- Installing test dependencies"
64+
pip install -r requirements-test.txt
65+
66+
echo
67+
echo "-- Running tests"
68+
pytest -v
69+
70+
conda deactivate
71+
72+
echo
73+
echo "-- Testing local setup installation"
74+
echo "-- Cleanup previous conda environment and create new one"
75+
echo
76+
conda remove -q -n ${CONDA_ENV_SETUP} --all -y
77+
conda create -q -n ${CONDA_ENV_SETUP} python=${PYVER} -y
78+
79+
conda activate ${CONDA_ENV_SETUP}
80+
pip install -q --upgrade pip
81+
82+
echo
83+
echo "-- Local installation (setup.py)"
84+
echo
85+
python setup.py install
86+
87+
echo
88+
echo "-- Installing test dependencies"
89+
pip install -r requirements-test.txt
90+
91+
echo
92+
echo "-- Running tests"
93+
pytest -v
94+
95+
conda deactivate
96+
97+
echo
98+
echo "-- Returning to script directory ${SCRIPT_DIR}"
99+
echo
100+
cd ${SCRIPT_DIR}
101+
102+
echo "-- Done"
103+
echo

0 commit comments

Comments
 (0)