Conversation
report.php
Outdated
| log_message( 'Error uploading results' ); | ||
| } | ||
|
|
||
| function process( $path ) |
There was a problem hiding this comment.
Can we put this in functions.php ?
There was a problem hiding this comment.
Sure! Wasn't sure if we should put single use functions there, but I'll move it.
There was a problem hiding this comment.
👍 Sounds good. It probably could use a slightly more verbose name too.
functions.php
Outdated
| * @return string | ||
| */ | ||
| function get_wordpress_version( $dir ) { | ||
| $wpVersion = file_get_contents( trailingslashit( $dir ) . 'src/wp-includes/version.php' ); |
There was a problem hiding this comment.
Don't we want the actual changeset reported with the WordPress version? While this WordPress version includes a changeset, it doesn't get incremented very often so it's likely to be incorrect.
There was a problem hiding this comment.
That's a good point, this won't get updated on commit. We get the SVN revision, so we should be able to get the changeset from that. Not sure if this will be actually useful.
report.php
Outdated
| $junit_location = '-e "ssh ' . $WPT_SSH_OPTIONS . '" ' . escapeshellarg( $WPT_SSH_CONNECT . ':' . $junit_location ); | ||
| } | ||
|
|
||
| $junit_exec = 'rsync -rv ' . $junit_location . ' ./'; |
There was a problem hiding this comment.
Can we copy this to $WPT_PREPARE_DIR for easy consistency?
report.php
Outdated
| $results = process_junit_xml( $xml ); | ||
|
|
||
| $meta = array( | ||
| 'php_version' => phpversion(), |
There was a problem hiding this comment.
Doesn't this need to be the phpversion() on the remote filesystem?
There was a problem hiding this comment.
Yes it does, we'll need to find a way to get that, probably during the testing process.
There was a problem hiding this comment.
Added in #26 (comment)
The env.json file ends up in the same directory as junit.xml to make it easy to sync over.
report.php
Outdated
| if ( $success ) { | ||
| log_message( 'Results successfully uploaded' ); | ||
| } else { | ||
| log_message( 'Error uploading results' ); |
There was a problem hiding this comment.
Can we use the error_message() helper here?
| $WPT_REPORT_API_KEY = getenv( 'WPT_REPORT_API_KEY' ); | ||
|
|
||
| log_message('Getting SVN Revision'); | ||
| $rev = exec('git -C ' . escapeshellarg( $WPT_PREPARE_DIR ) . ' log -1 --pretty=%B | grep "git-svn-id:" | cut -d " " -f 2 | cut -d "@" -f 2'); |
There was a problem hiding this comment.
Can we use the perform_operations() helper?
There was a problem hiding this comment.
perform_operations doesn't appear to return the output, so we can't get the revision from git.
cleanup.php
Outdated
| perform_operations( array( | ||
| 'rm -rf ' . escapeshellarg( $WPT_PREPARE_DIR . '/.git' ), | ||
| 'rm -r ' . escapeshellarg( $WPT_PREPARE_DIR ), | ||
| 'rm ./junit.xml', |
There was a problem hiding this comment.
Ideally, we'd put this in the $WPT_PREPARE_DIR to reduce complexity.
composer.json
Outdated
| "repositories": [ | ||
| { | ||
| "type": "git", | ||
| "url": "https://github.com/octalmage/wp-unit-test-api-client-php.git" |
There was a problem hiding this comment.
Does this really need to be a separate library, or can we consolidate into this repo?
For simplicity's sake, it'd be better to keep everything together if we can.
|
@danielbachhuber made the requested changes, and removed the external dependency. Let me know what you think! |
| log_message( 'Results successfully uploaded' ); | ||
| } else { | ||
| error_message( 'Error uploading results' ); | ||
| } |
There was a problem hiding this comment.
It'd be good to enrich this reporting, but it doesn't need to block merge #27
This PR includes the reporting script. It downloads the junit.xml results using rsync, gets the SVN revision, then processes and uploads the junit.xml as json.
Things that still need to be done:
The json only includes the failures and it looks something like this: