-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding scripts for release automation (#49)
- Loading branch information
1 parent
97a1096
commit 41da8a2
Showing
7 changed files
with
147 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Scripts | ||
|
||
1. test_changes.sh - Test if the changes are valid and can be released. flake8/pytest are run and the version is checked. | ||
2. test_release.sh - Test the release on test.pypi.org. | ||
3. release.sh - Release the package to PyPI if both tests are successful. | ||
|
||
|
||
reference links: | ||
|
||
- https://packaging.python.org/en/latest/guides/using-testpypi/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
if ! [ -x "$(command -v flake8)" ]; then | ||
echo 'Error: flake8 is not installed.' >&2 | ||
echo 'Installing flake8...' | ||
pip install flake8 | ||
fi | ||
|
||
if ! [ -x "$(command -v twine)" ]; then | ||
echo 'Error: twine is not installed.' >&2 | ||
echo 'Installing twine...' | ||
pip install twine | ||
fi | ||
|
||
check_command() { | ||
if [ ! -x "$(command -v $1)" ]; then | ||
echo "$1 is not installed" | ||
pip install $1 | ||
exit 1 | ||
fi | ||
} | ||
|
||
# check if the git is installed | ||
check_command git | ||
check_command flake8 | ||
check_command twine | ||
|
||
if ! [ -f "setup.py" ]; then | ||
echo 'Error: setup.py is not found.' >&2 | ||
exit 1 | ||
fi | ||
|
||
python3 setup.py sdist bdist_wheel | ||
|
||
check_directory() { | ||
if [ ! -d "$1" ]; then | ||
echo "$1 is not found" | ||
exit 1 | ||
fi | ||
} | ||
|
||
# check if the dist folder is exist | ||
check_directory dist | ||
|
||
python3 -m twine upload dist/* | ||
|
||
rm -rf dist | ||
rm -rf build | ||
rm -rf *.egg-info | ||
find . -name "*.pyc" -exec rm -rf {}\; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/sh | ||
|
||
# function to check the command exist or not | ||
check_command() { | ||
if [ ! -x "$(command -v $1)" ]; then | ||
echo "$1 is not installed" | ||
pip install $1 | ||
exit 1 | ||
fi | ||
} | ||
|
||
# check if the git is installed | ||
check_command git | ||
check_command pytest | ||
check_command flake8 | ||
|
||
# run flask8 and pytest | ||
|
||
flake8 | ||
pytest -e | ||
|
||
# check the exit code of the last command | ||
if [ $? -eq 0 ]; then | ||
echo "All tests passed" | ||
else | ||
echo "Some tests failed" | ||
exit 1 | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
check_command() { | ||
if [ ! -x "$(command -v $1)" ]; then | ||
echo "$1 is not installed" | ||
pip install $1 | ||
exit 1 | ||
fi | ||
} | ||
|
||
# check if the git is installed | ||
check_command git | ||
check_command flake8 | ||
check_command twine | ||
|
||
if ! [ -f "setup.py" ]; then | ||
echo 'Error: setup.py is not found.' >&2 | ||
exit 1 | ||
fi | ||
|
||
python3 setup.py --repository testpypi dist/* | ||
|
||
check_directory() { | ||
if [ ! -d "$1" ]; then | ||
echo "$1 is not found" | ||
exit 1 | ||
fi | ||
} | ||
|
||
# check if the dist folder is exist | ||
check_directory dist | ||
|
||
python3 -m twine upload --repository testpypi dist/* | ||
|
||
rm -rf dist | ||
rm -rf build | ||
rm -rf *.egg-info | ||
find . -name "*.pyc" -exec rm -rf {}\; |
This file was deleted.
Oops, something went wrong.