• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
CPANci: Continuous Integration for CPAN
 

CPANci: Continuous Integration for CPAN

on

  • 597 views

A continuous integration framework for the CPAN

A continuous integration framework for the CPAN

Statistics

Views

Total Views
597
Views on SlideShare
357
Embed Views
240

Actions

Likes
0
Downloads
2
Comments
0

1 Embed 240

http://dave.thehorners.com 240

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    CPANci: Continuous Integration for CPAN CPANci: Continuous Integration for CPAN Presentation Transcript

    • Testing CPANin the21st CenturyMike Friedman(friedo)YAPC::NA 2013Austin,TXTuesday, June 4, 13
    • A lengthy series of badideas and stupidquestions.Tuesday, June 4, 13
    • Tuesday, June 4, 13
    • Stupid Question No. 1Tuesday, June 4, 13
    • Tuesday, June 4, 13
    • Stupid Question No. 2Tuesday, June 4, 13
    • What’s this about,anyway?Tuesday, June 4, 13
    • What’s this about,anyway?CPANciTuesday, June 4, 13
    • A Brief HistoryTuesday, June 4, 13
    • A Brief History•December 18, 1987Tuesday, June 4, 13
    • A Brief History•December 18, 1987•Perl 1.000 released.Tuesday, June 4, 13
    • A Brief History•December 18, 1987•Perl 1.000 released.•TAP invented.Tuesday, June 4, 13
    • The Test Anything ProtocolTuesday, June 4, 13
    • The Test Anything Protocol1..42ok 1 the thing looks good!ok 2ok 3 $beer isa $drinknot ok 4 too much $beernot ok 5 $me->vomit( now )...Tuesday, June 4, 13
    • A Brief HistoryTuesday, June 4, 13
    • A Brief History•October 17, 1994Tuesday, June 4, 13
    • A Brief History•October 17, 1994•Perl 5.000 released.Tuesday, June 4, 13
    • A Brief History•October 17, 1994•Perl 5.000 released.•Perl has a module system.Tuesday, June 4, 13
    • Tuesday, June 4, 13
    • # from thisrequire "funcs.pl";Tuesday, June 4, 13
    • # from thisrequire "funcs.pl";# to thisuse My::Module;Tuesday, June 4, 13
    • Tuesday, June 4, 13
    • # but under the hoodBEGIN {require My::Module;My::Module->import;};Tuesday, June 4, 13
    • A Brief HistoryTuesday, June 4, 13
    • A Brief History•October 26, 1995Tuesday, June 4, 13
    • A Brief History•October 26, 1995•CPAN established.Tuesday, June 4, 13
    • A Brief History•October 26, 1995•CPAN established.•Perl modules are available.Tuesday, June 4, 13
    • A Brief HistoryTuesday, June 4, 13
    • A Brief History•May 15, 1997Tuesday, June 4, 13
    • A Brief History•May 15, 1997•Perl 5.004 released.Tuesday, June 4, 13
    • A Brief History•May 15, 1997•Perl 5.004 released.•CPAN.pm is in the core.Tuesday, June 4, 13
    • Tuesday, June 4, 13
    • # the dark art$ perl -MCPAN -e install FooTuesday, June 4, 13
    • A Brief HistoryTuesday, June 4, 13
    • A Brief History•May, 1998Tuesday, June 4, 13
    • A Brief History•May, 1998•CPAN Testers conceivedTuesday, June 4, 13
    • A Brief History•May, 1998•CPAN Testers conceived•Automated feedback for authorsTuesday, June 4, 13
    • Tuesday, June 4, 13
    • Tuesday, June 4, 13
    • Tuesday, June 4, 13
    • Tuesday, June 4, 13
    • A Brief HistoryTuesday, June 4, 13
    • A Brief History•November 15, 2003Tuesday, June 4, 13
    • A Brief History•November 15, 2003•Perl 5.6.2 released.Tuesday, June 4, 13
    • A Brief History•November 15, 2003•Perl 5.6.2 released.•Test::More is in the core.Tuesday, June 4, 13
    • Tuesday, June 4, 13
    • use Test::More tests => 3;ok( 42 );is( $foo, my value );isnt( foo, bar );Tuesday, June 4, 13
    • A Brief HistoryTuesday, June 4, 13
    • A Brief History•August 6, 2012Tuesday, June 4, 13
    • A Brief History•August 6, 2012•Mike goes to work for 10genTuesday, June 4, 13
    • Tuesday, June 4, 13
    • Tuesday, June 4, 13
    • WEB SCALE!!!!11Tuesday, June 4, 13
    • WEB SCALE!!!!11LOLTuesday, June 4, 13
    • Tuesday, June 4, 13
    • Bad Idea No. 1Tuesday, June 4, 13
    • Bad Idea No. 1Come up with a cool Perl MongoDB projectto show off atYAPC!Tuesday, June 4, 13
    • Bad Idea No. 1Come up with a cool Perl MongoDB projectto show off atYAPC!Itll be fun!Tuesday, June 4, 13
    • Bad Idea No. 1Come up with a cool Perl MongoDB projectto show off atYAPC!Itll be fun!promise!Tuesday, June 4, 13
    • CPAN Testers is Wonderful andAmazingTuesday, June 4, 13
    • Tuesday, June 4, 13
    • Disadvantages:Tuesday, June 4, 13
    • Disadvantages:Not real timeTuesday, June 4, 13
    • Disadvantages:Not real timeNot consistentTuesday, June 4, 13
    • Disadvantages:Not real timeNot consistentPolluted / Inconsistent environmentsTuesday, June 4, 13
    • Disadvantages:Not real timeNot consistentPolluted / Inconsistent environmentsNot all versions on all platformsTuesday, June 4, 13
    • I want Continuous Integrationfor the entire CPAN.Tuesday, June 4, 13
    • Tuesday, June 4, 13
    • Bad Idea No. 2Tuesday, June 4, 13
    • CPANci.orgBad Idea No. 2Tuesday, June 4, 13
    • Tuesday, June 4, 13
    • Stupid Question No. 3Tuesday, June 4, 13
    • Stupid Question No. 3How can we test CPAN without thedisadvantages of CPAN Testers?Tuesday, June 4, 13
    • Postulate:Every CPAN distribution must be tested in isolation, on avirgin Perl installation untouched by human hands.Tuesday, June 4, 13
    • Postulate:Every CPAN distribution must be tested in isolation, on avirgin Perl installation untouched by human hands.So how do we do that?Tuesday, June 4, 13
    • perlbrewTuesday, June 4, 13
    • VirtualizationTuesday, June 4, 13
    • VirtualizationWhoa!Tuesday, June 4, 13
    • Tuesday, June 4, 13
    • Bad Idea No. 3Tuesday, June 4, 13
    • Tuesday, June 4, 13
    • •Create an EC2 imageTuesday, June 4, 13
    • •Create an EC2 image•Put perlbrew on itTuesday, June 4, 13
    • •Create an EC2 image•Put perlbrew on it•Install every Perl locallyTuesday, June 4, 13
    • •Create an EC2 image•Put perlbrew on it•Install every Perl locally•Boot an instance for every uploadeddistributionTuesday, June 4, 13
    • •Create an EC2 image•Put perlbrew on it•Install every Perl locally•Boot an instance for every uploadeddistribution•Install needed dependencies for thedistributionTuesday, June 4, 13
    • •Create an EC2 image•Put perlbrew on it•Install every Perl locally•Boot an instance for every uploadeddistribution•Install needed dependencies for thedistribution•Run the tests and report the resultsTuesday, June 4, 13
    • •Create an EC2 image•Put perlbrew on it•Install every Perl locally•Boot an instance for every uploadeddistribution•Install needed dependencies for thedistribution•Run the tests and report the results•Shut down the instanceTuesday, June 4, 13
    • Tuesday, June 4, 13
    • Tuesday, June 4, 13
    • Stupid Question No. 4Tuesday, June 4, 13
    • Stupid Question No. 4How can we do this on one instance?Tuesday, June 4, 13
    • local::libcpanminusTuesday, June 4, 13
    • App::cpanminusTuesday, June 4, 13
    • App::cpanminus•Self-containedTuesday, June 4, 13
    • App::cpanminus•Self-contained•That is, the cpanm script is self-containedTuesday, June 4, 13
    • App::cpanminus•Self-contained•That is, the cpanm script is self-contained•via App::FatPackerTuesday, June 4, 13
    • App::cpanminusTuesday, June 4, 13
    • App::cpanminusThat means the same cpanm can be run by any perlTuesday, June 4, 13
    • App::cpanminusThat means the same cpanm can be run by any perlperlbrew switch mastercurl -L http://cpanmin.us/ | perl - App::cpanminusln -s ~/perl5/perlbrew/perls/master/bin/cpanm ./cpanm~/perl5/perlbrew/perls/perl-5.8.9/bin/perl cpanm~/perl5/perlbrew/perls/perl-5.10.1/bin/perl cpanm~/perl5/perlbrew/perls/perl-5.12.5/bin/perl cpanm~/perl5/perlbrew/perls/perl-5.14.4/bin/perl cpanm~/perl5/perlbrew/perls/perl-5.16.3/bin/perl cpanm~/perl5/perlbrew/perls/perl-5.18.0/bin/perl cpanm~/perl5/perlbrew/perls/perl-5.19.0/bin/perl cpanmTuesday, June 4, 13
    • Tuesday, June 4, 13
    • •Use perlbrew to install a "master" perlTuesday, June 4, 13
    • •Use perlbrew to install a "master" perl•Use it again to install "virgin" perls of everymajor versionTuesday, June 4, 13
    • •Use perlbrew to install a "master" perl•Use it again to install "virgin" perls of everymajor version•Use the master perl to install everythingfrom CPAN that makes CPANci workTuesday, June 4, 13
    • •Use perlbrew to install a "master" perl•Use it again to install "virgin" perls of everymajor version•Use the master perl to install everythingfrom CPAN that makes CPANci work•For each distribution, create a tempdirectoryTuesday, June 4, 13
    • •Use perlbrew to install a "master" perl•Use it again to install "virgin" perls of everymajor version•Use the master perl to install everythingfrom CPAN that makes CPANci work•For each distribution, create a tempdirectory•Tell cpanminus to install dependenciesthere, as if for local::libTuesday, June 4, 13
    • •Use perlbrew to install a "master" perl•Use it again to install "virgin" perls of everymajor version•Use the master perl to install everythingfrom CPAN that makes CPANci work•For each distribution, create a tempdirectory•Tell cpanminus to install dependenciesthere, as if for local::lib•Run tests and report resultsTuesday, June 4, 13
    • •Use perlbrew to install a "master" perl•Use it again to install "virgin" perls of everymajor version•Use the master perl to install everythingfrom CPAN that makes CPANci work•For each distribution, create a tempdirectory•Tell cpanminus to install dependenciesthere, as if for local::lib•Run tests and report results•Delete temp directory, leaving each perluntouched!Tuesday, June 4, 13
    • What does that look like?The "fetcher" grabs the latest distribution URLs fromMetaCPANs RSS feed.Tuesday, June 4, 13
    • What does that look like?We retrieve the distribution metadata fromthe MetaCPAN JSON API and saved it toMongoDB.Then we start the Installer.Tuesday, June 4, 13
    • What does that look like?We download the distribution tarball to a temp file.Then the fun stuff starts to happen.Tuesday, June 4, 13
    • What does that look like?We extract the archive in a specific "work" directoryfor each perl.Then create a temp directory for building and installingdependencies.Tuesday, June 4, 13
    • What does that look like?Use a specific perl binary to run cpanm andinstall dependencies, with no tests, to the tempdirectory.Then we parse the cpanm log on stderrTuesday, June 4, 13
    • What does that look like? "deps" : { "log" : [ { "indent" : 0, "type" : "working-on", "line" : "--> Working on .n" }, { "line" : "Configuring Lingua-EN-NamedEntity-1.92 ... OKn", "type" : "config", "indent" : 1 }, { "type" : "found-deps", "indent" : 1, "line" : "==> Found dependencies: Lingua::Stem::En, DB_File, LWP::Simplen" }, { "indent" : 1, "type" : "working-on", "line" : "--> Working on Lingua::Stem::Enn" }, { "indent" : 2, "type" : "fetch", "line" : "Fetching http://www.cpan.org/authors/id/S/SN/SNOWHARE/Lingua-Stem-0.84.tar.gz ... OKn" },Tuesday, June 4, 13
    • What does that look like?Use a specific perl to run each test file,save the TAP output and any errors, anduse the exit status to determine if it passed.Tuesday, June 4, 13
    • What does that look like?Parse the TAP output of each test into astructure which can be saved in MongoDBTuesday, June 4, 13
    • What does that look like? "name" : "t/05depth.t", "lines" : [ { "ok" : true, "text" : "1..12", "type" : "plan" }, { "number" : 1, "ok" : true, "type" : "test", "desc" : "new object", "text" : "ok 1 - new object" }, { "ok" : true, "number" : 2, "desc" : "depth", "type" : "test", "text" : "ok 2 - depth" }, { "desc" : "depth", "text" : "ok 3 - depth", "type" : "test", "number" : 3, "ok" : true }, { "type" : "test", "desc" : "depth", "text" : "ok 4 - depth", "ok" : true, "number" : 4 }, { "number" : 5, "ok" : true, "text" : "ok 5 - depth", "desc" : "depth", "type" : "test" }, { "number" : 6, "ok" : true, "type" : "test", "desc" : "depth", "text" : "ok 6 - depth" },Tuesday, June 4, 13
    • What does that look like? "name" : "t/05depth.t", "lines" : [ { "ok" : true, "text" : "1..12", "type" : "plan" }, { "number" : 1, "ok" : true, "type" : "test", "desc" : "new object", "text" : "ok 1 - new object" }, { "ok" : true, "number" : 2, "desc" : "depth", "type" : "test", "text" : "ok 2 - depth" }, { "desc" : "depth", "text" : "ok 3 - depth", "type" : "test", "number" : 3, "ok" : true }, { "type" : "test", "desc" : "depth", "text" : "ok 4 - depth", "ok" : true, "number" : 4 }, { "number" : 5, "ok" : true, "text" : "ok 5 - depth", "desc" : "depth", "type" : "test" }, { "number" : 6, "ok" : true, "type" : "test", "desc" : "depth", "text" : "ok 6 - depth" },•This is JSONTuesday, June 4, 13
    • What does that look like? "name" : "t/05depth.t", "lines" : [ { "ok" : true, "text" : "1..12", "type" : "plan" }, { "number" : 1, "ok" : true, "type" : "test", "desc" : "new object", "text" : "ok 1 - new object" }, { "ok" : true, "number" : 2, "desc" : "depth", "type" : "test", "text" : "ok 2 - depth" }, { "desc" : "depth", "text" : "ok 3 - depth", "type" : "test", "number" : 3, "ok" : true }, { "type" : "test", "desc" : "depth", "text" : "ok 4 - depth", "ok" : true, "number" : 4 }, { "number" : 5, "ok" : true, "text" : "ok 5 - depth", "desc" : "depth", "type" : "test" }, { "number" : 6, "ok" : true, "type" : "test", "desc" : "depth", "text" : "ok 6 - depth" },•This is JSON•Stored in MongoDBTuesday, June 4, 13
    • What does that look like? "name" : "t/05depth.t", "lines" : [ { "ok" : true, "text" : "1..12", "type" : "plan" }, { "number" : 1, "ok" : true, "type" : "test", "desc" : "new object", "text" : "ok 1 - new object" }, { "ok" : true, "number" : 2, "desc" : "depth", "type" : "test", "text" : "ok 2 - depth" }, { "desc" : "depth", "text" : "ok 3 - depth", "type" : "test", "number" : 3, "ok" : true }, { "type" : "test", "desc" : "depth", "text" : "ok 4 - depth", "ok" : true, "number" : 4 }, { "number" : 5, "ok" : true, "text" : "ok 5 - depth", "desc" : "depth", "type" : "test" }, { "number" : 6, "ok" : true, "type" : "test", "desc" : "depth", "text" : "ok 6 - depth" },•This is JSON•Stored in MongoDB•But its also TAP!Tuesday, June 4, 13
    • Tuesday, June 4, 13
    • Bad Idea No. 4Tuesday, June 4, 13
    • Bad Idea No. 4LIVE DEMO!Tuesday, June 4, 13
    • The future?Tuesday, June 4, 13
    • The future?•Integration with PintoTuesday, June 4, 13
    • The future?•Integration with Pinto•Integration with StratopanTuesday, June 4, 13
    • The future?•Integration with Pinto•Integration with Stratopan•All kinds of cool statistics on the websiteTuesday, June 4, 13
    • The future?•Integration with Pinto•Integration with Stratopan•All kinds of cool statistics on the website•Organizations using CPANci for theirinternal DarkPANsTuesday, June 4, 13
    • FinalThoughtsTuesday, June 4, 13
    • FinalThoughts•Play with new toys.Tuesday, June 4, 13
    • FinalThoughts•Play with new toys.•Think before you code.Tuesday, June 4, 13
    • FinalThoughts•Play with new toys.•Think before you code.•Have bad ideas.Tuesday, June 4, 13
    • FinalThoughts•Play with new toys.•Think before you code.•Have bad ideas.•Ask stupid questions.Tuesday, June 4, 13
    • FinalThoughts•Play with new toys.•Think before you code.•Have bad ideas.•Ask stupid questions.•Have fun.Tuesday, June 4, 13
    • Stupid Questions?Mike Friedman(friedo)friedo@friedo.comhttps://github.com/friedo/cpanciTuesday, June 4, 13