douhongxie5436 2017-01-18 18:38 采纳率: 100%
浏览 230
已采纳

在Jenkinsfile中使用Clover PHP和Checkstyle

Inside my Freestyle Jenkins job I can add the Post-build actions to generate a code coverage report using the plugin Clover PHP and an analysis using Checkstyle plugin.

However, I like to use the Pipeline Jenkins job, because it has the stage view. With the Pipeline job I need to set up everything inside a Jenkinsfile. How do I include the Clover PHP and Checkstyle plugin function inside a Jenkinsfile? There is no documentation on their page.

  • 写回答

4条回答 默认 最新

  • dongmu1914 2017-01-18 19:04
    关注

    Since both the things you want to integrate with have CLI interfaces, you can just call their CLIs using an sh action in the Jenkinsfile to call a shell command. Here's an example from the Clover PHP docs:

    sh "phpunit --log-junit 'reports/unitreport.xml' --coverage-html 'reports/coverage' --coverage-clover 'reports/coverage/coverage.xml' test/"
    

    The location for the Junit log will vary depending on where you put in your project. You must run a junit step before this runs.

    Checkstyle also has a CLI that you can call in a similar way from an sh action in your Jenkinsfile.

    As long as you archive the resulting HTML files with your build, you can read the resulting HTML files by navigating to them through the "Build Artifacts" link on the build page. An example URL structure might look like:

    https://ci.example.com/job/develop/342/artifact/reports/coverage/index.html
    

    For deeper integration, the tools may need explicit Jenkins Pipeline support.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 ansys fluent计算闪退
  • ¥15 有关wireshark抓包的问题
  • ¥15 需要写计算过程,不要写代码,求解答,数据都在图上
  • ¥15 向数据表用newid方式插入GUID问题
  • ¥15 multisim电路设计
  • ¥20 用keil,写代码解决两个问题,用库函数
  • ¥50 ID中开关量采样信号通道、以及程序流程的设计
  • ¥15 U-Mamba/nnunetv2固定随机数种子
  • ¥15 vba使用jmail发送邮件正文里面怎么加图片
  • ¥15 vb6.0如何向数据库中添加自动生成的字段数据。