Test::Chimps::Smoker - Poll a set of repositories and run tests when they change
# command line tool chimps-smoker.pl \ -c /path/to/configfile.yml \ -s http://www.example.com/cgi-bin/chimps-server.pl # API use Test::Chimps::Smoker; my $poller = Test::Chimps::Smoker->new( server => 'http://www.example.com/cgi-bin/chimps-server.pl', config_file => '/path/to/configfile.yml', ); $poller->smoke;
Chimps is the Collaborative Heterogeneous Infinite Monkey Perfectionification Service. It is a framework for storing, viewing, generating, and uploading smoke reports. This distribution provides client-side modules and binaries for Chimps.
This module gives you everything you need to make your own build slave. You give it a configuration file describing all of your projects and how to test them, and it will monitor the repositories, check the projects out (and their dependencies), test them, and submit the report to a server.
Creates a new smoker object. ARGS is a hash whose valid keys are:
Mandatory. The configuration file describing which repositories to monitor. The format of the configuration is described in "CONFIGURATION FILE". File is update after each run.
Optional. The URI of the server script to upload the reports to. Defaults to simulation mode when reports are sent.
Optional. Number of seconds to sleep between repository checks. Defaults to 60 seconds.
[DEPRECATED] Just don't provide server option to enable simulation.
Don't actually submit the smoke reports, just run the tests. This does, however, increment the revision numbers in the config file.
Calling smoke will cause the
Smoker object to continually poll repositories for changes in revision numbers. If an (actual) change is detected, the repository will be checked out (with dependencies), built, and tested, and the resulting report will be submitted to the server. This method may not return. Valid options to smoke are:
Specifies the number of iterations to run. This is the number of smoke reports to generate per project. A value of 'inf' means to continue smoking forever. Defaults to 'inf'.
An array reference specifying which projects to smoke. If the string 'all' is provided instead of an array reference, all projects will be smoked. Defaults to 'all'.
There are read-only accessors for server and config_file.
The configuration file is YAML dump of a hash. The keys at the top level of the hash are project names. Their values are hashes that comprise the configuration options for that project.
Perhaps an example is best. A typical configuration file might look like this:
--- Some-jifty-project: configure_cmd: perl Makefile.PL --skipdeps && make dependencies: - Jifty revision: 555 root_dir: trunk/foo repository: type: SVN uri: svn+ssh://svn.example.com/svn/foo test_glob: t/*.t t/*/*.t Jifty: configure_cmd: perl Makefile.PL --skipdeps && make dependencies: - Jifty-DBI revision: 1332 root_dir: trunk repository: type: SVN uri: svn+ssh://svn.jifty.org/svn/jifty.org/jifty Jifty-DBI: configure_cmd: perl Makefile.PL --skipdeps && make env: JDBI_TEST_MYSQL: jiftydbitestdb JDBI_TEST_MYSQL_PASS: '' JDBI_TEST_MYSQL_USER: jiftydbitest JDBI_TEST_PG: jiftydbitestdb JDBI_TEST_PG_USER: jiftydbitest revision: 1358 root_dir: trunk repository: type: SVN uri: svn+ssh://svn.jifty.org/svn/jifty.org/Jifty-DBI
The supported project options are as follows:
The command to configure the project after checkout, but before running tests.
This is the last revision known for a given project. When started, the poller will attempt to checkout and test all revisions (besides ones on which the directory did not change) between this one and HEAD. When a test has been successfully uploaded, the revision number is updated and the configuration file is re-written.
The subdirectory inside the repository where configuration and testing commands should be run.
A hash describing repository of the project. Mandatory key is type which must match a source class name, for example SVN or Git. Particular source class may have more options, but at this moment Git and SVN have only 'uri' option.
A hash of environment variable names and values that are set before configuration, and reverted to their previous values after the tests have been run. In addition, if environment variable FOO's new value contains the string "$FOO", then the old value of FOO will be substituted in when setting the environment variable.
Special environment variables are set in addition to described above. For each project CHIMPS_<project name>_ROOT is set pointing to the current checkout of the project.
A list of project names that are dependencies for the given project. All dependencies are checked out at HEAD, have their configuration commands run, and all dependencys' $root_dir/blib/lib directories are added to @INC before the configuration command for the project is run.
Indicates that this project should not be tested. It is only present to serve as a dependency for another project.
How to find all your tests, defaults to t/*.t t/*/t/*.t
A list of paths, relative to the project root, which should be added to @INC.
blib/lib is automatically added, but you may need to include
lib here, for instance.
The command to clean before or after each iteration of the project testing. Called twice before running tests and after with --config, --project arguments and --clean argument when called for the second time after testing.
When called before testing (without --clean), state information can be printed to STDOUT. Later when called after testing (with --clean), the state info can be read from STDIN.
An example you can find in a tarball of this distribution - examples/pg_dbs_cleaner.pl.
This module assumes the use of the following report variables:
project revision committer duration osname osvers archname
<zev at cpan.org>
Please report any bugs or feature requests to
bug-test-chimps at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Chimps-Client. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
You can also look for information at:
Chimps has a mailman mailing list at email@example.com. You can subscribe via the web interface at http://lists.bestpractical.com/cgi-bin/mailman/listinfo/chimps.
Copyright 2006-2009 Best Practical Solutions.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.