Skip to content

Commit f464a07

Browse files
committed
pypi updates and upgrade ci versions
1 parent 8a9405f commit f464a07

6 files changed

Lines changed: 38 additions & 28 deletions

File tree

.github/workflows/README.md

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# GitHub Actions Workflows
22

3-
This directory contains GitHub Actions workflows for automated testing and code quality checks.
3+
This directory contains GitHub Actions workflows for automated testing, code quality checks, and releases.
44

55
## Workflows
66

@@ -10,8 +10,8 @@ This directory contains GitHub Actions workflows for automated testing and code
1010
- **Matrix**: Python 3.10, 3.12
1111
- **Purpose**: Run comprehensive test suite with coverage reporting
1212
- **Features**:
13-
- Automatic git submodule initialization for `bluetooth_sig` dependency
14-
- Test execution with pytest and coverage reporting (76% coverage)
13+
- Automatic git submodule initialisation for `bluetooth_sig` dependency
14+
- Test execution with pytest and coverage reporting (85% threshold)
1515
- Coverage upload to Codecov for Python 3.12 runs
1616
- Uses project configuration from `pyproject.toml`
1717

@@ -23,9 +23,18 @@ This directory contains GitHub Actions workflows for automated testing and code
2323
- **Tools**:
2424
- **ruff**: Formatting and linting
2525
- **mypy**: strict for production code, lenient for tests/examples
26-
2726
- **Environment Setup**: All tools run via `python -m` to ensure proper configuration loading
2827

28+
### Release (`release.yml`)
29+
30+
- **Trigger**: Push of a `v*.*.*` tag (e.g. `v0.1.0`)
31+
- **Purpose**: Build, publish to PyPI, and create a GitHub Release
32+
- **Jobs**:
33+
1. **build** — builds sdist + wheel using `hatchling`, verifies with `twine check`
34+
2. **publish-pypi** — publishes to PyPI via trusted publisher (OIDC). Requires the `pypi` GitHub environment.
35+
3. **github-release** — generates release notes with `git-cliff` and creates a GitHub Release with the distribution artefacts.
36+
- **Prerequisites**: The repository must have a `pypi` environment configured with PyPI trusted publisher credentials.
37+
2938
## Local Development
3039

3140
To run the same checks locally:
@@ -34,17 +43,18 @@ To run the same checks locally:
3443
# Install development dependencies
3544
pip install -e ".[dev]"
3645

37-
# Initialize git submodules (required for UUID registry)
46+
# Initialise git submodules (required for UUID registry)
3847
git submodule update --init --recursive
3948

4049
# Run tests with coverage
41-
python -m pytest tests/ --cov=src/ble_gatt_device --cov-report=term-missing
50+
python -m pytest tests/ --cov=src/bluetooth_sig --cov-report=term-missing
51+
52+
# Run linting
53+
python -m ruff check src/ tests/
54+
python -m ruff format --check src/ tests/
4255

