From 6e4943a50ad7ed4d6ca4171a43b18aa713537edc Mon Sep 17 00:00:00 2001 From: Lee Huffman Date: Fri, 22 Dec 2023 10:39:59 -0600 Subject: [PATCH] add: tools for deployment --- bin/build.sh | 17 +++++++++++++++++ bin/publish-pypi.sh | 13 +++++++++++++ bin/run_tests.sh | 10 ++++++++++ 3 files changed, 40 insertions(+) create mode 100755 bin/build.sh create mode 100755 bin/publish-pypi.sh create mode 100755 bin/run_tests.sh diff --git a/bin/build.sh b/bin/build.sh new file mode 100755 index 0000000..edf72a9 --- /dev/null +++ b/bin/build.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Activate virtual environment +source venv/bin/activate + +# Run tests first +venv/bin/python -m pytest tests/ +if [ $? -ne 0 ]; then + echo "Tests failed, aborting build." + exit 1 +fi + +# Build the package +python setup.py sdist bdist_wheel + +# Deactivate the virtual environment +deactivate diff --git a/bin/publish-pypi.sh b/bin/publish-pypi.sh new file mode 100755 index 0000000..682b289 --- /dev/null +++ b/bin/publish-pypi.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Activate virtual environment +source venv/bin/activate + +# Optional: Run tests again or build +./build.sh + +# Push to PyPI +twine upload dist/* + +# Deactivate the virtual environment +deactivate diff --git a/bin/run_tests.sh b/bin/run_tests.sh new file mode 100755 index 0000000..b5addd7 --- /dev/null +++ b/bin/run_tests.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Activate virtual environment +source venv/bin/activate + +# Run tests using the Python interpreter from the virtual environment +venv/bin/python -m pytest tests/ + +# Deactivate the virtual environment +deactivate