Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
4a4d302
Store php_version in post meta
swissspidy Mar 16, 2024
70871f5
Use different way of displaying results
swissspidy Mar 16, 2024
e2988df
Environment labels
swissspidy Mar 17, 2024
027f388
Host detail page
swissspidy Mar 17, 2024
4c89076
Fix orderby
swissspidy Mar 17, 2024
70ca3ce
no table, no heading
swissspidy Mar 17, 2024
c6c7ff5
styling
swissspidy Mar 17, 2024
a2d9732
link to archive page
swissspidy Mar 17, 2024
42608e9
layout
swissspidy Mar 17, 2024
7ccecac
Only report new failures in email
swissspidy Mar 17, 2024
dc3f828
remove debug cruft
swissspidy Mar 17, 2024
44cfbcb
don’t capitalize
swissspidy Mar 17, 2024
289c26a
Remove unused template
swissspidy Mar 23, 2024
de329aa
Add test date to single view
swissspidy Mar 23, 2024
f5248a3
Display execution time
swissspidy Mar 23, 2024
1b3dfb1
Fix implicit float conversion warning
swissspidy Mar 23, 2024
173f9e7
Switch from post meta to taxonomies for PHP versions and environment …
desrosj Sep 9, 2024
c8ad919
For now, don't make the taxonomies public.
desrosj Sep 9, 2024
cb7e662
Merge pull request #1 from desrosj/cloudfest-with-taxonomies
swissspidy Sep 9, 2024
5482334
Add a taxonomy for report result to simplify counting and querying.
desrosj Sep 11, 2024
feaf78a
Re-add saving of environment name as well as type.
desrosj Sep 11, 2024
29a4057
Fix author archive
swissspidy Sep 11, 2024
9847f92
Accept the term slug instead of a `bool` when counting test results.
desrosj Sep 12, 2024
dde08ba
Revert "Re-add saving of environment name as well as type."
desrosj Sep 12, 2024
165a1e2
Merge pull request #2 from desrosj/simplify-result-counting
swissspidy Sep 12, 2024
da3cfe8
Adjust environment to be a free-form name.
desrosj Sep 17, 2024
141109a
Save outcome status correctly.
desrosj Sep 17, 2024
4833c00
Correctly sanitize environment name and fix typo.
desrosj Sep 17, 2024
924795d
PHP version was moved to a taxonomy.
desrosj Sep 17, 2024
f424036
Fix displaying the username.
desrosj Sep 17, 2024
43f733a
Don't link to the author's archive for now.
desrosj Sep 17, 2024
2fe266f
Don't link to the author's archive for now.
desrosj Sep 17, 2024
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
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
78 changes: 78 additions & 0 deletions parts/result-set-all.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php
use PTR\Display;

echo Display::get_display_css(); ?>

<table class="ptr-test-reporter-table alignwide">
<thead>
<tr>
<th style="width:100px">Revision</th>
<th style="width:100px">Environments</th>
<th style="width:100px">Passed</th>
<th style="width:100px">Failed</th>
<th style="width:100px">➡️</th>
</tr>
</thead>
<tbody>
<?php
foreach ( $revisions as $revision ) :
$rev_id = (int) ltrim( $revision->post_name, 'r' );
$query_args = array(
'posts_per_page' => $posts_per_page,
'post_type' => 'result',
'post_parent' => $revision->ID,
'orderby' => 'post_title',
'order' => 'ASC',
);
$report_query = new WP_Query( $query_args );

$environments = [];
$num_hosts = 0;
$num_passed = 0;
$num_failed = 0;

foreach ( $report_query->posts as $report ) {
$env = Display::get_display_environment_name($report->ID);

$environments[$env] ??= 0;
++$environments[$env];

$results = get_post_meta($report->ID, 'results', true);

if (0 === (int) $results['failures'] && 0 === (int) $results['errors']) {
++$num_passed;
} else {
++$num_failed;
}
}
?>
<tr>
<td>
<a
href="<?php echo esc_url( sprintf( 'https://core.trac.wordpress.org/changeset/%d', $rev_id ) ); ?>"
title="<?php echo esc_attr( apply_filters( 'the_title', $revision->post_title ) ); ?>">
r<?php echo $rev_id; ?>
</a>
</td>
<td>
<?php echo count( $environments ); ?>
</td>
<td>
<span class="ptr-status-badge ptr-status-badge-passed">
<?php echo $num_passed; ?>
</span>
</td>
<td>
<span class="ptr-status-badge ptr-status-badge-failed">
<?php echo $num_failed; ?>
</span>
</td>
<td>
<a href="<?php the_permalink( $revision->ID ); ?>">
View
</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
123 changes: 123 additions & 0 deletions parts/result-set-single.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<?php
use PTR\Display;

echo Display::get_display_css();

foreach ( $revisions as $revision ) :

$rev_id = (int) ltrim( $revision->post_name, 'r' );
?>


<div class="ptr-test-reporter-single-revision">
<a href="<?php echo esc_url( sprintf( 'https://core.trac.wordpress.org/changeset/%d', $rev_id ) ); ?>">
r<?php echo $rev_id; ?>
</a>: <?php echo esc_attr( apply_filters( 'the_title', $revision->post_title ) ); ?>
</div>

<table class="ptr-test-reporter-table alignwide">
<thead>
<tr>
<th style="width:100px">Status</th>
<th style="width:150px">PHP Version</th>
<th>Database Version</th>
</tr>
</thead>
<tbody>

<?php
$query_args = array(
'posts_per_page' => $posts_per_page,
'author' => $post_author ?? null,
'post_type' => 'result',
'post_parent' => $revision->ID,
'orderby' => [ 'author' => 'ASC', 'env_name_clause' => 'ASC', 'php_version_clause' => 'ASC' ],
'meta_query' => array(
'relation' => 'OR',
'php_version_clause' => array(
'key' => 'php_version',
'compare' => 'EXISTS',
),
array(
'key' => 'php_version',
'compare' => 'NOT EXISTS',
),
'env_name_clause' => array(
'key' => 'environment_name',
'compare' => 'EXISTS',
),
array(
'key' => 'environment_name',
'compare' => 'NOT EXISTS',
)
),
);
$report_query = new WP_Query( $query_args );
if ( ! empty( $report_query->posts ) ) :

$prev_author = null;

foreach ( $report_query->posts as $report ) :
$status = 'Errored';
$status_title = 'No results found for test.';
$results = get_post_meta( $report->ID, 'results', true );
if ( isset( $results['failures'] ) && ! empty( $results['tests'] ) ) {
$status = 0 === (int) $results['failures'] && 0 === (int) $results['errors'] ? 'Passed' : 'Failed';
$status_title = (int) $results['tests'] . ' tests, ' . (int) $results['failures'] . ' failed, ' . (int) $results['errors'] . ' errors';
}
$host = 'Unknown';
$user = get_user_by( 'id', $report->post_author );
if ( $user ) {
$host = '';
if ( ! empty( $user->user_url ) ) {
$host .= '<a target="_blank" rel="nofollow" href="' . esc_url( $user->user_url ) . '">';
}
$host .= get_avatar(
$user->ID,
18,
'',
'',
array(
'extra_attr' => 'style="vertical-align: middle;margin-right:5px;"',
)
);
if ( ! empty( $user->user_url ) ) {
$host .= '</a>';
}

$host .= '<a href="' . esc_url( get_author_posts_url( $user->ID) ) . '">';
$host .= Display::get_display_environment_name( $report->ID );
$host .= '</a>';
}
?>
<?php if ( $prev_author !== $host ): ?>
<tr>
<td colspan="3">
<?php echo wp_kses_post( $host ); ?>
</td>
</tr>

<?php endif; ?>
<tr>
<td>
<a href="<?php echo esc_url( get_permalink( $report->ID ) ); ?>" title="<?php echo esc_attr( $status_title ); ?>" class="<?php echo esc_attr( 'ptr-status-badge ptr-status-badge-' . strtolower( $status ) ); ?>">
<?php echo esc_html( $status ); ?>
</a>
</td>
<td><?php echo esc_html( Display::get_display_php_version( $report->ID ) ); ?></td>
<td><?php echo esc_html( Display::get_display_mysql_version( $report->ID ) ); ?></td>
</tr>
<?php
$prev_author = $host;
endforeach;
else :
?>
<tr>
<td colspan="3">
No reports for changeset.
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<?php endforeach;
89 changes: 0 additions & 89 deletions parts/result-set.php

This file was deleted.

13 changes: 13 additions & 0 deletions parts/single-result.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@
<td><strong>Host</strong></td>
<td><?php echo wp_kses_post( $host ); ?></td>
</tr>
<tr>
<td><strong>Test Date</strong></td>
<td>
<?php the_date(); ?>
<?php the_time(); ?>
</td>
</tr>
<tr>
<td><strong>Execution Time</strong></td>
<td>
<?php echo esc_html( Display::get_display_time( $report->ID ) ); ?>
</td>
</tr>
<tr>
<td><strong>PHP Version</strong></td>
<td><?php echo esc_html( Display::get_display_php_version( $report->ID ) ); ?></td>
Expand Down
Loading