Benchmark::Report::GitHub - submit a benchmark report from Travis-CI to GitHub wiki
Let's call this t/benchmarking.pl.
t/benchmarking.pl
#!/usr/bin/env perl use strict; use warnings; use Benchmark::Report::GitHub; my $gh = Benchmark::Report::GitHub->new_from_env; $gh->add_benchmark( "Simple benchmark", -1, { implementation1 => sub { ... }, implementation2 => sub { ... }, }, ); $gh->add_benchmark( "Some other benchmark", -1, { implementation1 => sub { ... }, implementation2 => sub { ... }, implementation3 => sub { ... }, }, ); print $gh->publish, "\n";
And in your .travis.yml:
.travis.yml
env: global: - GH_NAME=username - GH_EMAIL=your@email.address - secure: "..." # GH_TOKEN after_success: perl -Ilib t/benchmarking.pl
After a successful Travis build, this module will git pull your project's GitHub wiki, run some benchmarks and output them as markdown, and then git push the wiki contents back to GitHub.
git pull
git push
new(%attributes)
new_from_env
travis_repo_slug
(e.g. "tobyink/p5-type-tiny")
"tobyink/p5-type-tiny"
gh_name
gh_email
gh_token
add_benchmark($name, $times, \%implementations)
publish(%options)
The supported options (all of which will be picked up from the environment, or a sane default provided if omitted) are:
perl_version
build_number
build_id
job_number
job_id
page
index_page
page_title
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Benchmark-Report-GitHub.
Benchmark, http://travis-ci.org/, http://github.com/.
Toby Inkster <tobyink@cpan.org>.
This software is copyright (c) 2014 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
To install Benchmark::Report::GitHub, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Benchmark::Report::GitHub
CPAN shell
perl -MCPAN -e shell install Benchmark::Report::GitHub
For more information on module installation, please visit the detailed CPAN module installation guide.