Skip to content

Commit 0993222

Browse files
committed
chore: update CI workflow and project files
- Refactor CI workflow to support workflow calls and cross-platform testing - Update version to 0.0.2 in pyproject.toml - Simplify installation instructions in README.md - Add tests for CLI entry point and module execution - Enhance nus_logger.py documentation for dependencies
1 parent 11359c5 commit 0993222

6 files changed

Lines changed: 48 additions & 13 deletions

File tree

.github/workflows/ci.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
name: CI
22

33
on:
4-
push:
5-
branches: [main]
64
pull_request:
75
branches: [main]
6+
workflow_call:
7+
# Allows other workflows (e.g., publish) to invoke this CI run
8+
inputs: {}
9+
secrets: {}
810

911
jobs:
1012
test:
@@ -23,3 +25,25 @@ jobs:
2325
python -m pip install .[dev]
2426
- name: Run tests
2527
run: pytest -q
28+
29+
cross-platform:
30+
# Lightweight smoke test across OSes to catch platform issues
31+
runs-on: ${{ matrix.os }}
32+
strategy:
33+
matrix:
34+
os: [ubuntu-latest, windows-latest, macos-latest]
35+
python-version: ["3.11"]
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: actions/setup-python@v5
39+
with:
40+
python-version: ${{ matrix.python-version }}
41+
cache: "pip"
42+
- name: Install (dev extras)
43+
run: |
44+
python -m pip install --upgrade pip
45+
python -m pip install .[dev]
46+
- name: Sanity import
47+
run: python -c "import nus_logger, sys; print('nus_logger', nus_logger.__version__); print(sys.platform)"
48+
- name: Smoke tests
49+
run: pytest -q

.github/workflows/publish.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ on:
66
- main
77

88
jobs:
9+
ci:
10+
uses: ./.github/workflows/ci.yml
11+
912
build-and-publish:
13+
needs: ci
1014
runs-on: ubuntu-latest
1115
permissions:
1216
contents: read
@@ -23,9 +27,7 @@ jobs:
2327
python -m pip install build
2428
python -m build
2529
- name: Publish to PyPI (trusted publishing)
26-
if: success()
2730
uses: pypa/gh-action-pypi-publish@release/v1
28-
continue-on-error: true
2931
- name: Upload dist artifacts
3032
uses: actions/upload-artifact@v4
3133
with:

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ Auto‑reconnecting Nordic UART Service (NUS) BLE log collector for Zephyr / nRF
1919
## Installation
2020

2121
```bash
22-
pip install nus-logger # core
23-
pip install "nus-logger[color]" # with colored status output
22+
pip install nus-logger
2423
```
2524

2625
Requires Python 3.9+.

pyproject.toml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "nus-logger"
7-
version = "0.0.1"
7+
version = "0.0.2"
88
description = "Auto-reconnecting Nordic UART Service (NUS) BLE logger."
99
readme = "README.md"
1010
requires-python = ">=3.9"
@@ -28,13 +28,12 @@ classifiers = [
2828
"Typing :: Typed"
2929
]
3030
dependencies = [
31-
"bleak==0.22.2"
31+
"bleak==0.22.2",
32+
"colorama>=0.4.6; platform_system == 'Windows'" # auto color support on Windows
3233
]
3334

3435
[project.optional-dependencies]
35-
color = ["colorama>=0.4.6"]
3636
dev = ["pytest>=8.0.0", "pytest-asyncio>=0.23.0", "colorama>=0.4.6"]
37-
all = ["colorama>=0.4.6"]
3837

3938
[project.urls]
4039
Homepage = "https://github.com/smnmsr/nus-logger"
@@ -43,8 +42,6 @@ Source = "https://github.com/smnmsr/nus-logger"
4342

4443
[tool.hatch.build]
4544
exclude = ["tests", "scripts"]
46-
# Ensure PEP 561 typing marker is included
47-
include = ["src/nus_logger/py.typed"]
4845

4946
[tool.hatch.build.targets.wheel]
5047
packages = ["src/nus_logger"]

src/nus_logger/nus_logger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Scans by (substring) name, selects strongest RSSI.
55
* Reassembles newline-delimited log lines (flush on idle).
66
* Optional timestamps, raw hex, file logging, auto-reconnect with backoff.
7-
* Minimal dependencies: bleak (+ optional colorama for colored events).
7+
* Minimal dependencies: bleak (+ colorama auto-installed on Windows for colored events, optional elsewhere).
88
"""
99
from __future__ import annotations
1010

tests/test_cli_import.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import importlib
2+
3+
4+
def test_cli_entry_point_importable():
5+
# Ensure the module containing main is importable
6+
mod = importlib.import_module("nus_logger.nus_logger")
7+
assert hasattr(mod, "main")
8+
9+
10+
def test_module_exec_main():
11+
# Simulate python -m nus_logger by importing __main__
12+
m = importlib.import_module("nus_logger.__main__")
13+
assert hasattr(m, "main")

0 commit comments

Comments
 (0)