-
Notifications
You must be signed in to change notification settings - Fork 0
Openemr external pr 8404 ci coverage api experiment 1 #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Openemr external pr 8404 ci coverage api experiment 1 #3
Conversation
...for everything except e2e and api tests
Implemented code coverage collection for the api test suite. Need to figure out how to use the phpunit cache warmup for grabbing all of the src directory. When the src directory is included the tests slow down to a crawl and we get api timeouts. For now in this experiment just did an initial run for building the coverage files which get stored in the coverage directory. I hard-code the files in the CoverageHelper::createTargetedCodeCoverage() method and will need to figure out the directory traversal later. Afterwards to compile all the coverage into an aggegrated report the following commands can be run: ``` php -d memory_limit=512M vendor/bin/phpcov merge coverage --html=coverage/html --clover=coverage/clover.xml && rm cov erage/*.cov ``` I add two environment variables for the docker-compose docker environment. One to turn on the coverage report collection which will be turned off by default (and respected in the CoverageHelper class) and another to tell xdebug to collect coverage metrics.
| "${composer_home}/vendor/bin/phing" assets-clean | ||
| composer global remove phing/phing | ||
| composer dump-autoload -o | ||
| rm -fr node_modules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside: since this is in actions anyway, what do we gain by removing node_modules?
| EASY_DEV_MODE_NEW: "yes" | ||
| DEVELOPER_TOOLS: "yes" | ||
| XDEBUG_ON: 1 | ||
| XDEBUG_MODE: coverage,debug,profile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What're we using debug and profile for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug and profile are used for phpstorm / vscode, we can remove it from the ci dockers, but since I was testing this on the easy development docker, I wanted to make sure we could attach the debugger and run the profiler. The environment variable overrides the php.ini setting from what I read.
| $(".graph").on("click", function(e){ show_graph(<?php echo js_escape($formname); ?>, this.id.substring(9), $(this).text()) }); | ||
| <?php } else { ?> | ||
| $(".graph").on("click", function(e){ show_graph('form_vitals', this.id, '$(this).text()') }); | ||
| $(".graph").on("click", function(e){ show_graph('form_vitals', this.id, $(this).text()) }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this from a different changeset?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is odd, it appears to come from this commit:
commit 98e0421cd113393a84210ed0cbdcacf71171fdfe
Author: INFEG <[email protected]>
Date: Fri May 30 12:22:05 2025 +0530
Vitals Graph Fix (#8393)
M interface/patient_file/encounter/trend_form.php
But I have no idea how it snuck in there because I branched it from your PR kojiromike/coverage-annotations. I used github's gh command to pull the pr and create a new branch which now has me worried as it shouldn't have brought that in.
| use function microtime; | ||
| use function register_shutdown_function; | ||
|
|
||
| class CoverageHelper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably a good idea to include a docblock
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Thanks.
Left out some coverage files that I meant to push out on Saturday. Fixed the docblock here.
Implemented code coverage collection for the api test suite. Need to
figure out how to use the phpunit cache warmup for grabbing all of the
src directory. When the src directory is included the tests slow down
to a crawl and we get api timeouts. For now in this experiment just did
an initial run for building the coverage files which get stored in the
coverage directory. I hard-code the files in the
CoverageHelper::createTargetedCodeCoverage() method and will need to
figure out the directory traversal later.
Afterwards to compile all the coverage into an aggegrated report the
following commands can be run:
I add two environment variables for the docker-compose docker
environment. One to turn on the coverage report collection which will
be turned off by default (and respected in the CoverageHelper class) and
another to tell xdebug to collect coverage metrics.
This is a screenshot of the overview in coverage/html/index.html

RestControllerHelper.php

RestControllerHelper::handleProcessingResult
