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: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
dist/*.tar.gz
dist/*.json
dist/SHA256SUMS
- uses: softprops/action-gh-release@v2
- uses: softprops/action-gh-release@v3
with:
files: |
dist/*.whl
Expand Down
42 changes: 42 additions & 0 deletions tests/contract/test_release_workflow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from pathlib import Path


ROOT = Path(__file__).resolve().parents[2]
RELEASE_WORKFLOW = ROOT / ".github" / "workflows" / "release.yml"


def test_release_workflow_preserves_publish_contract() -> None:
text = RELEASE_WORKFLOW.read_text(encoding="utf-8")

for required in (
'tags: ["v*"]',
"contents: write",
"id-token: write",
"attestations: write",
"uses: softprops/action-gh-release@v3",
"generate_release_notes: true",
"dist/*.whl",
"dist/*.tar.gz",
"dist/*.json",
"dist/SHA256SUMS",
"uses: pypa/gh-action-pypi-publish@release/v1",
):
assert required in text, f"release workflow lost required contract: {required}"

release_index = text.index("uses: softprops/action-gh-release@v3")
cleanup_index = text.index("Clean dist for PyPI")
publish_index = text.index("uses: pypa/gh-action-pypi-publish@release/v1")
assert release_index < cleanup_index < publish_index


def test_release_workflow_uses_reproducible_python_environment() -> None:
text = RELEASE_WORKFLOW.read_text(encoding="utf-8")
for required in (
"PIP_CONSTRAINT: constraints/ci.txt",
"PIP_BUILD_CONSTRAINT: constraints/ci.txt",
"cache-dependency-path:",
"constraints/ci.txt",
'python -m pip install --upgrade "pip==26.1.2"',
'python -m pip install -e ".[dev]"',
):
assert required in text, f"release workflow lost reproducibility contract: {required}"