@@ -2127,7 +2127,7 @@ def test_ci_workflow_uses_make_targets_for_plugin_checks(self) -> None:
21272127 self .assertIn ("working-directory: plugins/rust/python-package/${{ matrix.plugin }}" , workflow )
21282128 self .assertIn ("release-validation:" , workflow )
21292129 self .assertIn ("uses: ./.github/workflows/release-rust-python-package.yaml" , workflow )
2130- self .assertIn ("tag: retry-with-backoff-v0.1.1 " , workflow )
2130+ self .assertIn ("tag: retry-with-backoff-v0.2.0 " , workflow )
21312131 self .assertIn ("repository: testpypi" , workflow )
21322132 self .assertIn ("publish_enabled: false" , workflow )
21332133 self .assertNotIn ("tools/plugin_catalog.py ci-selection-field" , workflow )
@@ -2438,6 +2438,42 @@ def test_coverage_check_reports_per_plugin_percentages(self) -> None:
24382438 self .assertEqual (payload ["plugins" ]["alpha" ]["line_rate" ], 50.0 )
24392439 self .assertEqual (payload ["plugins" ]["beta" ]["line_rate" ], 75.0 )
24402440
2441+ def test_coverage_check_accepts_windows_paths (self ) -> None :
2442+ with tempfile .TemporaryDirectory () as tmpdir :
2443+ root = Path (tmpdir )
2444+ (root / "Cargo.toml" ).write_text (
2445+ '[workspace]\n members = ["plugins/rust/python-package/alpha"]\n '
2446+ '[workspace.package]\n repository = "https://github.com/IBM/cpex-plugins"\n '
2447+ )
2448+ self ._create_plugin (root , "alpha" )
2449+ report = root / "coverage.xml"
2450+ report .write_text (
2451+ textwrap .dedent (
2452+ r"""
2453+ <coverage>
2454+ <packages>
2455+ <package name="plugins.rust.python-package.alpha.src">
2456+ <classes>
2457+ <class filename="D:\a\cpex-plugins\cpex-plugins\plugins\rust\python-package\alpha\src\lib.rs">
2458+ <lines>
2459+ <line number="1" hits="1"/>
2460+ <line number="2" hits="0"/>
2461+ </lines>
2462+ </class>
2463+ </classes>
2464+ </package>
2465+ </packages>
2466+ </coverage>
2467+ """
2468+ ).strip ()
2469+ )
2470+
2471+ result = run_catalog ("coverage-check" , str (root ), str (report ), "50.0" , '["alpha"]' )
2472+
2473+ self .assertEqual (result .returncode , 0 , result .stderr )
2474+ payload = json .loads (result .stdout )
2475+ self .assertEqual (payload ["plugins" ]["alpha" ]["line_rate" ], 50.0 )
2476+
24412477 def test_coverage_check_rejects_plugin_with_no_counted_lines (self ) -> None :
24422478 with tempfile .TemporaryDirectory () as tmpdir :
24432479 root = Path (tmpdir )
@@ -2683,7 +2719,10 @@ def test_release_workflow_tests_artifacts_outside_source_tree(self) -> None:
26832719 self .assertIn ('"${tmpdir}/tests/${{ needs.resolve.outputs.slug }}" -v' , workflow )
26842720 self .assertNotIn ('PYTHONPATH="${GITHUB_WORKSPACE}/${{ needs.resolve.outputs.plugin_path }}/tests"' , workflow )
26852721 self .assertEqual (workflow .count ("cargo run --bin stub_gen" ), 1 )
2686- self .assertIn ('git show-ref --verify --quiet "refs/tags/${tag}"' , workflow )
2722+ self .assertIn ('git ls-remote --exit-code --tags origin "refs/tags/${tag}"' , workflow )
2723+ self .assertIn ('elif [[ "${GITHUB_EVENT_NAME}" == "pull_request" && "${PUBLISH_ENABLED}" == "false" ]]; then' , workflow )
2724+ self .assertIn ('checkout_ref="${GITHUB_SHA}"' , workflow )
2725+ self .assertIn ('echo "Release tag ${tag} does not exist" >&2' , workflow )
26872726 self .assertIn ("python3 tools/plugin_catalog.py release-info ." , workflow )
26882727 self .assertIn ('if [[ -n "${TAG_INPUT}" ]]; then' , workflow )
26892728 self .assertIn ("workflow_call:" , workflow )
@@ -2692,6 +2731,10 @@ def test_release_workflow_tests_artifacts_outside_source_tree(self) -> None:
26922731 self .assertIn ('git fetch --force origin "refs/heads/main:refs/remotes/origin/main"' , workflow )
26932732 self .assertIn ('if git merge-base --is-ancestor "${tag_ref}" "refs/remotes/origin/main"; then' , workflow )
26942733 self .assertIn ("tag_on_main: ${{ steps.resolve.outputs.tag_on_main }}" , workflow )
2734+ self .assertIn ("slug: ${{ steps.resolve.outputs.plugin }}" , workflow )
2735+ self .assertIn ("publish_enabled: ${{ steps.resolve.outputs.publish_enabled }}" , workflow )
2736+ self .assertIn ('echo "publish_enabled=false"' , workflow )
2737+ self .assertIn ('echo "publish_enabled=true"' , workflow )
26952738 self .assertIn (
26962739 'wheel_matrix="$(python3 -c \' import json; print(json.dumps([{' ,
26972740 workflow ,
@@ -2713,7 +2756,7 @@ def test_release_workflow_tests_artifacts_outside_source_tree(self) -> None:
27132756 self .assertIn ("runs-on: ${{ matrix.runner }}" , workflow )
27142757 self .assertIn ("name: wheel-${{ matrix.platform }}" , workflow )
27152758 self .assertIn (
2716- "if: ${{ (github.event_name != 'workflow_call' || inputs.publish_enabled) && (needs.resolve.outputs.publish_env != 'pypi' || needs.resolve.outputs.tag_on_main == 'true') }}" ,
2759+ "if: ${{ needs.resolve.outputs.publish_enabled == 'true' && (needs.resolve.outputs.publish_env != 'pypi' || needs.resolve.outputs.tag_on_main == 'true') }}" ,
27172760 workflow ,
27182761 )
27192762 self .assertNotIn ("matrix." , preflight_section )
@@ -2950,6 +2993,19 @@ def test_root_plugin_test_uses_plugin_ci_target(self) -> None:
29502993 self .assertIn ("make ci" , makefile )
29512994 self .assertNotIn ("make install && make test-all" , makefile )
29522995
2996+ def test_retry_make_ci_enforces_local_coverage_floor (self ) -> None :
2997+ plugin_dir = REPO_ROOT / "plugins" / "rust" / "python-package" / "retry_with_backoff"
2998+ makefile = (plugin_dir / "Makefile" ).read_text ()
2999+ self .assertIn ("ci: ci-build test-integration coverage" , makefile )
3000+ self .assertIn ("rustup component add llvm-tools-preview" , makefile )
3001+ self .assertIn ("cargo install cargo-llvm-cov --version $(CARGO_LLVM_COV_VERSION) --locked" , makefile )
3002+ self .assertIn ("cargo llvm-cov clean --workspace" , makefile )
3003+ self .assertIn ("cargo llvm-cov report -p $(CARGO_PACKAGE)" , makefile )
3004+ self .assertIn (
3005+ "python3 $(REPO_ROOT)/tools/plugin_catalog.py coverage-check $(REPO_ROOT) $(COVERAGE_REPORT) $(COVERAGE_MIN)" ,
3006+ makefile ,
3007+ )
3008+
29533009 def test_secrets_detection_keeps_scanner_module_internal (self ) -> None :
29543010 lib_rs = (
29553011 REPO_ROOT
0 commit comments