-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·56 lines (54 loc) · 1.31 KB
/
Copy pathdeploy.sh
File metadata and controls
executable file
·56 lines (54 loc) · 1.31 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
#!/bin/zsh
# Deploy push2HAL weel to pypi server.
set -x
# wheel path
WHEEL_DIR=$(pwd)/dist
function wheel()
{
# Build and test wheel in an venv to check if all required files are present in
# the wheel.
# Clean-up previous version
rm $WHEEL_DIR/push2HAL*.whl
pip3 wheel . -w dist
# Setup venv
TEMP_DIR=$(mktemp -d)
python3 -m venv $TEMP_DIR
source $TEMP_DIR/bin/activate
# Change dir to test really wheel file and not the repo files
cd $TEMP_DIR
# Install the wheel
pip3 install $WHEEL_DIR/push2HAL*.whl
# Run all tests
# python3 -m push2HAL.tests
SUCCESS=$?
# Clean-up tmp directory
cd $WHEEL_DIR
trap 'rm -rf "$TEMP_DIR"' EXIT
deactivate
python -V
which python
if [ $SUCCESS -eq 0 ]
then
echo "Ready for uploading :" $(ls $WHEEL_DIR/push2HAL*.whl)
return 0
else
echo "Test failed. Stop deployment." >&2
return 1
fi
}
# Main deployment script
for i in "$@"
do
case "$i" in
-i|--install) pip install --user twine
;;
-c|--check) which python&&python -V&&twine --version&&which twine
;;
-t|--test)
wheel && twine upload --verbose -r testpypi $WHEEL_DIR/push2HAL*.whl
;;
-d|--deploy)
wheel && twine upload --verbose $WHEEL_DIR/push2HAL*.whl
;;
esac
done