|
| 1 | +## ADDED Requirements |
| 2 | + |
| 3 | +### Requirement: Release workflow triggers on GitHub Release publish |
| 4 | +The release workflow SHALL be triggered when a GitHub Release is published (`on: release: types: [published]`). |
| 5 | + |
| 6 | +#### Scenario: Release is published via GitHub UI |
| 7 | +- **WHEN** a user publishes a GitHub Release |
| 8 | +- **THEN** the release workflow starts execution |
| 9 | + |
| 10 | +#### Scenario: Draft release is created |
| 11 | +- **WHEN** a user creates a draft release without publishing |
| 12 | +- **THEN** the release workflow SHALL NOT trigger |
| 13 | + |
| 14 | +### Requirement: Quality gate runs lint and format checks |
| 15 | +The release workflow SHALL run `ruff check .` and `ruff format --check .` as a quality gate before building. |
| 16 | + |
| 17 | +#### Scenario: Lint check passes |
| 18 | +- **WHEN** all source files pass ruff lint rules |
| 19 | +- **THEN** the workflow proceeds to the test stage |
| 20 | + |
| 21 | +#### Scenario: Lint or format check fails |
| 22 | +- **WHEN** any source file fails ruff lint or format check |
| 23 | +- **THEN** the workflow SHALL fail and NOT proceed to build or publish |
| 24 | + |
| 25 | +### Requirement: Quality gate runs tests across Python matrix |
| 26 | +The release workflow SHALL run `pytest` across Python versions 3.10, 3.12, and 3.13. |
| 27 | + |
| 28 | +#### Scenario: All tests pass on all Python versions |
| 29 | +- **WHEN** pytest passes on Python 3.10, 3.12, and 3.13 |
| 30 | +- **THEN** the workflow proceeds to the build stage |
| 31 | + |
| 32 | +#### Scenario: Tests fail on any Python version |
| 33 | +- **WHEN** pytest fails on any matrix version |
| 34 | +- **THEN** the workflow SHALL fail and NOT proceed to build or publish |
| 35 | + |
| 36 | +### Requirement: Build produces sdist and wheel artifacts |
| 37 | +The release workflow SHALL build both an sdist and a wheel using `python -m build`. |
| 38 | + |
| 39 | +#### Scenario: Successful build |
| 40 | +- **WHEN** the quality gate passes |
| 41 | +- **THEN** the workflow builds sdist and wheel artifacts in `dist/` |
| 42 | + |
| 43 | +### Requirement: Publish to PyPI using Trusted Publisher OIDC |
| 44 | +The release workflow SHALL publish to PyPI using `pypa/gh-action-pypi-publish` with OIDC authentication (no API tokens). The job SHALL use the `pypi` GitHub environment. |
| 45 | + |
| 46 | +#### Scenario: Successful publish |
| 47 | +- **WHEN** build artifacts exist and OIDC authentication succeeds |
| 48 | +- **THEN** the package is published to pypi.org |
| 49 | + |
| 50 | +#### Scenario: OIDC authentication fails |
| 51 | +- **WHEN** the Trusted Publisher configuration is missing or misconfigured |
| 52 | +- **THEN** the publish step SHALL fail with an authentication error |
| 53 | + |
| 54 | +### Requirement: Releases are signed with Sigstore attestations |
| 55 | +The release workflow SHALL enable Sigstore attestations (`attestations: true`) when publishing. |
| 56 | + |
| 57 | +#### Scenario: Package is published with attestation |
| 58 | +- **WHEN** a package is successfully published to PyPI |
| 59 | +- **THEN** Sigstore attestations SHALL be generated for the published artifacts |
| 60 | + |
| 61 | +### Requirement: Publish depends on all quality gates passing |
| 62 | +The publish job SHALL only run after lint, format, test, and build jobs all succeed. |
| 63 | + |
| 64 | +#### Scenario: Quality gate fails |
| 65 | +- **WHEN** any quality gate job (lint, test) fails |
| 66 | +- **THEN** the build and publish jobs SHALL NOT execute |
0 commit comments