diff options
| -rw-r--r-- | .builds/lint-and-test.yml | 29 | ||||
| -rw-r--r-- | .builds/publish.yml | 22 | ||||
| -rw-r--r-- | .github/workflows/lint.yml | 25 | ||||
| -rw-r--r-- | .github/workflows/release.yml | 29 | ||||
| -rw-r--r-- | .github/workflows/test.yml | 51 | ||||
| -rw-r--r-- | README.rst | 7 | ||||
| -rw-r--r-- | pyproject.toml | 10 | ||||
| -rwxr-xr-x | scripts/lint.sh | 9 | ||||
| -rwxr-xr-x | scripts/publish.sh | 39 | ||||
| -rwxr-xr-x | scripts/test.sh | 43 | ||||
| -rw-r--r-- | uv.lock | 43 |
11 files changed, 145 insertions, 162 deletions
diff --git a/.builds/lint-and-test.yml b/.builds/lint-and-test.yml new file mode 100644 index 0000000..70dcc61 --- /dev/null +++ b/.builds/lint-and-test.yml @@ -0,0 +1,29 @@ +image: alpine/3.23 +packages: + - uv + - lirc +sources: + - https://git.sr.ht/~eugenetriguba/lirc +triggers: + - action: email + condition: failure + to: builds@eugenetriguba.com +tasks: + - lint: | + cd lirc + ./scripts/lint.sh + - test39: | + cd lirc + ./scripts/test.sh --python 3.9 + - test310: | + cd lirc + ./scripts/test.sh --python 3.10 + - test311: | + cd lirc + ./scripts/test.sh --python 3.11 + - test312: | + cd lirc + ./scripts/test.sh --python 3.12 + - test313: | + cd lirc + ./scripts/test.sh --python 3.13 diff --git a/.builds/publish.yml b/.builds/publish.yml new file mode 100644 index 0000000..9808df0 --- /dev/null +++ b/.builds/publish.yml @@ -0,0 +1,22 @@ +image: alpine/3.23 +submitter: + git.sr.ht: + enabled: true + allow-refs: + - "refs/tags/*" +packages: + - uv +secrets: + - 7aa95247-8be4-48d2-8bc9-f081f2151b7e +sources: + - https://git.sr.ht/~eugenetriguba/lirc +triggers: + - action: email + condition: failure + to: builds@eugenetriguba.com +tasks: + - publish: | + cd lirc + set +x + TOKEN=$(cat ~/.pypi-token) + ./scripts/publish.sh --token "$TOKEN" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index ac32d61..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Lint - -on: [push] - -jobs: - run-linters: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source code - uses: actions/checkout@v4 - - - name: Set up Poetry - run: pipx install poetry==1.8.4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: 3.13 - cache: "poetry" - - - name: Install Dependencies - run: poetry install --only=dev --only=lint - - - name: Run linters - run: poetry run task lint diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 6a8ee37..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Upload Python Package - -on: - release: - types: [created] - -jobs: - deploy: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source code - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.13" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel poetry - - - name: Build and publish - env: - PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} - PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - poetry publish --build -u $PYPI_USERNAME -p $PYPI_PASSWORD diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 63f8450..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Test - -on: [push] - -jobs: - run-tests: - runs-on: ubuntu-22.04 - strategy: - matrix: - versions: - [ - { python: "3.9", poetry: "1.8.4" }, - { python: "3.10", poetry: "1.8.4" }, - { python: "3.11", poetry: "1.8.4" }, - { python: "3.12", poetry: "1.8.4" }, - { python: "3.13", poetry: "1.8.4" }, - ] - - steps: - - name: Checkout source code - uses: actions/checkout@v4 - - - name: Set up Poetry - run: pipx install poetry==${{ matrix.versions.poetry }} - - - name: Set up Python ${{ matrix.versions.python }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.versions.python }} - cache: "poetry" - - - name: Install Dependencies - run: poetry install -v - - - name: Install system LIRC - run: sudo apt-get install lirc - - - name: Run tests - run: poetry run task test_ci - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ./coverage.xml - flags: unittests - name: codecov-umbrella - fail_ci_if_error: true - - - name: Build Package - run: poetry build @@ -1,6 +1,5 @@ LIRC Python Package =================== - .. image:: https://img.shields.io/pypi/pyversions/lirc :target: https://www.python.org/downloads/ :alt: Python Version @@ -10,9 +9,9 @@ LIRC Python Package .. image:: https://readthedocs.org/projects/lirc/badge/?version=latest :target: https://lirc.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status -.. image:: https://github.com/eugenetriguba/lirc/actions/workflows/test.yml/badge.svg?branch=main - :target: https://github.com/eugenetriguba/lirc/actions/ - :alt: Build Status +.. image:: https://builds.sr.ht/~eugenetriguba/lirc/commits/main/lint-and-test.yml.svg + :target: https://builds.sr.ht/~eugenetriguba/lirc/commits/main/lint-and-test.yml + :alt: builds.sr.ht status .. image:: https://codecov.io/gh/eugenetriguba/lirc/graph/badge.svg :target: https://codecov.io/gh/eugenetriguba/lirc :alt: Code Coverage diff --git a/pyproject.toml b/pyproject.toml index 498403a..086cab6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,20 +27,10 @@ dependencies = [] Repository = "https://sr.ht/eugenetriguba/lirc" [dependency-groups] -dev = ["taskipy>=1.13.0"] lint = ["ruff>=0.7.0"] test = ["pytest>=8.3.3", "pytest-cov>=5.0.0", "codecov>=2.1.13"] release = ["bump2version>=1.0.1"] -[tool.taskipy.tasks] -test = "task test_cov_missing" -test_unit = "pytest tests/" -test_cov = "task test_unit --cov=lirc/" -test_cov_missing = "task test_cov -v --cov-report term-missing" -test_ci = "task test_cov --cov-report=xml" -lint = "ruff check" -lint_fix = "ruff check --fix" - [tool.ruff] line-length = 88 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 "$@" @@ -429,9 +429,6 @@ version = "3.0.0" source = { editable = "." } [package.dev-dependencies] -dev = [ - { name = "taskipy" }, -] lint = [ { name = "ruff" }, ] @@ -448,7 +445,6 @@ test = [ [package.metadata] [package.metadata.requires-dev] -dev = [{ name = "taskipy", specifier = ">=1.13.0" }] lint = [{ name = "ruff", specifier = ">=0.7.0" }] release = [{ name = "bump2version", specifier = ">=1.0.1" }] test = [ @@ -458,15 +454,6 @@ test = [ ] [[package]] -name = "mslex" -version = "1.3.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/e0/97/7022667073c99a0fe028f2e34b9bf76b49a611afd21b02527fbfd92d4cd5/mslex-1.3.0.tar.gz", hash = "sha256:641c887d1d3db610eee2af37a8e5abda3f70b3006cdfd2d0d29dc0d1ae28a85d", size = 11583, upload-time = "2024-10-16T13:16:18.523Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/64/f2/66bd65ca0139675a0d7b18f0bada6e12b51a984e41a76dbe44761bf1b3ee/mslex-1.3.0-py3-none-any.whl", hash = "sha256:c7074b347201b3466fc077c5692fbce9b5f62a63a51f537a53fbbd02eff2eea4", size = 7820, upload-time = "2024-10-16T13:16:17.566Z" }, -] - -[[package]] name = "packaging" version = "26.0" source = { registry = "https://pypi.org/simple" } @@ -485,21 +472,6 @@ wheels = [ ] [[package]] -name = "psutil" -version = "6.1.1" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/1f/5a/07871137bb752428aa4b659f910b399ba6f291156bdea939be3e96cae7cb/psutil-6.1.1.tar.gz", hash = "sha256:cf8496728c18f2d0b45198f06895be52f36611711746b7f30c464b422b50e2f5", size = 508502, upload-time = "2024-12-19T18:21:20.568Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/61/99/ca79d302be46f7bdd8321089762dd4476ee725fce16fc2b2e1dbba8cac17/psutil-6.1.1-cp36-abi3-macosx_10_9_x86_64.whl", hash = "sha256:fc0ed7fe2231a444fc219b9c42d0376e0a9a1a72f16c5cfa0f68d19f1a0663e8", size = 247511, upload-time = "2024-12-19T18:21:45.163Z" }, - { url = "https://files.pythonhosted.org/packages/0b/6b/73dbde0dd38f3782905d4587049b9be64d76671042fdcaf60e2430c6796d/psutil-6.1.1-cp36-abi3-macosx_11_0_arm64.whl", hash = "sha256:0bdd4eab935276290ad3cb718e9809412895ca6b5b334f5a9111ee6d9aff9377", size = 248985, upload-time = "2024-12-19T18:21:49.254Z" }, - { url = "https://files.pythonhosted.org/packages/17/38/c319d31a1d3f88c5b79c68b3116c129e5133f1822157dd6da34043e32ed6/psutil-6.1.1-cp36-abi3-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b6e06c20c05fe95a3d7302d74e7097756d4ba1247975ad6905441ae1b5b66003", size = 284488, upload-time = "2024-12-19T18:21:51.638Z" }, - { url = "https://files.pythonhosted.org/packages/9c/39/0f88a830a1c8a3aba27fededc642da37613c57cbff143412e3536f89784f/psutil-6.1.1-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:97f7cb9921fbec4904f522d972f0c0e1f4fabbdd4e0287813b21215074a0f160", size = 287477, upload-time = "2024-12-19T18:21:55.306Z" }, - { url = "https://files.pythonhosted.org/packages/47/da/99f4345d4ddf2845cb5b5bd0d93d554e84542d116934fde07a0c50bd4e9f/psutil-6.1.1-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:33431e84fee02bc84ea36d9e2c4a6d395d479c9dd9bba2376c1f6ee8f3a4e0b3", size = 289017, upload-time = "2024-12-19T18:21:57.875Z" }, - { url = "https://files.pythonhosted.org/packages/38/53/bd755c2896f4461fd4f36fa6a6dcb66a88a9e4b9fd4e5b66a77cf9d4a584/psutil-6.1.1-cp37-abi3-win32.whl", hash = "sha256:eaa912e0b11848c4d9279a93d7e2783df352b082f40111e078388701fd479e53", size = 250602, upload-time = "2024-12-19T18:22:08.808Z" }, - { url = "https://files.pythonhosted.org/packages/7b/d7/7831438e6c3ebbfa6e01a927127a6cb42ad3ab844247f3c5b96bea25d73d/psutil-6.1.1-cp37-abi3-win_amd64.whl", hash = "sha256:f35cfccb065fff93529d2afb4a2e89e363fe63ca1e4a5da22b603a85833c2649", size = 254444, upload-time = "2024-12-19T18:22:11.335Z" }, -] - -[[package]] name = "pygments" version = "2.19.2" source = { registry = "https://pypi.org/simple" } @@ -607,21 +579,6 @@ wheels = [ ] [[package]] -name = "taskipy" -version = "1.14.1" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "colorama" }, - { name = "mslex", marker = "sys_platform == 'win32'" }, - { name = "psutil" }, - { name = "tomli", marker = "python_full_version < '4.0'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/c7/44/572261df3db9c6c3332f8618fafeb07a578fd18b06673c73f000f3586749/taskipy-1.14.1.tar.gz", hash = "sha256:410fbcf89692dfd4b9f39c2b49e1750b0a7b81affd0e2d7ea8c35f9d6a4774ed", size = 14475, upload-time = "2024-11-26T16:37:46.155Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/55/97/4e4cfb1391c81e926bebe3d68d5231b5dbc3bb41c6ba48349e68a881462d/taskipy-1.14.1-py3-none-any.whl", hash = "sha256:6e361520f29a0fd2159848e953599f9c75b1d0b047461e4965069caeb94908f1", size = 13052, upload-time = "2024-11-26T16:37:44.546Z" }, -] - -[[package]] name = "tomli" version = "2.4.0" source = { registry = "https://pypi.org/simple" } |