加速 Hudson CI 上的 PHP 持续集成构建服务器

发布于 2024-09-18 10:30:31 字数 1156 浏览 7 评论 0原文

我正在尝试加快我的构建速度,并正在寻找一些关于如何做到这一点的想法。我目前使用 Hudson 作为 PHP 项目的持续集成服务器。

我使用 Ant build.xml 文件进行构建,使用类似于 Sebastian Bergmann 的 php-hudson-template。但目前(由于 Hudson 崩溃的一些奇怪问题),我只运行 phpDocumentor、phpcpd 和 phpUnit。 phpUnit 也会生成 Clover 代码覆盖率报告。

以下是一些可能的瓶颈:

  1. phpDocumentor需要 180 秒。我的项目中包含一些大型库,例如 awsninjaDirectedEdgeoauthsimplephpMailer。我不确定我是否真的需要为这些开发文档。我也不知道如何使用我的 build.xml 文件忽略整个子目录。
  2. phpUnit需要 120 秒。这是构建中唯一不作为并行任务运行的部分。编写的测试越多,这个时间就会增加得越长。除了可能运行多个 Hudson 构建从站并向每个从站分发单独的测试套件之外,真的不知道该怎么办。但我也不知道该怎么做。
  3. phpcpd需要 97 秒。我确信我可以通过忽略那些包含的库来消除一些解析和转换时间。不知道如何在我的 build.xml 文件中执行此操作。
  4. 我的服务器:现在我使用的是单个 Linode 服务器。整个过程似乎非常繁重。

您能想到的任何其他可能的瓶颈我都会添加到列表中。

有哪些解决方案可以缩短构建时间?

I'm trying to speed up my builds some and was looking for some thoughts on how to do so. I currently use Hudson as a continuous integration server for a PHP project.

I use an Ant build.xml file to do the build, using a file similar to Sebastian Bergmann's php-hudson-template. At the moment, though (due to some weird problems with Hudson crashing otherwise), I'm only running phpDocumentor, phpcpd, and phpUnit. phpUnit does generate Clover code-coverage reports, too.

Here are some possible bottlenecks:

  1. phpDocumentor: Takes 180 seconds. There are some large included libraries in my project, such as awsninja, DirectedEdge, oauthsimple, and phpMailer. I'm not sure that I really need to be developing documentation for these. I'm also not sure how to ignore whole subdirectories using my build.xml file.
  2. phpUnit: Takes 120 seconds. This is the only portion of the build that's not run as a parallelTask. The more tests that get written, the longer this time will increase. Really not sure what to do about this, aside from maybe running multiple Hudson build slaves and doling out separate test suites to each slave. But I also have no idea how to go about that, either.
  3. phpcpd: Takes 97 seconds. I'm sure that I can eliminate some parsing and conversion time by ignoring those included libraries. Not sure how to do this in my build.xml file.
  4. My server: Right now I'm using a single Linode server. It seems to get pretty taxed by the whole process.

Any other possible bottlenecks you can think of I'll add to the list.

What are some solutions for reducing my build time?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

流云如水 2024-09-25 10:30:31

我根本不是 PHP 专家,但如果需要,您应该能够将 PHPUnit 测试拆分到多个 Hudson 从属服务器上。我只是将您的测试套件分开,并将每个子集作为单独的并行 Hudson 作业运行。如果您有一台具有多个 CPU/核心的机器,您可以在其上运行多个从站。

您没有提到的一件明显的事情 - 只升级您的硬件,或者看看 Hudson 主机上正在运行并可能占用资源的其他内容怎么样?

I'm not a PHP expert at all, but you ought to be able to split your PHPUnit tests onto multiple Hudson slaves if you need to. I would just split your test suite up and run each subset as a separate, parallel Hudson job. If you have a machine with multiple CPUs / cores you can run multiple slaves on it.

One obvious thing you didn't mention - how about just upgrading your hardware, or taking a look at what else is running on the Hudson host and possibly taking up resources ?

姐不稀罕 2024-09-25 10:30:31
  1. phpDocumenter:phpdoc -h 显示 -i 选项,该选项允许您指定要忽略的以逗号分隔的文件/目录列表。可以将其添加到 phpdoc build.xml 标签的参数标签

  2. phpUnit:我注意到如果我针对数据库运行测试,它可能会很滞后,但我不知道如何改进这一点。

一个可能有帮助的事情是不要每次都运行文档管理器,而只将其作为构建的一部分运行,每天只发生一次(或类似的事情)

我最近刚刚开始使用这些工具,这些是我发现的一些事情。

  1. phpDocumenter: phpdoc -h reveals the -i option which allows you to specify a comma separated list of files/directories to ignore. This can be added to the arguments tag of your phpdoc build.xml tag

  2. phpUnit: I noticed it can be laggy if I am running tests against a database, but I am not aware of anyway to improve this.

One possible thing that might help would be to not run documenter every time and only run it as part of a build that only happens once a day (or something similar)

I just recently started using these tools and these are few things I discovered.

天涯离梦残月幽梦 2024-09-25 10:30:31

当我们遇到类似的问题时,我们求助于在单独的过夜构建中运行文档(以及 Selenium 中的功能测试脚本,因为这也非常慢)。这样,我们的主要 CI 构建就不会因为生成 API 文档而减慢速度。

不过,我注意到 PHP Documentor 现已更新到版本 2,与缓慢的旧版本 1 相比,速度有了显着提高。看起来它比 v1 快两到三倍。这将对您的 CI 流程产生很大的影响。请参阅 http://phpdoc.org/ 了解更多信息。

或者,您可以查看 apiGenphpDox,两者都是 PHPDoc 的替代品。它们都绝对比 PHPDoc v1 快;我还没有将它们与 v2 进行比较。

When we had a similar problem, we resorted to running the documentation in a separate overnight build (along with our functional test scripts in Selenium, as this is also pretty slow). This way, our main CI build wasn't slowed down by generating our API documentation.

However, I note that PHP Documentor has now been updated to version 2, which has significant speed improvements over the slow old version 1. It looks like it's in the region of two to three times faster than v1. This will make a big difference to your CI process. See http://phpdoc.org/ for more info.

Alternatively, you could take a look at apiGen and phpDox, both of which are alternatives to PHPDoc. They are both definitely faster than PHPDoc v1; I haven't compared them with v2 yet.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文