开发者

Lightweight Continuous Integration for a centrally Haskell/Darcs toolchain?

开发者 https://www.devze.com 2023-01-21 04:43 出处:网络
I want some simple CI for a small dev setup. Two motivations -- a full build takes some time, and an anticipated testsuite will also take some time. I really would rather not dive headfirst into one o

I want some simple CI for a small dev setup. Two motivations -- a full build takes some time, and an anticipated testsuite will also take some time. I really would rather not dive headfirst into one of the big players that require a java application container or whatever to show fancy graphs with multiple colors and etc. I'd be interested in something "culturally" Haskellish in particular -- preferably command line interaction or config files, and interop with Darcs is the absolute must.

Do any such tools exist, or am I stuck with one of the big players or writing my own?

Speaking of which, I recall that there's a build farm set up for GHC. Looking at it, I notice that it used to use buildbot and now uses a custom builder. Although those are set up for a different workflow, would either of them be a simpler, more straightforward solution?

开发者_开发百科

Edit: I'm going with buildbot for now. Will update with how it works out.

Edit2: Ben Lippmeier has put buildbox on hackage, which also seems to be the foundation for a native Haskell CI solution. It is currently underdocumented, and probably not feature complete for my needs, but here it is: http://hackage.haskell.org/package/buildbox. He's used it to write a buildbot for repa: http://code.haskell.org/repa/repa-head/repa-bot/.


So here's what I did.

  1. install buildbot-server/buildslave as per instructions.
  2. install the darcs_buildbot script: https://github.com/buildbot/buildbot/blob/master/master/contrib/darcs_buildbot.py
  3. change the apply posthook in _darcs/defaults (this is for a shared repo) to the following:

apply posthook chmod a+w myrepo/_darcs/index myrepo/.darcs_buildbot-lastchange; /usr/local/bin/darcs_buildbot.py buildbotmachine:buildbotport;

apply run-posthook

As for the buildbot config file, something like the following is a simple setup:

darcsroot = "/myrepo/"

from buildbot.process import factory
from buildbot.steps.source import Darcs
from buildbot.steps.shell import Compile
from buildbot.steps.shell import Test
f1 = factory.BuildFactory()
f1.addStep(Darcs(repourl=darcsroot))
f1.addStep(Compile(command=["ghc","--make","Setup.hs"]))
f1.addStep(Compile(command=["./Setup","configure"],warningPattern="^\(Warning:"))
f1.addStep(Compile(command=["./Setup","build"],warningPattern="^\(Warning:"))    
b1 = {'name': "buildbot-full",
      'slavename': "bot1name",
      'builddir': "full",
      'factory': f1,
      }
c['builders'] = [b1]

Schedulers, etc. also need to be configured as per docs.

Now whenever anybody pushes to the shared repo, the build is triggered. Additional test commands can be added easily as well.

So far, this has been working out great!

I think I patched the buildslave to pull incrementally rather than the full repo, but I can't remember what I did, and don't know if its still necessary with newer versions.


The darcs team itself uses buildbot. I'm not certain off the top of my head where the scripts live, but I'm sure if you ask on the mailing list or IRC they should be easy to get hold of.

0

精彩评论

暂无评论...
验证码 换一张
取 消