From 2b6d04c10ac179cd23d180d9008021fbca968aad Mon Sep 17 00:00:00 2001 From: Jimisola Date: Sun, 22 Nov 2026 09:25:26 +0000 Subject: [PATCH 1/9] ci: call shared Python workflows (#385) Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01Mt2FAXPoMhrbjtWKhBTwZM Signed-off-by: Jimisola --- .github/workflows/build.yml | 103 +++++++++++++++--------------------- .github/workflows/lint.yml | 31 ----------- 2 files changed, 44 insertions(+), 90 deletions(-) delete mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5864c4d..dce2057 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,67 +29,52 @@ permissions: contents: read jobs: - linting: - name: Reuse linting job - uses: ./.github/workflows/lint.yml + lint: + uses: reqstool/.github/.github/workflows/python-lint.yml@ci/385-shared-python-build # SPIKE: pin to release SHA + with: + package-manager: poetry build: - needs: linting - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - reqstool-source: [pypi, main] - steps: - # Full history and tags: poetry-dynamic-versioning derives the version from git state, so a - # shallow clone would build the wrong number rather than fail. - - name: Check out source repository - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - fetch-depth: 0 - fetch-tags: true - ref: ${{ inputs.ref || github.ref }} - - name: Set up Python - uses: actions/setup-python@v7.1.0 - with: - python-version: "3.13.18" - - name: Install and configure Poetry - uses: snok/install-poetry@a783c322200f0519c7926aa6faa857c4e23e9263 # v1.4.2 - with: - version: 2.5.1 - virtualenvs-create: true - - name: Install poetry-dynamic-versioning - run: poetry self add "poetry-dynamic-versioning[plugin]" - - name: Install dependencies - run: poetry install --with dev - - name: Build wheel (used by e2e tests) - run: poetry build --format wheel - - name: Install plugin into Poetry (activates it for e2e tests) - run: poetry self add $(ls $PWD/dist/reqstool_python_poetry_plugin-*.whl | tail -1) - - name: Run tests - run: poetry run pytest --junitxml=build/junit.xml --cov --cov-report=xml:build/coverage.xml - - name: Build project - run: poetry build - - name: Install reqstool - uses: reqstool/.github/.github/actions/install-reqstool@6fc8d3e3d4c3fdf7a83cb7b7a274e4761486ca71 # 1.2.1 - with: - reqstool-source: ${{ matrix.reqstool-source }} - - name: Validate reqstool spec completeness - # not yet available in the latest PyPI release - if: matrix.reqstool-source == 'main' - uses: reqstool/.github/.github/actions/validate-reqstool@6fc8d3e3d4c3fdf7a83cb7b7a274e4761486ca71 # 1.2.1 - - name: Run reqstool status - uses: reqstool/.github/.github/actions/reqstool-status@6fc8d3e3d4c3fdf7a83cb7b7a274e4761486ca71 # 1.2.1 - with: - fail-if-incomplete: "true" - # Upload artifacts for later use - - name: Upload Artifacts - if: matrix.reqstool-source == 'pypi' - uses: actions/upload-artifact@v7.0.2 - with: - name: ${{ inputs.artifact-name || 'dist' }} - path: dist/ + needs: lint + uses: reqstool/.github/.github/workflows/python-build-poetry.yml@ci/385-shared-python-build # SPIKE: pin to release SHA + with: + coverage-source: reqstool_python_poetry_plugin + # e2e tests need the plugin built and `poetry self add`-ed before they run. + install-self-as-plugin: true + ref: ${{ inputs.ref }} + artifact-name: ${{ inputs.artifact-name || 'dist' }} + + reqstool: + needs: build + uses: reqstool/.github/.github/workflows/common-reqstool-verify.yml@ci/385-shared-python-build # SPIKE: pin to release SHA + with: + ref: ${{ inputs.ref }} + build-artifact: ${{ inputs.artifact-name || 'dist' }}-build + + smoke: + needs: build + uses: reqstool/.github/.github/workflows/python-smoke.yml@ci/385-shared-python-build # SPIKE: pin to release SHA + with: + ref: ${{ inputs.ref }} + dist-artifact: ${{ inputs.artifact-name || 'dist' }} + # Installing the wheel pulls in poetry (pinned in the wheel's dependencies). + # Poetry itself is the host of this plugin, so the smallest meaningful + # check on Windows/macOS is: poetry runs, the plugin module imports, and + # the unit tests pass. e2e tests need a Poetry-managed venv and stay on Linux. + requirements: pytest==9.2.0 + command: poetry --version && python -c "import reqstool_python_poetry_plugin.plugin" && pytest tests/unit validate-openspec: uses: reqstool/.github/.github/workflows/common-validate-openspec.yml@6fc8d3e3d4c3fdf7a83cb7b7a274e4761486ca71 # 1.2.1 + + # Single stable required check: survives job renames and matrix changes. + ci: + if: ${{ always() }} + needs: [lint, build, reqstool, smoke, validate-openspec] + runs-on: ubuntu-latest + steps: + - name: Fail unless every needed job succeeded + env: + NEEDS: ${{ toJSON(needs) }} + run: | + echo "$NEEDS" | python3 -c 'import json,sys; r={k:v["result"] for k,v in json.load(sys.stdin).items()}; print(r); sys.exit(0 if all(v=="success" for v in r.values()) else 1)' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index fda916e..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Lint (black and flake8) -on: - workflow_dispatch: - workflow_call: - -permissions: - contents: read - -jobs: - linting: - runs-on: ubuntu-latest - steps: - - name: Check out source repository - uses: actions/checkout@v7.0.1 - - name: Set up Python - uses: actions/setup-python@v7.1.0 - with: - python-version: "3.13.18" - - name: Install and configure Poetry (this should ideally be done from pyproject.toml but..) - uses: snok/install-poetry@a783c322200f0519c7926aa6faa857c4e23e9263 # v1.4.2 - with: - version: 2.5.1 - virtualenvs-create: true - - name: Install poetry-dynamic-versioning - run: poetry self add "poetry-dynamic-versioning[plugin]" - - name: Install dependencies - run: poetry install --with dev - - name: Run black formatter check - run: poetry run black --check --verbose src tests - - name: Run flake8 linter - run: poetry run flake8 From 86262f98750fa254ab08ee1fbd713c44b15ad51a Mon Sep 17 00:00:00 2001 From: Jimisola Date: Sun, 22 Nov 2026 09:32:21 +0000 Subject: [PATCH 2/9] ci: stop passing ref to smoke and verify (#385) Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01Mt2FAXPoMhrbjtWKhBTwZM Signed-off-by: Jimisola --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dce2057..d88e5a4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,14 +48,12 @@ jobs: needs: build uses: reqstool/.github/.github/workflows/common-reqstool-verify.yml@ci/385-shared-python-build # SPIKE: pin to release SHA with: - ref: ${{ inputs.ref }} build-artifact: ${{ inputs.artifact-name || 'dist' }}-build smoke: needs: build uses: reqstool/.github/.github/workflows/python-smoke.yml@ci/385-shared-python-build # SPIKE: pin to release SHA with: - ref: ${{ inputs.ref }} dist-artifact: ${{ inputs.artifact-name || 'dist' }} # Installing the wheel pulls in poetry (pinned in the wheel's dependencies). # Poetry itself is the host of this plugin, so the smallest meaningful From 8957f7b6b91a5a8411382a7911f5ed89573371ee Mon Sep 17 00:00:00 2001 From: Jimisola Date: Sun, 22 Nov 2026 09:32:21 +0000 Subject: [PATCH 3/9] test: compare the annotations output path platform-independently (#385) The plugin builds the path with pathlib, which yields backslashes on Windows; the assertion hard-coded forward slashes. Found by the new Windows smoke job. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01Mt2FAXPoMhrbjtWKhBTwZM Signed-off-by: Jimisola --- tests/unit/reqstool_python_poetry_plugin/test_plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/reqstool_python_poetry_plugin/test_plugin.py b/tests/unit/reqstool_python_poetry_plugin/test_plugin.py index 80eb968..e1e7b5a 100644 --- a/tests/unit/reqstool_python_poetry_plugin/test_plugin.py +++ b/tests/unit/reqstool_python_poetry_plugin/test_plugin.py @@ -123,7 +123,7 @@ def test_create_annotations_file_passes_configured_sources_and_output_path(tmp_p decorator_processor_cls.return_value.process_decorated_data.assert_called_once_with( path_to_python_files=["src", "tests/unit"], - output_file="build/reqstool/annotations.yml", + output_file=str(Path("build/reqstool/annotations.yml")), ) From cbf288f13fee03b8668adbafb57f1c51c0f9340e Mon Sep 17 00:00:00 2001 From: Jimisola Date: Sun, 22 Nov 2026 09:33:23 +0000 Subject: [PATCH 4/9] test: import Path in the annotations output path assertion (#385) Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01Mt2FAXPoMhrbjtWKhBTwZM Signed-off-by: Jimisola --- tests/unit/reqstool_python_poetry_plugin/test_plugin.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/reqstool_python_poetry_plugin/test_plugin.py b/tests/unit/reqstool_python_poetry_plugin/test_plugin.py index e1e7b5a..df6f81e 100644 --- a/tests/unit/reqstool_python_poetry_plugin/test_plugin.py +++ b/tests/unit/reqstool_python_poetry_plugin/test_plugin.py @@ -1,5 +1,6 @@ # Copyright © LFV +from pathlib import Path from unittest.mock import MagicMock, patch import pytest From 2fd3ee192d72733e398a129d7547a55f0d35d4b1 Mon Sep 17 00:00:00 2001 From: Jimisola Date: Sun, 22 Nov 2026 09:36:57 +0000 Subject: [PATCH 5/9] fix: write POSIX separators in the generated reqstool_config.yml On Windows str(Path) yields backslashes, which the reqstool_config.yml shipped in the sdist then carries to every consumer platform. Found by the new Windows smoke job (reqstool/.github#385). Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01Mt2FAXPoMhrbjtWKhBTwZM Signed-off-by: Jimisola --- src/reqstool_python_poetry_plugin/plugin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/reqstool_python_poetry_plugin/plugin.py b/src/reqstool_python_poetry_plugin/plugin.py index 82fe898..5b92e24 100644 --- a/src/reqstool_python_poetry_plugin/plugin.py +++ b/src/reqstool_python_poetry_plugin/plugin.py @@ -174,19 +174,19 @@ def _generate_reqstool_config(self) -> None: msg: str = f"[reqstool] missing mandatory {self.INPUT_FILE_REQUIREMENTS_YML}: {requirements_file}" raise RuntimeError(msg) - resources["requirements"] = str(requirements_file) + resources["requirements"] = requirements_file.as_posix() self._cleo_io.write_line(f"[reqstool] added to {self.OUTPUT_SDIST_REQSTOOL_CONFIG_YML}: {requirements_file}") if svcs_file.exists(): - resources["software_verification_cases"] = str(svcs_file) + resources["software_verification_cases"] = svcs_file.as_posix() self._cleo_io.write_line(f"[reqstool] added to {self.OUTPUT_SDIST_REQSTOOL_CONFIG_YML}: {svcs_file}") if mvrs_file.exists(): - resources["manual_verification_results"] = str(mvrs_file) + resources["manual_verification_results"] = mvrs_file.as_posix() self._cleo_io.write_line(f"[reqstool] added to {self.OUTPUT_SDIST_REQSTOOL_CONFIG_YML}: {mvrs_file}") if annotations_file.exists(): - resources["annotations"] = str(annotations_file) + resources["annotations"] = annotations_file.as_posix() self._cleo_io.write_line(f"[reqstool] added to {self.OUTPUT_SDIST_REQSTOOL_CONFIG_YML}: {annotations_file}") if test_result_patterns: From 5e6bc66da8e67ddc2f640794d871e2e47b56fd29 Mon Sep 17 00:00:00 2001 From: Jimisola Date: Sun, 22 Nov 2026 09:43:33 +0000 Subject: [PATCH 6/9] fix: preserve line endings when cleaning pyproject.toml Writing in text mode translated LF to CRLF on Windows. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01Mt2FAXPoMhrbjtWKhBTwZM Signed-off-by: Jimisola --- src/reqstool_python_poetry_plugin/plugin.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/reqstool_python_poetry_plugin/plugin.py b/src/reqstool_python_poetry_plugin/plugin.py index 4b249d4..dbebd63 100644 --- a/src/reqstool_python_poetry_plugin/plugin.py +++ b/src/reqstool_python_poetry_plugin/plugin.py @@ -75,10 +75,11 @@ def _cleanup_pyproject_install_after_install(self) -> None: pyproject_path = Path(str(self._poetry.package.root_dir)) / "pyproject.toml" if not pyproject_path.exists(): return - content = pyproject_path.read_text(encoding="utf-8") - cleaned = re.sub(r"\n{3,}", "\n\n", content) + # newline="" keeps the file's own line endings (no LF -> CRLF translation on Windows) + content = pyproject_path.read_text(encoding="utf-8", newline="") + cleaned = re.sub(r"(\r?\n)(?:\r?\n){2,}", r"\1\1", content) if cleaned != content: - pyproject_path.write_text(cleaned, encoding="utf-8") + pyproject_path.write_text(cleaned, encoding="utf-8", newline="") self._cleo_io.write_line("[reqstool] Cleaned up excess blank lines in pyproject.toml") @Requirements("POETRY_PLUGIN_003") From 0a3d2868cac01bee60ca32e4c62abf24f1a7ff52 Mon Sep 17 00:00:00 2001 From: Jimisola Date: Mon, 23 Nov 2026 07:43:59 +0000 Subject: [PATCH 7/9] ci: pin shared workflows to the .github 1.3.0 SHA Pin to 193abb8e7ad36805d5fe7695f8fa5e0a4b6f8da7 (# 1.3.0). The 1.3.0 tag is pending; Renovate resolves it once it exists. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01Mt2FAXPoMhrbjtWKhBTwZM Signed-off-by: Jimisola --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d88e5a4..f2dbf33 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,13 +30,13 @@ permissions: jobs: lint: - uses: reqstool/.github/.github/workflows/python-lint.yml@ci/385-shared-python-build # SPIKE: pin to release SHA + uses: reqstool/.github/.github/workflows/python-lint.yml@193abb8e7ad36805d5fe7695f8fa5e0a4b6f8da7 # 1.3.0 with: package-manager: poetry build: needs: lint - uses: reqstool/.github/.github/workflows/python-build-poetry.yml@ci/385-shared-python-build # SPIKE: pin to release SHA + uses: reqstool/.github/.github/workflows/python-build-poetry.yml@193abb8e7ad36805d5fe7695f8fa5e0a4b6f8da7 # 1.3.0 with: coverage-source: reqstool_python_poetry_plugin # e2e tests need the plugin built and `poetry self add`-ed before they run. @@ -46,13 +46,13 @@ jobs: reqstool: needs: build - uses: reqstool/.github/.github/workflows/common-reqstool-verify.yml@ci/385-shared-python-build # SPIKE: pin to release SHA + uses: reqstool/.github/.github/workflows/common-reqstool-verify.yml@193abb8e7ad36805d5fe7695f8fa5e0a4b6f8da7 # 1.3.0 with: build-artifact: ${{ inputs.artifact-name || 'dist' }}-build smoke: needs: build - uses: reqstool/.github/.github/workflows/python-smoke.yml@ci/385-shared-python-build # SPIKE: pin to release SHA + uses: reqstool/.github/.github/workflows/python-smoke.yml@193abb8e7ad36805d5fe7695f8fa5e0a4b6f8da7 # 1.3.0 with: dist-artifact: ${{ inputs.artifact-name || 'dist' }} # Installing the wheel pulls in poetry (pinned in the wheel's dependencies). From 44e1a983018e7fe5f6b71dbc7584344e2e829416 Mon Sep 17 00:00:00 2001 From: Jimisola Date: Mon, 23 Nov 2026 09:06:38 +0000 Subject: [PATCH 8/9] chore: drop explanatory comments The PR description and commits carry the rationale. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01Mt2FAXPoMhrbjtWKhBTwZM Signed-off-by: Jimisola --- .github/workflows/build.yml | 6 ------ src/reqstool_python_poetry_plugin/plugin.py | 1 - 2 files changed, 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f2dbf33..6ddc3e3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,7 +39,6 @@ jobs: uses: reqstool/.github/.github/workflows/python-build-poetry.yml@193abb8e7ad36805d5fe7695f8fa5e0a4b6f8da7 # 1.3.0 with: coverage-source: reqstool_python_poetry_plugin - # e2e tests need the plugin built and `poetry self add`-ed before they run. install-self-as-plugin: true ref: ${{ inputs.ref }} artifact-name: ${{ inputs.artifact-name || 'dist' }} @@ -55,17 +54,12 @@ jobs: uses: reqstool/.github/.github/workflows/python-smoke.yml@193abb8e7ad36805d5fe7695f8fa5e0a4b6f8da7 # 1.3.0 with: dist-artifact: ${{ inputs.artifact-name || 'dist' }} - # Installing the wheel pulls in poetry (pinned in the wheel's dependencies). - # Poetry itself is the host of this plugin, so the smallest meaningful - # check on Windows/macOS is: poetry runs, the plugin module imports, and - # the unit tests pass. e2e tests need a Poetry-managed venv and stay on Linux. requirements: pytest==9.2.0 command: poetry --version && python -c "import reqstool_python_poetry_plugin.plugin" && pytest tests/unit validate-openspec: uses: reqstool/.github/.github/workflows/common-validate-openspec.yml@6fc8d3e3d4c3fdf7a83cb7b7a274e4761486ca71 # 1.2.1 - # Single stable required check: survives job renames and matrix changes. ci: if: ${{ always() }} needs: [lint, build, reqstool, smoke, validate-openspec] diff --git a/src/reqstool_python_poetry_plugin/plugin.py b/src/reqstool_python_poetry_plugin/plugin.py index dbebd63..73dddeb 100644 --- a/src/reqstool_python_poetry_plugin/plugin.py +++ b/src/reqstool_python_poetry_plugin/plugin.py @@ -75,7 +75,6 @@ def _cleanup_pyproject_install_after_install(self) -> None: pyproject_path = Path(str(self._poetry.package.root_dir)) / "pyproject.toml" if not pyproject_path.exists(): return - # newline="" keeps the file's own line endings (no LF -> CRLF translation on Windows) content = pyproject_path.read_text(encoding="utf-8", newline="") cleaned = re.sub(r"(\r?\n)(?:\r?\n){2,}", r"\1\1", content) if cleaned != content: From c9361d97b48a4aaf0e0d7b72da88f1c4477b0f03 Mon Sep 17 00:00:00 2001 From: Jimisola Date: Mon, 23 Nov 2026 09:21:02 +0000 Subject: [PATCH 9/9] ci: pin shared workflows to .github 1.2.2 Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01Mt2FAXPoMhrbjtWKhBTwZM Signed-off-by: Jimisola --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6ddc3e3..9fd574d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,13 +30,13 @@ permissions: jobs: lint: - uses: reqstool/.github/.github/workflows/python-lint.yml@193abb8e7ad36805d5fe7695f8fa5e0a4b6f8da7 # 1.3.0 + uses: reqstool/.github/.github/workflows/python-lint.yml@91cd368066d5458b5d46bdf34c4d8ca483f6633f # 1.2.2 with: package-manager: poetry build: needs: lint - uses: reqstool/.github/.github/workflows/python-build-poetry.yml@193abb8e7ad36805d5fe7695f8fa5e0a4b6f8da7 # 1.3.0 + uses: reqstool/.github/.github/workflows/python-build-poetry.yml@91cd368066d5458b5d46bdf34c4d8ca483f6633f # 1.2.2 with: coverage-source: reqstool_python_poetry_plugin install-self-as-plugin: true @@ -45,13 +45,13 @@ jobs: reqstool: needs: build - uses: reqstool/.github/.github/workflows/common-reqstool-verify.yml@193abb8e7ad36805d5fe7695f8fa5e0a4b6f8da7 # 1.3.0 + uses: reqstool/.github/.github/workflows/common-reqstool-verify.yml@91cd368066d5458b5d46bdf34c4d8ca483f6633f # 1.2.2 with: build-artifact: ${{ inputs.artifact-name || 'dist' }}-build smoke: needs: build - uses: reqstool/.github/.github/workflows/python-smoke.yml@193abb8e7ad36805d5fe7695f8fa5e0a4b6f8da7 # 1.3.0 + uses: reqstool/.github/.github/workflows/python-smoke.yml@91cd368066d5458b5d46bdf34c4d8ca483f6633f # 1.2.2 with: dist-artifact: ${{ inputs.artifact-name || 'dist' }} requirements: pytest==9.2.0