Code Monkey home page Code Monkey logo

php-automate-build-ant's Introduction

Automate PHP Build with Apache Ant

This is an example PHP project using Apache Ant for automating the build process. It orchestrates the execution of several software quality and metric tools defined in the build.xml build script like:

  • Perform syntax check of PHP sourcecode files using php's lint-mode
  • Measure project size using PHPLOC
  • Calculate software metrics using PHP_Depend
  • Perform project mess detection using PHPMD
  • Find coding standard violations using PHP_CodeSniffer
  • Find duplicate code using PHPCPD
  • Run unit tests with PHPUnit
  • Generate project documentation using phpDox
  • Log results in several formats for later use with Jenkins CI

This project is also part of a proof of concept called "Continuous Integration and Deployement for PHP projects" which uses Jenkins as CI server.

You can find more information about this project at https://github.com/code-smell/php-automate-build-ant.

Requirements

In order to work the following requirements have to be installed properly.

  • Git - a distributed version control system
  • Apache Ant - a command-line build tool

Please refer to the appropriate documention which guides you through the installation process.

Ant Targets

Here is an overview of the tasks defined in the above build.xml (download) script that are intended to be directly invoked:

  • full-build is the default build target. It invokes all the tools in such a way that XML logfiles are written to default locations. Running the full build may take a considerable amount of time and might only be useful to perform nightly.
  • full-build-parallel is the same as full-build (see above) except that it executes the static analysis tools in parallel. Even when leveraging multiple CPUs, running the full build may take a considerable amount of time and might only be useful to perform nightly.
  • quick-build is a build target intended to be run by jobs that are triggered for every push to a repository. It performs a lint check and runs the tests (without generating code coverage reports).
  • clean can be used to clean up (delete) all build artifacts (logfiles, etc. that are produced during the build).
  • lint can be used to perform a syntax check of the project sources using php -l. This task can be used before committing.
  • phpcs can be used to find coding standard violations and print human readable output. This task can be used before committing.
  • phpcpd can be used to find duplicate code and print human readable output. This task can be used before committing.
  • phpmd can be used to perform project mess detection and print human readable output. This task can be used before committing.
  • phpunit can be used to run unit tests. This task can be used before committing.
  • phpdox can be used to generate project documentation.
  • phploc can be used to measure the project size.

The other tasks can also be invoked directly but this isn't the intended purpose. They are invoked by the tasks listed above.

How to

Please use the following commands to clone the project and start the default target.

$ git clone https://github.com/code-smell/php-automate-build-ant.git
$ cd example-project
$ ant

Build Artifacts

Executing the build.xml script will produce the following build artifacts:

build
|-- api ...
|-- coverage ...
|-- logs
|   |-- checkstyle.xml
|   |-- clover.xml
|   |-- crap4j.xml
|   |-- jdepend.xml
|   |-- junit.xml
|   |-- phploc.csv
|   |-- phploc.xml
|   |-- pmd-cpd.xml
|   `-- pmd.xml
|-- pdepend ...
`-- phpdox ...

These artifacts can be read by human or could be processed by Jenkins CI.

php-automate-build-ant's People

Contributors

tbreuss avatar

Watchers

James Cloos avatar

Forkers

captshanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.