Skip to content

PHP SDK: add coverage, test reports, and Codecov support #3307

@countradooku

Description

@countradooku

Follow-up from the experimental PHP SDK review.

The PHP pre-merge test path currently builds the extension with a plain cargo build --manifest-path foreign/php/Cargo.toml, runs PHPUnit without producing a JUnit report, does not upload PHP test/coverage artifacts, and _test.yml has no PHP Codecov upload step. As a result, PHP changes do not feed the same CI reporting/dashboard path as Python and Node.

Scope

Coverage instrumentation:

  • Install / make available cargo llvm-cov for the PHP pre-merge action, following the Python action pattern.
  • Wrap the test extension build in .github/actions/php/pre-merge/action.yml with cargo llvm-cov environment setup at the current cargo build --manifest-path foreign/php/Cargo.toml point.
  • Add a cargo llvm-cov report --lcov step after the PHP SDK tests run and before the Iggy server stop step.
  • Emit reports/php-coverage.lcov or another stable LCOV path for PHP coverage.
  • Adjust source paths if needed so Codecov attributes Rust extension coverage under foreign/php/src/.

Test reports and artifacts:

  • Pass a JUnit output path to PHPUnit, for example:
./scripts/test.sh --log-junit ../../reports/php-junit.xml

or wire the equivalent through foreign/php/scripts/test.sh / the PHP action.

  • Ensure the reports directory exists before test/report generation.
  • Upload the PHP JUnit XML and PHP LCOV file via actions/upload-artifact.

Codecov wiring:

  • Add a PHP Codecov upload call in .github/workflows/_test.yml, matching the existing Python / Node shape:
    • files: reports/php-coverage.lcov
    • flags: php
    • disable_search: true
    • preserve the existing Codecov token / PR override conventions.
  • Also modify .github/workflows/coverage-baseline.yml, which runs post-merge, so PHP coverage establishes the baseline dashboard data.

Files of interest

  • .github/actions/php/pre-merge/action.yml
  • foreign/php/scripts/test.sh
  • .github/workflows/_test.yml
  • .github/workflows/coverage-baseline.yml

Reference

The Python pre-merge action already wraps the equivalent Rust extension build with cargo llvm-cov, emits reports/python-coverage.lcov, uploads JUnit/coverage artifacts, and feeds Codecov. The PHP action should follow the same shape so PHP changes are visible in CI reporting and coverage dashboards.

Merged scope from duplicate issue: #3309
Related: #3302
Initial PHP SDK work: #3235

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersphpPull requests that update php code

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions