-
Notifications
You must be signed in to change notification settings - Fork 388
/
deploy.sh
executable file
·57 lines (45 loc) · 1.18 KB
/
deploy.sh
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
#!/usr/bin/env bash
set -e
PYTORCH_VERSION=${PYTORCH_VERSION:-""}
PYTHON_VERSION="3.6"
TWINE_VERSION="1.12.1"
CONDA_ENV="skorch-deploy"
CONDA_ENV_YML="environment.yml"
DEV_REQ="requirements-dev.txt"
if [[ $# -gt 1 ]] || [[ $1 != "live" && $1 != "stage" ]]; then
echo "Usage $0 [live|stage]" >&2
exit 1
fi
if [ -z "$PYTORCH_VERSION" ]; then
echo "Set a PYTORCH_VERSION in the environment!"
exit 1
fi
conda update -q -y conda
# Remove previous deploy environment
set +e
conda env remove -y -n $CONDA_ENV
set -e
conda env create -q -n $CONDA_ENV -f $CONDA_ENV_YML "python=${PYTHON_VERSION}"
remove_env() {
source deactivate
conda env remove -q -y -n $CONDA_ENV
if [ -d build ]; then
rm -rf build
fi
if [ -d dist ]; then
rm -rf dist
fi
}
trap remove_env EXIT
source activate $CONDA_ENV
conda install -q -y "--file=${DEV_REQ}"
conda install -q -y "twine==${TWINE_VERSION}"
conda install -c pytorch -y "pytorch==${PYTORCH_VERSION}"
python setup.py install
pytest -x
python setup.py sdist bdist_wheel
if [[ $1 == "live" ]]; then
twine upload dist/*$(cat VERSION)*
else
twine upload --repository-url https://test.pypi.org/legacy/ dist/*$(cat VERSION)*
fi