-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·96 lines (81 loc) · 2.7 KB
/
run.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
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
92
93
94
95
96
#!/usr/bin/env bash
_CODE=
_CODE="${_CODE}import hello_world_normanius as hello;"
_CODE="${_CODE}print('>>> Current version:', hello.__version__)"
echo
echo
echo "###########################################################"
echo "# TEST 1: FAILURE"
echo "###########################################################"
_VERSION="0.1.0"
echo ">>> Building source distribution package..."
rm -rf build
rm -rf dist
rm -rf hello_world_normanius.egg-info
echo -en "$_VERSION\n" > VERSION
python setup.py sdist
echo
echo ">>> deploying package to TestPyPI (requires an account)"
twine upload --repository testpypi dist/*
echo
echo ">>> Sleeping for 20s..."
sleep 30s
echo
echo ">>> Install v${_VERSION} via TestPyPI (failure)"
rm -rf hello_world_normanius.egg-info
pip uninstall -y hello_world_normanius
# Check twice, the first time the upload usually isn't available yet.
pip install --index-url https://test.pypi.org/simple/ \
--no-deps hello_world_normanius==$_VERSION
pip install --index-url https://test.pypi.org/simple/ \
--no-deps hello_world_normanius==$_VERSION
# python -c "$_CODE"
echo
echo
echo "###########################################################"
echo "# TEST 2: FIX BY REMOVING pyproject.toml"
echo "###########################################################"
_VERSION="0.2.0"
mkdir tmp
mv pyproject.toml tmp
echo ">>> Building source distribution package..."
rm -rf build
rm -rf dist
rm -rf hello_world_normanius.egg-info
echo -en "$_VERSION\n" > VERSION
python setup.py sdist
echo
echo ">>> deploying package to TestPyPI (requires an account)"
twine upload --repository testpypi dist/*
echo
echo ">>> Sleeping for 20s..."
sleep 30s
echo
echo ">>> Install v$_VERSION via TestPyPI (now it works)"
rm -rf hello_world_normanius.egg-info
pip uninstall -y hello_world_normanius
# Check twice, the first time the upload usually isn't available yet.
pip install --index-url https://test.pypi.org/simple/ \
--no-deps hello_world_normanius==$_VERSION
pip install --index-url https://test.pypi.org/simple/ \
--no-deps hello_world_normanius==$_VERSION
python -c "$_CODE"
echo
echo
echo "###########################################################"
echo "# TEST 3: FIX BY LOCAL INSTALLATION"
echo "###########################################################"
_VERSION="0.3.0"
mv tmp/pyproject.toml .
echo ">>> Building source distribution package..."
rm -rf build
rm -rf dist
rm -rf hello_world_normanius.egg-info
echo -en "$_VERSION\n" > VERSION
python setup.py sdist
echo
echo ">>> Install v$_VERSION local build (also works)"
rm -rf hello_world_normanius.egg-info
pip uninstall -y hello_world_normanius
pip install --no-deps "dist/hello_world_normanius-$_VERSION.tar.gz"
python -c "$_CODE"