Skip to content

Commit cfcb1c5

Browse files
Merge pull request #75 from codePerfectPlus/test
automating release process
2 parents fded752 + 0121e2e commit cfcb1c5

File tree

6 files changed

+121
-3
lines changed

6 files changed

+121
-3
lines changed

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@ All notable changes to this project will be documented in this file. The format
44

55
## [Unreleased]
66

7-
## Proposed Changes/features
7+
## Upcoming
88

99
- [x] Search book in the library
1010
- [x] Delete book from the library
11-
- [x] Cythonize the code
11+
- [x] Cythonize the code
12+
13+
## [3.0.0] - 07-11-2022
14+
15+
- [x] Added support for `--version` flag
16+
- [x] Added bash scripts for complete automation of the release process
1217

1318
## [V2.0.4] - 01-11-2022
1419

scripts/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Scripts
2+
3+
1. test_changes.sh - Test if the changes are valid and can be released. flake8/pytest are run and the version is checked.
4+
2. test_release.sh - Test the release on test.pypi.org.
5+
3. release.sh - Release the package to PyPI if both tests are successful.
6+
7+
8+
reference links:
9+
10+
- https://packaging.python.org/en/latest/guides/using-testpypi/

scripts/release.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
check_command() {
3+
if [ ! -x "$(command -v $1)" ]; then
4+
echo "$1 is not installed"
5+
pip install $1
6+
exit 1
7+
fi
8+
}
9+
10+
check_directory() {
11+
if [ ! -d "$1" ]; then
12+
echo "$1 is not found"
13+
exit 1
14+
fi
15+
}
16+
17+
check_file() {
18+
if [ ! -f "$1" ]; then
19+
echo "$1 is not found"
20+
exit 1
21+
fi
22+
}
23+
24+
# check if the git is installed
25+
check_command git
26+
check_command flake8
27+
check_command twine
28+
check_file setup.py
29+
python3 setup.py sdist bdist_wheel
30+
check_directory dist
31+
python3 -m twine upload dist/*
32+
33+
rm -rf dist
34+
rm -rf build
35+
rm -rf *.egg-info
36+
find . -name "*.pyc" -exec rm -rf {}\;

scripts/test_changes.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
3+
# function to check the command exist or not
4+
check_command() {
5+
if [ ! -x "$(command -v $1)" ]; then
6+
echo "$1 is not installed"
7+
pip install $1
8+
exit 1
9+
fi
10+
}
11+
12+
# check if the git is installed
13+
check_command git
14+
check_command pytest
15+
check_command flake8
16+
17+
flake8 . --isolated --exclude=.cache,.venv,.svn,CVS,.bzr,.hg,.git,__pycache__,.tox,**/migrations/** --ignore=E501,E402
18+
pytest
19+
20+
# check the exit code of the last command
21+
if [ $? -eq 0 ]; then
22+
echo "All tests passed"
23+
else
24+
echo "Some tests failed"
25+
exit 1
26+
fi
27+

scripts/test_release.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
check_command() {
3+
if [ ! -x "$(command -v $1)" ]; then
4+
echo "$1 is not installed"
5+
pip install $1
6+
exit 1
7+
fi
8+
}
9+
10+
check_directory() {
11+
if [ ! -d "$1" ]; then
12+
echo "$1 is not found"
13+
exit 1
14+
fi
15+
}
16+
17+
check_file() {
18+
if [ ! -f "$1" ]; then
19+
echo "$1 is not found"
20+
exit 1
21+
fi
22+
}
23+
24+
# check if the git is installed
25+
check_command git
26+
check_command flake8
27+
check_command twine
28+
check_file setup.py
29+
python3 setup.py sdist bdist_wheel
30+
check_directory dist
31+
python3 -m twine upload --repository testpypi dist/*
32+
33+
rm -rf dist
34+
rm -rf build
35+
rm -rf *.egg-info
36+
find . -name "*.pyc" -exec rm -rf {}\;

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@
33
with open("README.md", "r") as fh:
44
long_description = fh.read()
55

6+
with open('requirements.txt') as f:
7+
required = f.read().splitlines()
8+
69
setuptools.setup(
710
name="audiobook",
8-
version="2.0.4",
11+
version="3.0.0",
912
author="CodePerfectPlus",
1013
author_email="[email protected]",
1114
description="Listen to your favourite audiobook",
1215
long_description=long_description,
1316
long_description_content_type="text/markdown",
17+
install_requires=required,
1418
url="https://github.com/codePerfectPlus/audiobook",
1519
keywords="audiobook",
1620
packages=setuptools.find_packages(),

0 commit comments

Comments
 (0)