feat: pypi publishing and automation#1
Merged
Merged
Conversation
astral-sh/setup-uv only publishes exact tags in the v8 line; there's no floating v8 tag (unlike v7.6, v7, etc.). v8 reference broke 'variants' and 'camas_check' on PR #1.
There was a problem hiding this comment.
Pull request overview
This PR introduces a PyPI-oriented packaging toolchain for Zephyr HCI firmware (manifest-driven), wires CI to derive its build matrix from the manifest, and bumps the Zephyr dependency to v4.4.0.
Changes:
- Bump Zephyr revision in
west.ymltov4.4.0and add apypi/firmware/manifest.tomlas the single source of truth for firmware variants + SHA256s. - Add Python tooling under
pypi/tools/to build firmware variants, refresh manifest SHA256s, emit a GitHub Actions matrix, and render/build sibling + umbrella PyPI packages. - Update CI to generate the build matrix from the manifest, add a camas-based lint/mypy/pytest job, and add a tag-triggered PyPI publish flow.
Reviewed changes
Copilot reviewed 16 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
west.yml |
Updates Zephyr project revision to v4.4.0. |
pypi/uv.lock |
Adds a uv lockfile for the PyPI tooling environment. |
pypi/tools/update_manifest.py |
Adds a CLI to recompute and write SHA256s into the firmware manifest from built .hex artifacts. |
pypi/tools/emit_ci_matrix.py |
Emits firmware/manifest.toml variants as a GitHub Actions matrix. |
pypi/tools/build_fw_packages.py |
Renders and builds sibling + umbrella distributions from the manifest and verified artifacts. |
pypi/tools/build_firmware.py |
Adds a CLI to build one manifest variant and collect it into canonical artifact naming. |
pypi/tools/_templates.py |
Defines templates for generated sibling/umbrella package source files and metadata. |
pypi/tools/_model.py |
Introduces immutable NamedTuple-based models for manifest/spec/results. |
pypi/tests/test_build_fw_packages.py |
Adds unit/integration-style coverage for manifest parsing, SHA verification, and package building/install smoke tests. |
pypi/tests/conftest.py |
Provides synthetic firmware artifacts + manifest fixtures for tests. |
pypi/tasks.py |
Adds camas tasks for build/update/check/wheel workflows. |
pypi/README.md |
Documents the purpose of the pypi/ tooling directory. |
pypi/pyproject.toml |
Defines the PyPI tooling project and dev tooling configuration (ruff/mypy/pytest). |
pypi/firmware/manifest.toml |
Adds the firmware variant manifest and expected SHA256s for Zephyr v4.4.0. |
pypi/.pythonversion |
Pins the Python version for the pypi/ tool environment. |
pypi/.gitignore |
Adds ignores for Python artifacts and dist/ under pypi/. |
.gitignore |
Adjusts build output ignore patterns. |
.github/workflows/ci.yaml |
Makes the build matrix data-driven from the manifest; adds camas check + tag publish jobs; updates permissions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
PR branch push triggered both push (no branch filter) and pull_request, running the entire matrix twice. Restrict push to main + tags so feature branch CI runs once via pull_request only.
Two PR review nits from Copilot: - verify_sha() crashed with bare FileNotFoundError if a .hex was absent from --artifacts. Add MissingArtifact to the BuildResult sum type so main() can aggregate missing+mismatched failures and print a single clear diagnostic per variant before exiting 1. - render_package()'s match was exhaustive but had no default arm, so a future BuildSpec variant could silently fall through. assert_never() makes the closed-set assumption load-bearing under mypy. Adds tests for both new code paths (verify_sha returns MissingArtifact, main aborts on missing artifacts) -- now 12 passing tests in the suite.
build_firmware and emit_ci_matrix already used Path(__file__)-relative
defaults; build_fw_packages and update_manifest used a cwd-relative
Path("firmware/manifest.toml") that only worked when invoked from pypi/.
Unify on the __file__-anchored absolute pattern so `python -m
tools.<script>` is reliable from any cwd.
Also fix update_manifest's docstring example, which still showed the
pre-reorg layout (--artifacts ./build-hexes from pypi/).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.