0

Getting start with jenkin for php project.

the following steps has been configured 1)Download jenkin-1.549 2)installed php plugin checkstyle 3)Add a project sample zf2demo

build.xml in zf2 demo

<target name="phpcs" >
  <exec executable="phpcs">
    <arg line="--report=checkstyle 
 --report-file=${project.basedir}/build/logs/checkstyle.xml
 --standard=Zend
 ${project.basedir}/*.php" />
  </exec>
 </target>

phpcs.xml in zf2demo/build

<ruleset name="zenddemo">
 <description>Description of your coding standard</description>

 <rule ref="Generic.PHP.DisallowShortOpenTag"/>
 <!-- ... -->
</ruleset>

The build run successfully Errors No report files were found. Configuration error?

Where to configure report file? do we need to create it manually

anything more need to configure to generate report?

In configuration part add Post-build Actions Publish Checkstyle analysis results

Checkstyle results  

‘/build/checkstyle.xml’ doesn’t match anything: ‘’ exists but not ‘/build/checkstyle.xml’

how to configure these? Edited When run from the console enter image description here

Cœur
  • 37,241
  • 25
  • 195
  • 267
guny
  • 197
  • 4
  • 19

1 Answers1

0

Go to build and check Console output [raw] What is the result of phpcs? Any errors?

phpcs:
     [exec] Result: 1

If you run phpcs fron console directly with provided params does report file generated?

ishenkoyv
  • 665
  • 4
  • 9
  • FILE: C:\wamp\www\zenddemo\index.php -------------------------------------------------------------------------------- FOUND 2 ERROR(S) AFFECTING 2 LINE(S) -------------------------------------------------------------------------------- 1 | ERROR | End of line character is invalid; expected "\n" but found "\r\n" 2 | ERROR | Missing file doc comment -------------------------------------------------------------------------------- check for one file index.php the result i get from console is as above – guny Feb 12 '14 at 12:04
  • You should run phpcs with all options from build config, i.e. -- report, --report-file, --standard=Zend. And check if reportfile is created – ishenkoyv Feb 12 '14 at 13:13
  • report file is generating correctly through command line. in Checkstyle results configuration whether we need to define any file path? in project configuration or anything like that i am missing – guny Feb 12 '14 at 13:39
  • do we need to create a checkstyle.xml by our self? and tell the path? how will be the format for checkstyle.xml – guny Feb 12 '14 at 13:43
  • 1
    Use ${basedir} instead of ${project.basedir}. checkstyle.xml should be genereated by phpcs as you provide option --report-file=${basedir}/build/logs/checkstyle.xml Publish Checkstyle analysis result in postbuild acton should be 'build/logs/checkstyle.xml' – ishenkoyv Feb 12 '14 at 13:49