Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .altru/LESSONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# LESSONS - PostQuantum
- v0.2.0 shipped packages named 0.1.0 -> pyproject.toml had its own static version while the release check compared the tag only with __version__ -> version now read from src/pqdocket/__init__.py (hatch dynamic version); release evidence fails if an artifact name lacks the version; CI builds the package on every PR.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ jobs:
run: mypy src
- name: Test
run: pytest
- name: Build package and check its version matches the code
run: |
python -m pip install build
python -m build
version=$(python -c "import pqdocket; print(pqdocket.__version__)")
ls dist
for f in dist/*; do case "$f" in *"-$version"*) ;; *) echo "$f does not carry version $version"; exit 1;; esac; done
- name: Scan this repository and validate the report against the schema
run: |
pqdocket scan . --output pqc-report.json
Expand Down
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "pqdocket"
version = "0.1.0"
dynamic = ["version"]
description = "Evidence-led assurance for post-quantum migration: prove specific claims, not scores"
readme = "README.md"
requires-python = ">=3.11"
Expand Down Expand Up @@ -33,3 +33,7 @@ target-version = "py311"
[tool.mypy]
python_version = "3.11"
strict = true

[tool.hatch.version]
# Single source of truth for the version: src/pqdocket/__init__.py
path = "src/pqdocket/__init__.py"
4 changes: 4 additions & 0 deletions scripts/release_evidence.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ def problems(record: dict[str, Any]) -> list[str]:
found.append(f"{tests['failures']} failed, {tests['errors']} errors")
if not record["artifacts"]:
found.append("no release artifacts found")
version = record["project"]["version"]
for artifact in record["artifacts"]:
if f"-{version}" not in artifact["name"]:
found.append(f"artifact {artifact['name']} does not carry version {version}")
if not record["source"]["commit"]:
found.append("source commit unknown")
if record["source"]["uncommitted_changes"]:
Expand Down
2 changes: 1 addition & 1 deletion src/pqdocket/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
"""pqdocket: evidence-led assurance for post-quantum migration."""

__version__ = "0.2.0"
__version__ = "0.2.1"
12 changes: 11 additions & 1 deletion tests/test_release_evidence.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ def _junit(path: Path, tests: int, failures: int = 0) -> Path:
def _dist(tmp_path: Path) -> Path:
dist = tmp_path / "dist"
dist.mkdir()
(dist / "pqdocket-0.1.0-py3-none-any.whl").write_bytes(b"wheel")
from pqdocket import __version__
(dist / f"pqdocket-{__version__}-py3-none-any.whl").write_bytes(b"wheel")
return dist


Expand Down Expand Up @@ -54,3 +55,12 @@ def test_missing_artifacts_block_release(tmp_path: Path) -> None:
code = release_evidence.main(["--dist", str(tmp_path / "nothing"), "--junit",
str(_junit(tmp_path / "j.xml", 5)), "--out", str(tmp_path / "e.json")])
assert code == 1


def test_artifact_with_wrong_version_blocks_release(tmp_path: Path) -> None:
dist = tmp_path / "dist"
dist.mkdir()
(dist / "pqdocket-0.0.1-py3-none-any.whl").write_bytes(b"old")
code = release_evidence.main(["--dist", str(dist), "--junit",
str(_junit(tmp_path / "j.xml", 5)), "--out", str(tmp_path / "e.json")])
assert code == 1