Skip to content

Commit

Permalink
Add badges for smoketesting results
Browse files Browse the repository at this point in the history
  • Loading branch information
Tadeusz Sośnierz committed May 1, 2012
1 parent 6f3320d commit e511f1e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
16 changes: 13 additions & 3 deletions web/build-project-list.pl
Expand Up @@ -37,7 +37,7 @@ sub getstore {
}

my $output_dir = shift(@ARGV) || './';
my @MEDALS = qw<fresh medal readme tests unachieved proto camelia panda>;
my @MEDALS = qw<fresh medal readme tests unachieved proto camelia panda good nope>;
binmode STDOUT, ':encoding(UTF-8)';

local $| = 1;
Expand All @@ -62,7 +62,9 @@ sub getstore {

if ( $previous && $previous->{last_updated} eq $latest->{committed_date} ) {
$previous->{badge_is_fresh} = $project->{badge_is_fresh} ; #Even if the project was not modified we need to update this
$previous->{badge_panda} = $project->{badge_panda};
$previous->{badge_prereq_ok} = $project->{badge_prereq_ok};
$previous->{badge_builds_ok} = $project->{badge_builds_ok};
$previous->{badge_tests_ok} = $project->{badge_tests_ok};
%$project = %$previous;
print "Not updated since last check, loading from cache\n";
sleep(1); #We only did one api call
Expand Down Expand Up @@ -148,6 +150,9 @@ sub get_projects {
my ($list_url) = @_;
my $projects;
my $contents = eval { read_file('META.list.local') } || get($list_url);

my $test_results = json_get 'http://tjs.azalayah.net/results.json';

for my $proj (split "\n", $contents) {
print "$proj\n";
eval {
Expand All @@ -160,7 +165,12 @@ sub get_projects {
$projects->{$name}->{'auth'} = $auth;
$projects->{$name}->{'repo_name'} = $repo_name;
$projects->{$name}->{'url'} = $url;
$projects->{$name}->{'badge_panda'} = defined $json->{'source-url'};

my $smoke = $test_results->{$name};

$projects->{$name}->{'prereq_ok'} = !!$smoke->{'prereq'};
$projects->{$name}->{'builds_ok'} = !!$smoke->{'build'};
$projects->{$name}->{'tests_ok'} = !!$smoke->{'test'};
$projects->{$name}->{'description'} = $json->{'description'};
};
warn $@ if $@;
Expand Down
Binary file added web/good.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion web/index.tmpl
Expand Up @@ -110,7 +110,12 @@ dl.table-display {
<TMPL_IF badge_has_readme><a href="<TMPL_VAR badge_has_readme>"><img src='readme.png' title='Has a README' alt="Readme badge" /></a><TMPL_ELSE><img src='unachieved.png' title="Doesn't have a README" alt="Unachieved badge" /></TMPL_IF>
<TMPL_IF badge_has_tests><img src='tests.png' title='Has tests' alt="Tests badge" /><TMPL_ELSE><img src='unachieved.png' title="Doesn't have tests" alt="Unachieved badge" /></TMPL_IF>
<TMPL_IF badge_is_fresh><img src='fresh.png' title='Commits in the past 90 days' alt="Fresh badge" /><TMPL_ELSE><img src='unachieved.png' title='No commits in the past 90 days' alt="Unachieved badge" /></TMPL_IF>
<TMPL_IF badge_panda><img src='panda.png' title='Conforms to the latest Perl 6 modules specs' alt="Panda badge" /><TMPL_ELSE><img src='unachieved.png' title='Not quite up-to-date with the specs' alt="Unachieved badge" /></TMPL_IF>
<TMPL_IF prereq_ok><img src='good.png' title='All the prerequisites are fine' alt="Prerequisites ok" />
<TMPL_ELSE><img src='nope.png' title='Not everything is fine with the prerequisites' alt="Prerequisites not ok" /></TMPL_IF>
<TMPL_IF builds_ok><img src='good.png' title='The module builds fine' alt="Build ok" />
<TMPL_ELSE><img src='nope.png' title='The module does not build fine' alt="Build not ok" /></TMPL_IF>
<TMPL_IF tests_ok><img src='good.png' title='All tests run fine' alt="Tests ok" />
<TMPL_ELSE><img src='nope.png' title='Not all tests run fine' alt="Tests not ok" /></TMPL_IF>
</div>
<TMPL_VAR description></dd>
</TMPL_IF>
Expand Down
Binary file added web/nope.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e511f1e

Please sign in to comment.