Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
11caf1f
Fix Codecov badge by adding OIDC permission for tokenless upload
nimesh-xecurify Mar 28, 2026
1497fe7
Enables OIDC for Codecov action
nimesh-xecurify Mar 28, 2026
fa58b7e
Prepares workflow for code coverage
nimesh-xecurify Mar 28, 2026
5e6556a
Enables Codecov report upload
nimesh-xecurify Mar 28, 2026
91881c2
Removes redundant coverage report retrieval
nimesh-xecurify Mar 28, 2026
ba3d8a2
Fix coverage file retrieval via docker exec on persistent container
nimesh-xecurify Mar 28, 2026
07a7398
Add debug step to diagnose coverage report content and xdebug mode
nimesh-xecurify Mar 28, 2026
e6bcc88
Ensure robust code coverage report retrieval and upload
nimesh-xecurify Mar 28, 2026
2513a33
Streamlines CI coverage report handling
nimesh-xecurify Mar 28, 2026
3d9317b
Fetches coverage report from test container
nimesh-xecurify Mar 28, 2026
367f804
Ensures robust code coverage generation in CI
nimesh-xecurify Mar 28, 2026
68452bd
Adjusts `wp-env` coverage command
nimesh-xecurify Mar 28, 2026
e8a9180
Streamlines CI coverage generation
nimesh-xecurify Mar 28, 2026
683a838
Merge branch 'master' into codecov-integration
masteradhoc Mar 28, 2026
83f5ee5
Removes redundant coverage report retrieval
nimesh-xecurify Mar 29, 2026
10a1cbb
Merge branch 'master' into codecov-integration
nimesh-xecurify May 14, 2026
3783602
Scope Codecov OIDC permission to a dedicated upload job
nimesh-xecurify Jul 3, 2026
9563db7
Merge branch 'master' into codecov-integration
nimesh-xecurify Jul 3, 2026
2cf6841
Merge branch 'master' into codecov-integration
masteradhoc Aug 1, 2026
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
Prev Previous commit
Next Next commit
Streamlines CI coverage generation
Removes a conditional test execution path, allowing `npm run test` to consistently handle code coverage collection across all test matrix configurations, including PHP 8.3 with the latest WordPress.

Eliminates unnecessary debugging output for `xdebug.mode` and `clover.xml` content to declutter CI logs.

Refines comments for improved clarity regarding Composer platform requirements and `docker cp` usage.
  • Loading branch information
nimesh-xecurify committed Mar 28, 2026
commit e8a91807414cd17fd65afea8ccef5a58f4d08cf5
35 changes: 7 additions & 28 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,9 @@ jobs:
- name: Composer install
run: |
rm composer.lock || true # We need to install fresh.
# On PHP 8+, the composer.json platform override (php: 7.2.24) causes PHPUnit 8.5 to
# be installed. PHPUnit 8.5 explicitly refuses to generate code coverage on PHP 8 with
# the message "This version of PHPUnit does not support code coverage on PHP 8". Pass
# --ignore-platform-req=php so Composer resolves against the actual PHP runtime and
# installs PHPUnit 9.6, which supports coverage on PHP 8.x.
# The composer.json platform override (php: 7.2.24) installs PHPUnit 8.5, which does
# not support code coverage on PHP 8. Use --ignore-platform-req=php on PHP 8+ so
# Composer installs PHPUnit 9.6, which supports coverage on PHP 8.x.
if [[ "${WP_ENV_PHP_VERSION}" == 8.* ]]; then
npm run composer -- install --ignore-platform-req=php
else
Expand All @@ -142,41 +140,22 @@ jobs:
- name: Test
run: |
npm run env run tests-cli --env-cwd=wp-content/plugins/two-factor -- mkdir -p tests/logs
# For the coverage matrix cell, set XDEBUG_MODE=coverage explicitly via env var
# (Xdebug 3 feature) rather than relying on the ini configuration that wp-env
# applies to persistent containers — ephemeral wp-env run containers may not
# inherit it. Pass --coverage-clover in addition to what phpunit.xml.dist configures
# so the clover output is guaranteed regardless of XML config format differences
# between PHPUnit versions.
if [[ "${{ matrix.php }}" == "8.3" && "${{ matrix.wp }}" == "latest" ]]; then
# Call wp-env directly (not via npm run) to avoid npm re-splitting the argument
# list. env sets XDEBUG_MODE=coverage and execs composer, which resolves phpunit
# from vendor/bin — the same path used by npm run test.
./node_modules/.bin/wp-env run tests-cli --env-cwd=wp-content/plugins/two-factor \
-- env XDEBUG_MODE=coverage composer test
else
npm run test
fi
npm run test

- name: Retrieve coverage report from container
if: ${{ matrix.php == '8.3' && matrix.wp == 'latest' }}
run: |
# PHPUnit writes clover.xml into the Docker volume shared between tests-cli and
# tests-wordpress. We use docker cp (not 'docker exec cat > file') because docker cp
# is an atomic Docker API call that avoids a shell redirect pre-truncating the
# destination — which would zero-out the file before cat can read it.
# tests-wordpress. Use docker cp (not 'docker exec cat > file'): docker cp is an
# atomic API call that avoids a shell redirect pre-truncating the destination file,
# which would zero it out before cat can read it (self-overwrite).
CONTAINER=$(docker ps --filter "name=tests-wordpress" --format "{{.Names}}" | head -1)
if [ -z "$CONTAINER" ]; then
echo "Error: tests-wordpress container not found"
exit 1
fi
mkdir -p tests/logs
docker cp "$CONTAINER:/var/www/html/wp-content/plugins/two-factor/tests/logs/clover.xml" tests/logs/clover.xml
echo "=== xdebug mode in tests-wordpress ==="
docker exec "$CONTAINER" php -r "echo ini_get('xdebug.mode') . PHP_EOL;"
echo "=== clover.xml size and first 10 lines ==="
wc -c tests/logs/clover.xml
head -10 tests/logs/clover.xml
if [ ! -s tests/logs/clover.xml ]; then
echo "Error: clover.xml is empty — coverage was not generated"
exit 1
Expand Down
Loading