Skip to content

Latest commit

 

History

History
 
 

php

PHP meta-runners for TeamCity

The Meta-runner Power Pack for TeamCity 8 contains a set of PHP-related meta runners:

  • Run arbitrary PHP code using the PHP runner
  • Install a specific Composer dependency using the Install Composer package runner
  • Install/update packages from composer.json using the Run Composer runner
  • Run Phing build script using the Phing runner
  • Run PHPUnit tests (with code coverage reporting) using the PHPUnit runner

Before being able to use these runners, the following prerequisites should be satisfied:

Most runners will report back their output in the TeamCity build log. The following is the output of the PHP runner:

PHP runner output in build log

PHP Runner

The PHP runner allows running arbitrary PHP code.

PHP runner

The following options can be specified:

  • PHP script: The PHP script to run.
  • Working directory: The working directory to use. If omitted, the current working directory will be used.
  • PHP parameters: Additional parameters for the PHP command line.

Install Composer package runner

The Install Composer package runner allows installing a given Composer dependency during the build.

This build step will automatically download composer.phar from the GetComposer.org website during build.

Install Composer package runner

The following options can be specified:

  • Composer.json directory: The directory where composer.json is located. Note that a composer.json file must exist in this directory for the runner to work.
  • Composer dependency: The Composer dependency to install, for example phpunit/phpunit.
  • Composer dependency version constraint: A version constraint for the Composer dependency, for example 3.7.*.
  • Composer parameters: Additional parameters for the Composer command line.

Run Composer runner

The Run Composer runner allows installing or updating Composer dependencies during the build.

This build step will automatically download composer.phar from the GetComposer.org website during build.

Run Composer runner

The following options can be specified:

  • Composer.json directory: The directory where composer.json is located. Note that a composer.json file must exist in this directory for the runner to work.
  • Composer command: Either install or update, depending on the use case.
  • Composer parameters: Additional parameters for the Composer command line.

Phing runner

The Phing runner allows running a Phing script during the build.

This build step will use a Phing executable available on the build agent if specified, or automatically download the latest phing-latest.phar from the Phing.info website during build.

Phing runner

The following options can be specified:

  • Phing runtime: The Phing executable to use during build. If omitted, the latest Phing version will be downloaded during build.
  • Phing configuration file: The build.xml file to run.
  • Working directory: The working directory to use. If omitted, the current working directory will be used.
  • Targets: The build targets to be run, separated by spaces.
  • Phing parameters: Additional parameters for the Phing command line.

PHPUnit runner

The PHPUnit runner allows running PHPUnit tests during the build and will optionally publish code coverage results to TeamCity.

This build step will use a PHPUnit executable available on the build agent if specified, or automatically download the latest phpunit.phar from the PHPUnit.de website during build.

PHPUnit runner

The following options can be specified:

  • PHPUnit runtime: The PHPUnit executable to use during build. If omitted, the latest PHPUnit version will be downloaded during build.
  • PHPUnit configuration file: The path where the phpunit.xml file resides, or a full path to a specific PHPUnit configuration.
  • Working directory: The working directory to use. If omitted, the current working directory will be used.
  • PHPUnit parameters: Additional parameters for the PHPUnit command line.
  • Collect code coverage Enables code coverage analysis and reporting for the test run.

The PHPUnit runner will report unit test results to the TeamCity server:

PHPUnit runner - test results

When the Collect code coverage option is enabled, the PHPUnit runner will publish a code coverage report to the TeamCity server:

PHPUnit runner - code coverage