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
Fetches coverage report from test container
The `clover.xml` coverage report is generated inside the `tests-wordpress` container, but the plugin directory is not bind-mounted to the host. Previously, this meant the report was inaccessible for upload.

This update uses `docker cp` to retrieve the `clover.xml` report from the container to the host filesystem after tests complete. This ensures the report is available for the Codecov upload step.

Includes additional checks to confirm XDebug mode and verify the integrity of the retrieved coverage report.
  • Loading branch information
nimesh-xecurify committed Mar 28, 2026
commit 3d9317b6f5ec94e9d1429a80a6fadec56cc2fd75
31 changes: 20 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,25 +132,34 @@ jobs:

- name: Test
run: |
# Create tests/logs inside the container so PHPUnit can write coverage reports.
# The plugin directory is bind-mounted from the workspace, so PHPUnit writing to
# tests/logs/clover.xml inside the container also writes to the workspace path on
# the host runner. The directory must be created by the container user (uid=1000)
# to be writable; creating it on the runner (uid=1001) would cause a permissions
# mismatch and prevent PHPUnit from writing coverage output.
npm run env run tests-cli --env-cwd=wp-content/plugins/two-factor -- mkdir -p tests/logs
npm run test

- name: Verify coverage report
- name: Retrieve coverage report from container
if: ${{ matrix.php == '8.3' && matrix.wp == 'latest' }}
run: |
if [ ! -s tests/logs/clover.xml ]; then
echo "Error: tests/logs/clover.xml is missing or empty. Coverage was not generated."
# PHPUnit writes clover.xml into the named Docker volume shared between the
# tests-wordpress and tests-cli containers. The plugin directory is NOT bind-mounted
# from the workspace in CI, so the file does not appear on the host filesystem after
# npm run test. We use docker cp (not 'docker exec cat > file') because docker cp is
# an atomic Docker API call that reads from the container's merged filesystem without
# a shell redirect that would pre-truncate the destination and cause a 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
echo "Coverage report found: $(wc -c < tests/logs/clover.xml) bytes"
echo "=== clover.xml project summary (first 10 lines) ==="
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 reported by tests-wordpress ==="
docker exec "$CONTAINER" php -r "echo ini_get('xdebug.mode') . PHP_EOL;"
echo "=== clover.xml size and summary ==="
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
fi

Comment thread
masteradhoc marked this conversation as resolved.
- name: Upload code coverage report
if: ${{ matrix.php == '8.3' && matrix.wp == 'latest' && hashFiles('tests/logs/clover.xml') != '' }}
Expand Down
Loading