summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/lint.sh9
-rwxr-xr-xscripts/publish.sh39
-rwxr-xr-xscripts/test.sh43
3 files changed, 91 insertions, 0 deletions
diff --git a/scripts/lint.sh b/scripts/lint.sh
new file mode 100755
index 0000000..83f67bf
--- /dev/null
+++ b/scripts/lint.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+set -e
+
+main() {
+ uv sync --group lint
+ uv run ruff check
+}
+
+main "$@"
diff --git a/scripts/publish.sh b/scripts/publish.sh
new file mode 100755
index 0000000..c779419
--- /dev/null
+++ b/scripts/publish.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+set -e
+
+PYPI_TOKEN=""
+
+main() {
+ parse_args "$@"
+ uv build
+ uv publish --token "$PYPI_TOKEN"
+}
+
+usage() {
+ echo "Usage: $0 [-h|--help] -t|--token TOKEN"
+ echo ""
+ echo "Options:"
+ echo " -h, --help Show this help message and exit"
+ echo " -t, --token Required PyPI token for publishing the package"
+}
+
+parse_args() {
+ while [ $# -gt 0 ]; do
+ case "$1" in
+ -h | --help)
+ usage
+ exit 0
+ ;;
+ -t | --token)
+ PYPI_TOKEN="$2"
+ shift 2
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
+ esac
+ done
+}
+
+main "$@"
diff --git a/scripts/test.sh b/scripts/test.sh
new file mode 100755
index 0000000..5165512
--- /dev/null
+++ b/scripts/test.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+set -e
+
+PYTHON_VERSION=""
+
+main() {
+ parse_args "$@"
+ if [ -n "$PYTHON_VERSION" ]; then
+ uv python install "$PYTHON_VERSION"
+ uv python pin "$PYTHON_VERSION"
+ fi
+ uv sync --group test
+ uv run pytest tests/ --cov=lirc/ -v --cov-report term-missing
+}
+
+usage() {
+ echo "Usage: $0 [-h|--help] [-p|--python VERSION]"
+ echo ""
+ echo "Options:"
+ echo " -h, --help Show this help message and exit"
+ echo " -p, --python Specific python version to install and use for the test run"
+}
+
+parse_args() {
+ while [ $# -gt 0 ]; do
+ case "$1" in
+ -h | --help)
+ usage
+ exit 0
+ ;;
+ -p | --python)
+ PYTHON_VERSION="$2"
+ shift 2
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
+ esac
+ done
+}
+
+main "$@"