43-
# Run linting tools (use python -m for proper configuration loading)
44-
python -m flake8 src/ tests/ --count --statistics
45-
python -m black --check --diff src/ tests/
46-
python -m isort --check-only --diff src/ tests/
47-
python -m pylint src/ble_gatt_device/ --exit-zero --score y
56+
# Run type checking
57+
python -m mypy src/bluetooth_sig/
4858
```
4959

5060
## Environment Setup Requirements
@@ -54,21 +64,18 @@ python -m pylint src/ble_gatt_device/ --exit-zero --score y
5464
When testing locally or in agent environments, ensure:
5565

5666
1. **Python 3.11+** is available
57-
1. **Git submodules** are initialized: `git submodule update --init --recursive`
67+
1. **Git submodules** are initialised: `git submodule update --init --recursive`
5868
1. **Package installation** in development mode: `pip install -e ".[dev]"`
5969
1. **Tool execution** via Python modules: Use `python -m tool_name` instead of direct commands
60-
1. **Configuration loading**: flake8-pyproject allows flake8 to read from `pyproject.toml`
6170

6271
### Key Environment Dependencies
6372

6473
- Git submodule `bluetooth_sig` must be present for UUID registry functionality
65-
- All linting tools should be run via `python -m` to ensure proper configuration loading
66-
- Black handles most formatting that would trigger flake8 style errors
74+
- All linting/formatting is handled by `ruff` — configured in `pyproject.toml`
6775

6876
## Notes
6977

70-
- All tool configurations are defined in `pyproject.toml` (no separate `.flake8` file)
71-
- Workflows use `--exit-zero` for pylint to prevent CI failures on minor issues
72-
- Coverage reporting is optional and won't fail the build
73-
- Git submodules are automatically initialized for the Bluetooth SIG UUID registry dependency
78+
- All tool configurations are defined in `pyproject.toml`
79+
- Coverage threshold is 85% (`--cov-fail-under=85`)
80+
- Git submodules are automatically initialised for the Bluetooth SIG UUID registry dependency
7481
- Use `python -m` prefix for all tools to ensure proper package and configuration loading

.github/workflows/copilot-setup-steps.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
cache-dependency-path: 'pyproject.toml'
4141

4242
- name: Cache system dependencies
43-
uses: actions/cache@v4
43+
uses: actions/cache@v5
4444
with:
4545
path: /var/cache/apt
4646
key: ${{ runner.os }}-apt-copilot-${{ hashFiles('scripts/install-deps.sh') }}

.github/workflows/lint-check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
cache-dependency-path: 'pyproject.toml'
3333

3434
- name: 'Cache system dependencies'
35-
uses: actions/cache@v4
35+
uses: actions/cache@v5
3636
with:
3737
path: /var/cache/apt
3838
key: ${{ runner.os }}-apt-lint-${{ hashFiles('scripts/install-deps.sh') }}
@@ -73,7 +73,7 @@ jobs:
7373
cache-dependency-path: 'pyproject.toml'
7474

7575
- name: 'Cache system dependencies'
76-
uses: actions/cache@v4
76+
uses: actions/cache@v5
7777
with:
7878
path: /var/cache/apt
7979
key: ${{ runner.os }}-apt-lint-${{ hashFiles('scripts/install-deps.sh') }}

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141

4242
publish-pypi:
4343
name: Publish to PyPI
44-
needs: publish-testpypi
44+
needs: build
4545
runs-on: ubuntu-latest
4646
timeout-minutes: 10
4747
environment: pypi

.github/workflows/test-coverage.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,14 @@ jobs:
145145
# don't require a token when not pushing pages
146146

147147
- name: Upload benchmark baseline cache
148-
uses: actions/cache@v4
148+
uses: actions/cache@v5
149149
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
150150
with:
151151
path: ./cache
152152
key: ${{ runner.os }}-benchmark
153153

154154
- name: Download previous benchmark data
155-
uses: actions/cache@v4
155+
uses: actions/cache@v5
156156
if: github.event_name == 'pull_request'
157157
with:
158158
path: ./cache
@@ -221,7 +221,7 @@ jobs:
221221
summary-always: true
222222

223223
- name: Download previous benchmark history
224-
uses: dawidd6/action-download-artifact@v12
224+
uses: dawidd6/action-download-artifact@v16
225225
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
226226
continue-on-error: true
227227
with:
@@ -302,7 +302,7 @@ jobs:
302302
continue-on-error: true
303303

304304
- name: Download benchmark history
305-
uses: dawidd6/action-download-artifact@v12
305+
uses: dawidd6/action-download-artifact@v16
306306
continue-on-error: true
307307
with:
308308
name: benchmark-history
@@ -383,7 +383,7 @@ jobs:
383383
pip install -e ".[test]"
384384
385385
- name: Cache Playwright browsers
386-
uses: actions/cache@v4
386+
uses: actions/cache@v5
387387
id: playwright-cache
388388
with:
389389
path: ~/.cache/ms-playwright

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ packages = ["src/bluetooth_sig"]
144144
[tool.hatch.build.targets.wheel.force-include]
145145
"bluetooth_sig" = "bluetooth_sig/bluetooth_sig"
146146

147+
[tool.hatch.build.targets.sdist.force-include]
148+
"bluetooth_sig" = "bluetooth_sig/bluetooth_sig"
149+
147150
[tool.hatch.metadata]
148151
allow-direct-references = true
149152

0 commit comments

Comments
 (0)