为什么要自动化构建?

发布于 2024-10-06 07:48:47 字数 211 浏览 3 评论 0原文

因此,我坚信每晚(甚至更频繁)运行自动化构建,尤其是在项目的后期阶段。今晚我试图说服一位同事,我们需要做出一些改变来促进这一点,而他首先对自动化构建的整个前提提出了挑战。星期五晚上很晚了,我度过了漫长的一周,我很累,老实说我无法想出一个好的答案。那么,令人惊叹的 Stack Overflow 社区的好人们,我向你们提出这个简单的问题:

为什么要进行自动化构建(或者为什么不进行自动化构建)?

So, I'm a firm believer in having automated builds that run nightly (or even more often), especially during the late phases of a project. I was trying to convince a colleague tonight that we need to make some changes to facilitate this, and he challenged the whole premise of having automated builds in the first place. It is late on a Friday night, I've had a long week, I'm tired, and I honestly couldn't come up with a good answer. So, good people of the amazingly awesome Stack Overflow community, I come to you with this simple question:

Why have an automated build (or why not)?

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

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

发布评论

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

评论(6

紅太極 2024-10-13 07:48:47

我在模仿我的生产环境的虚拟机中设置了一个持续集成服务器;通过运行自动化构建,当我做了一些搞砸代码的事情时,我可以更快地知道很多,并且可以采取措施来修复它。

在多人的项目中,尤其是较大的项目中,无法保证每个用户都在运行测试并进行完整的构建。没有完整构建的时间越长,当每个开发人员都在自己的分支上埋头苦干时,某些错误潜入系统的可能性就越大。自动化构建通过确保整个团队在一天左右的时间内知道何时出现问题以及责任人来解决这个问题。

如需更多备份,尤其是在疲劳时,您可以发送 这篇文章来自我们自己的 Jeff Atwood,或这篇文章 来自乔尔·斯波尔斯基。从这最后:

以下是一些好处
每日构建:

修复错误后,测试人员将获得
新版本很快并且可以重新测试
看看这个错误是否真的被修复了。

开发人员可以感到更安全
他们所做的改变不会被破坏
系统的 1024 个版本中的任何一个
生产出来的,实际上没有
桌上有一个 OS/2 盒子
测试一下。

检查他们的开发人员
在预定时间之前发生变化
日常构建知道它们不是
会用软管浇灌其他人
检查“破坏”的东西
构建”——也就是说,
导致没人能够编译。
这相当于蓝色
整个死亡画面
编程团队,并且发生了很多事情
当程序员忘记添加新的
他们创建的文件到存储库。
该构建在他们的机器上运行良好,
但当其他人退房时,他们
出现链接器错误并被冷停止
不做任何工作。

外部团体
例如营销、测试版客户网站、
等等谁需要使用
不成熟的产品可以选择一个构建
已知相当稳定并保持
使用了一段时间。

通过维护
所有日常构建的存档,当
你发现了一个非常奇怪的新错误
你不知道是什么原因造成的
它,你可以使用二分搜索
历史档案以查明何时
该错误首先出现在代码中。
结合良好的源代码控制,您
或许可以追踪到哪个签到
导致了这个问题。

当测试员时
报告程序员的问题
认为是固定的,测试人员可以说
他们在哪个建筑中发现了问题。
然后程序员看看他什么时候
检查修复并弄清楚
是否真的修复了。

I have a continuous integration server set up in a VM that mimics my production environment; by running automated builds, I know a LOT sooner when I've done something to screw up the code, and can make moves to fix it.

In a project with multiple people, especially larger projects, there are no guarantees that every user is running the tests and doing a full build. The longer you go without a full build, the greater the chances that some bug will sneak its way into the system while each dev is plugging away at his branch. Automated builds negate this issue by making sure the whole team knows, within the day or so, when something went wrong, and who was responsible.

For more backup, especially when tired, you might send over this article from our own Jeff Atwood, or this one from Joel Spolsky. From this last:

Here are some of the many benefits of
daily builds:

When a bug is fixed, testers get the
new version quickly and can retest to
see if the bug was really fixed.

Developers can feel more secure that a
change they made isn't going to break
any of the 1024 versions of the system
that get produced, without actually
having an OS/2 box on their desk to
test on.

Developers who check in their
changes right before the scheduled
daily build know that they aren't
going to hose everybody else by
checking in something which "breaks
the build" -- that is, something that
causes nobody to be able to compile.
This is the equivalent of the Blue
Screen of Death for an entire
programming team, and happens a lot
when a programmer forgets to add a new
file they created to the repository.
The build runs fine on their machines,
but when anyone else checks out, they
get linker errors and are stopped cold
from doing any work.

Outside groups
like marketing, beta customer sites,
and so forth who need to use the
immature product can pick a build that
is known to be fairly stable and keep
using it for a while.

By maintaining
an archive of all daily builds, when
you discover a really strange, new bug
and you have no idea what's causing
it, you can use binary search on the
historical archive to pinpoint when
the bug first appeared in the code.
Combined with good source control, you
can probably track down which check-in
caused the problem.

When a tester
reports a problem that the programmer
thinks is fixed, the tester can say
which build they saw the problem in.
Then the programmer looks at when he
checked in the fix and figure out
whether it's really fixed.

ㄟ。诗瑗 2024-10-13 07:48:47

请允许我首先公然抄袭维基百科。请记住,这些是持续集成的一般好处,其中夜间构建应被视为部分实现。显然,如果您将夜间构建与自动化(单元、功能等)测试结合起来,您的系统将会更加强大。

优点:

  • 当单元测试失败或出现错误时,开发人员可以将代码库恢复到无错误状态,而无需浪费时间调试
  • 开发人员不断检测和修复集成问题 - 避免在发布日期的最后一刻出现混乱(当每个人都试图检查它们稍微不兼容的版本)。
  • 损坏/不兼容代码的预警
  • 冲突更改的预警
  • 立即对所有更改进行单元测试
  • 持续提供用于测试、演示或发布目的的“当前”版本
  • 立即向开发人员反馈有关更改的质量、功能或系统范围的影响他们正在编写的代码
  • 频繁的代码签入促使开发人员创建
  • 由自动化测试和 CI 生成的模块化、不太复杂的代码指标(例如代码覆盖率、代码复杂性和功能完整的指标),使开发人员专注于开发功能性的、高质量的代码和帮助团队发展动力

如果我们只是孤立地讨论每晚构建策略,那么您得到的就是对您的代码库在测试平台上编译的持续健全性检查,以及及时详细说明责任人的快照。将其与自动化测试和持续集成的合理策略结合起来,突然间您就拥有了一个强大的套件,除了谁破坏了构建之外,还可以为您提供谁未通过测试 好交易,如果你问我的话。

您可以在本文的其余部分中了解其缺点,但请记住,这我们在这里谈论的是维基百科。

Allow me to begin by blatantly ripping off Wikipedia. Bear in mind, these are the general benefits of continuous integration, of which nightly builds should be considered a partial implementation. Obviously, your system will be more powerful if you couple nightly builds with your bed of automated (unit, functional, etc.) tests.

Advantages:

  • when unit tests fail or a bug emerges, developers might revert the codebase back to a bug-free state, without wasting time debugging
  • developers detect and fix integration problems continuously - avoiding last-minute chaos at release dates, (when everyone tries to check in their slightly incompatible versions).
  • early warning of broken/incompatible code
  • early warning of conflicting changes
  • immediate unit testing of all changes
  • constant availability of a "current" build for testing, demo, or release purposes
  • immediate feedback to developers on the quality, functionality, or system-wide impact of code they are writing
  • frequent code check-in pushes developers to create modular, less complex code
  • metrics generated from automated testing and CI (such as metrics for code coverage, code complexity, and features complete) focus developers on developing functional, quality code, and help develop momentum in a team

If we're just talking about a nightly build strategy in isolation, what you get is a constant sanity check that your codebase compiles on the test platform(s), along with a snapshot in time detailing who to blame. Couple this with automated testing and a sane strategy of continuous integration, and suddenly you have a robust suite that gives you who failed the tests in addition to who broke the build. Good deal, if you ask me.

You can read about the disadvantages in the remainder of the article, but remember, this is Wikipedia we're talking about here.

神爱温柔 2024-10-13 07:48:47

我认为...

这样你就知道自己什么时候崩溃了
尽快并且可以
趁它还新鲜的时候修复它
头,而不是几周后。

很容易是我的最爱,但这里有一些其他原因当我只是在寻找你不使用 CI 的原因时,它被公然窃取:

  • 你无法部署的代码是无用的代码。
  • 将您的代码更改与团队中其他人的代码更改集成。
  • 有时我会忘记在签入之前运行所有单元测试。我的 CI 服务器永远不会忘记。
  • 代码的集中状态有助于沟通。 (如果我签入了损坏的代码,而其他人必须进行部署……那么这又回到了我最喜欢的原因。)

I think that...

So that you know when you've broken
something as soon as possible and can
fix it while it's still fresh in your
head, rather than weeks later.

is easily my favorite, but here are some other reasons blatantly stolen when I was just searching for reasons why you wouldn't use CI:

  • Code you cannot deploy is useless code.
  • Integrating your code changes with the code changes of other people on the team.
  • I sometimes forget to run ALL the unit tests before I check in. My CI server never forgets.
  • Centralized status of your code which can help with communication. (If I checked in broken code and someone else has to be a deployment... well this goes back to my favorite reason.)
不可一世的女人 2024-10-13 07:48:47

因为,

  1. 单元测试的完整性是自动测试的。因此,您不必担心您的程序的功能不会因为其他人所做的更改而被破坏。

  2. 自动获取最新的签入文件并编译,因此报告由其他引起的任何编译错误。

  3. 构建失败和成功执行时的即时电子邮件确认。这样您就可以知道是谁构建失败了。

  4. 可以与 FX cop、Style Cop for .Net 等代码标准工具集成。因此,在构建时,它会自动检查编码标准。

Because,

  1. Integrity of your Unit Test is automatically tested. So you need not to worry about functionality of your program is not broken because of changes made by others.

  2. Automatically gets the latest Checked-In files and compiles, so any compile error caused by other reported.

  3. Instant e-Mail acknowledgment on failure and successful execution of build. So you get to who failed the build.

  4. Can be integrated with Code Standard Tool like FX cop, Style Cop for .Net. So while build it automatically checks the Coding Standards.

何必那么矫情 2024-10-13 07:48:47

如果不定期进行完整构建,最终可能会出现一种情况,即应该重新编译的程序的某些部分没有被重新编译,即编译该程序部分的失败隐藏了重大更改。部分构建将继续正常工作,但下一个完整构建将导致事情无缘无故地崩溃。之后让一切正常运转可能会是一场噩梦。

If one doesn't do full builds on a regular basis, one can end up with a situation where some part of a program that should have been recompiled isn't, that the failure to compile that part of the program conceals a breaking change. Partial builds will continue to work fine, but the next full build will cause things to break for no apparent reason. Getting things to work after that can be a nightmare.

顾北清歌寒 2024-10-13 07:48:47

一项潜在的社会效益:自动化构建可以减少团队成员之间的毒性。如果开发人员每天重复执行一次或多次多步骤流程,错误就会悄悄出现。对于手动构建,团队成员可能会有这样的态度:“我无能的开发人员不记得如何每天正确进行构建.你会认为他们现在已经把它放下了。”通过自动化构建,出现的任何问题都是程序的问题——当然,程序是某人编写的,但仍然如此。

One potential social benefit: automated builds could decrease toxicity among team members. If developers are repeatedly carrying out a multi-step process one or more times per day, mistakes are going to creep in. With manual builds, teammates might have the attitude, "My incompetent developers can't remember how to do builds right every day. You'd think they have it down by now." With automated builds, any problems that come up are problems with a program - granted, a program that someone wrote, but still.

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