bake-0.2: Continuous integration system

Safe HaskellNone

Development.Bake

Contents

Description

A continuous integration system. For an example of how to get started see https://github.com/ndmitchell/bake#readme.

Synopsis

Execute

bake :: Oven state patch test -> IO ()Source

The entry point to the system. Usually you will define:

 main = bake myOven

Where myOven defines details about the server. The program deals with command line arguments, run --help for details.

Central types

data Oven state patch test Source

The central type defining a continuous integration system. Usually constructed with defaultOven then filled out with other Oven modifiers such as ovenGit and ovenTest.

The types are: state is the base state of the system (think HEAD on the master branch); patch is a change that is proposed (think a diff); test is the type of tests that are run.

All IO operations will be called in a direct subdirectory of the directory you start bake from. In particular: ovenUpdateState will always be called single-threaded from bake-server; ovenPatchExtra will always be called from bake-patch-hash; ovenPrepare and run will always be called from bake-test-hash.

Constructors

Oven 

Fields

ovenUpdateState :: Maybe (state, [patch]) -> IO state

Given a state, and a set of candiates that have passed, merge to create a new state.

ovenPrepare :: state -> [patch] -> IO [test]

Prepare a candidate to be run, produces the tests that must pass

ovenTestInfo :: test -> TestInfo test

Produce information about a test

ovenNotify :: [Author] -> String -> IO ()

Tell an author some information contained in the string (usually an email)

ovenPatchExtra :: state -> Maybe patch -> IO (String, String)

Extra information about a patch, a single line (HTML span), and a longer chunk (HTML block)

ovenServer :: (Host, Port)

Default server to use

ovenStringyState :: Stringy state
 
ovenStringyPatch :: Stringy patch
 
ovenStringyTest :: Stringy test
 

defaultOven :: Oven () () ()Source

The default oven, which doesn't do anything interesting. Usually the starting point.

data Stringy s Source

A type representing a translation between a value and a string, which can be produced by readShowStringy if the type has both Read and Show instances. The functions stringyTo and stringyFrom should be inverses of each other. The function stringyPretty shows a value in a way suitable for humans, and can discard uninteresting information.

Constructors

Stringy 

Fields

stringyTo :: s -> String
 
stringyFrom :: String -> s
 
stringyPretty :: s -> String
 

readShowStringy :: (Show s, Read s) => Stringy sSource

Produce a Stringy for a type with Read and Show.

Oven modifiers

ovenTest :: Stringy test -> IO [test] -> (test -> TestInfo test) -> Oven state patch () -> Oven state patch testSource

Given a Stringy for test, and a function that when run on a code base returns the list of tests that need running, and a function to populate a TestInfo, modify the Oven with a test type.

ovenGit :: String -> String -> Maybe FilePath -> Oven () () test -> Oven SHA1 SHA1 testSource

Modify an Oven to work with the Git version control system. Requires the name of the repo (e.g. https://github.com/ndmitchell/bake.git) and the name of a branch (e.g. master). You can optionally give a path fragment which is used to clone into.

ovenNotifyStdout :: Oven state patch test -> Oven state patch testSource

Produce notifications on stdout when users should be notified about success/failure.

ovenNotifyEmail :: (Host, Port) -> Oven state patch test -> Oven state patch testSource

Email notifications when users should be notified about success/failure. Requires the host/port of an SMTP server. Not yet implemented, will always crash.

ovenPretty :: Show patch => String -> Oven state patch test -> Oven state (Pretty patch) testSource

ovenIncremental :: Oven state patch test -> Oven state patch testSource

This requires a version of cp. On Windows, you can get that here: http://gnuwin32.sourceforge.net/packages/coreutils.htm

TestInfo members

data TestInfo test Source

Information about a test.

Instances

run :: IO () -> TestInfo testSource

The action associated with a test.

threads :: Int -> TestInfo test -> TestInfo testSource

Change the number of threads a test requires, defaults to 1.

threadsAll :: TestInfo test -> TestInfo testSource

Record that a test requires all available threads on a machine, typically used for the build step. Use getNumCapabilities to find out how many threads you were allocated.

require :: [test] -> TestInfo test -> TestInfo testSource

Require the following tests have been evaluated on this machine before this test is run. Typically used to require compilation before running most tests.

suitable :: IO Bool -> TestInfo test -> TestInfo testSource

Is a particular client capable of running a test. Usually an OS check.

Operations

startServer :: Port -> FilePath -> Author -> String -> Double -> Oven state patch test -> IO ()Source

startClient :: (Host, Port) -> Author -> String -> Int -> Double -> Oven state patch test -> IO ()Source

Utility types