pear:qa:ci

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
pear:qa:ci [2012/04/12 23:13] – [My unit tests need a (database/server/setup/configuration)] clockwerxpear:qa:ci [2012/04/12 23:32] – [How do I make sure my tests work?] clockwerx
Line 5: Line 5:
 http://test.pear.php.net/ hosts continuous integration tools http://test.pear.php.net/ hosts continuous integration tools
   * [[http://test.pear.php.net/|Pearweb test installation]]   * [[http://test.pear.php.net/|Pearweb test installation]]
-  * [[http://test.pear.php.net/unit-test-results/|Test results overview]] 
   * [[http://test.pear.php.net:8080/|Jenkins]]   * [[http://test.pear.php.net:8080/|Jenkins]]
 +  * [[http://test.pear.php.net/unit-test-results/|(old) Test results overview]]
   * [[https://github.com/pear/pear-svn-git|Migrate to github script]]   * [[https://github.com/pear/pear-svn-git|Migrate to github script]]
  
Line 12: Line 12:
  
 ===== Jenkins ===== ===== Jenkins =====
-Jenkins is a continuous integration platform. Currently, all packages in both PEAR and PEAR2 are built by it.+Jenkins is a continuous integration platform. Currently, all packages in both PEAR and PEAR2 were scanned for the presence of a 'tests' folder, and corresponding jenkins jobs were created. 
 + 
 +==== Access === 
 +Jenkins is configured to authenticate against the github organisations of pear / pear2. You simply need to be associated with one of the organisations to modify builds. 
 + 
 +==== Adding a new job/build ==== 
 +  * Create job 
 +  * Enter package name 
 +  * Enter link to github 
 +  * Enter the read-only git url into source management 
 +  * Select 'build on push from github' as a trigger 
 +  * Add either manual build steps or invoke an ant build.xml target. Manual steps should include executing  
 +    * phpunit --coverage-html build/coverage/ --coverage-clover build/logs/clover.xml --log-junit build/logs/junit.xml tests/ 
 +    * php ~/pyrus.phar package 
 +  * Add in Post-build Actions for 'Publish junit test result report'
  
 ==== How do I make sure my tests work? ==== ==== How do I make sure my tests work? ====
-In general, we encourage the use of an AllTests.php - we target PHPUnit 3.at this time.+In general, we encourage the use of an appropriate phpunit.xml - we target PHPUnit 3.at this time.
  
-Your package directory layout should allow you to successfully run your test suite as below:+Your package directory layout should allow you to successfully run your test suite as below (assuming svn):
 <code bash> <code bash>
 $ cd Foo_Bar/trunk $ cd Foo_Bar/trunk
-php tests/AllTests.php+phpunit -c phpunit.xml tests/
 </code> </code>
  
-... or as per the phpunit command above. 
- 
-http://jenkins-php.org/ is also worth a look. 
  
 ==== My directory layout doesn't work === ==== My directory layout doesn't work ===
Line 41: Line 52:
  
 # Run tests to confirm no fatal errors, using one of # Run tests to confirm no fatal errors, using one of
-$ php tests/AllTests.php 
 $ pear run-tests -r tests/ $ pear run-tests -r tests/
 $ phpunit tests/ $ phpunit tests/
Line 83: Line 93:
  
 > --Dan > --Dan
 +
 +==== Build tools ====
 +In general, ant is the preferred way of managing a build after a certain level of complexity. See http://jenkins-php.org/ for more detail.
 +
 +Noteably, we prefer phpdoc/docblox over phpdox.
 +
 +Some packages use phing
 +
 +==== Dependencies ====
 +There are two available techniques for managing dependencies without installing system wide libraries. 
 +
 +The first is relatively straight forward - simply pulling the library from source and pushing it into a lib directory.
 +<code bash>
 +$ git clone git://path/to/package.git lib/package
 +$ git clone git://path/to/package2.git lib/package2
 +$ phpunit --include-path lib/package:lib/package2 ...
 +</code>
 +
 +This can be either configured in the jenkins build or (preferred) in the relevant build.xml and phpunit.xml files.
 +
 +
 +The second is to utilise [[http://getcomposer.org|composer.phar]] in combination with a relevant phpunit.xml
 +
 ==== Todo ==== ==== Todo ====
   - Put more packages into jenkins   - Put more packages into jenkins
Line 113: Line 146:
   * For some tests the executable php-cgi is needed. In some Linux distributions this is contained in a separate package, but on for instance Gentoo Linux this has to be enabled using the cgi USE flag.   * For some tests the executable php-cgi is needed. In some Linux distributions this is contained in a separate package, but on for instance Gentoo Linux this has to be enabled using the cgi USE flag.
   * If running on linux, do not run the tests as root   * If running on linux, do not run the tests as root
- 
- 
pear/qa/ci.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1