Safe Haskell | None |
---|---|
Language | Haskell2010 |
A continuous integration system. For an example of how to get started see https://github.com/ndmitchell/bake#readme.
- bake :: (Stringy state, Stringy patch, Stringy test) => Oven state patch test -> IO ()
- data Oven state patch test = Oven {
- ovenInit :: IO state
- ovenUpdate :: state -> [patch] -> IO state
- ovenPrepare :: state -> [patch] -> IO [test]
- ovenTestInfo :: test -> TestInfo test
- ovenNotify :: [Author] -> String -> IO ()
- ovenPatchExtra :: state -> Maybe patch -> IO (String, String)
- ovenServer :: (Host, Port)
- ovenSupersede :: patch -> patch -> Bool
- defaultOven :: Oven () () ()
- class Stringy s where
- stringyTo :: s -> String
- stringyFrom :: String -> s
- stringyPretty :: s -> String
- ovenTest :: IO [test] -> (test -> TestInfo test) -> Oven state patch () -> Oven state patch test
- data SHA1
- ovenGit :: String -> String -> Maybe FilePath -> Oven () () test -> Oven SHA1 SHA1 test
- ovenStepGit :: IO [FilePath] -> String -> String -> Maybe FilePath -> Oven () () test -> Oven SHA1 SHA1 test
- ovenNotifyAdd :: ([Author] -> String -> IO ()) -> Oven state patch test -> Oven state patch test
- ovenNotifyStdout :: Oven state patch test -> Oven state patch test
- ovenNotifyEmail :: (Host, Port) -> (Author -> [String]) -> Oven state patch test -> Oven state patch test
- ovenPretty :: Oven state patch test -> Oven state (Pretty patch) test
- ovenPrettyMerge :: Oven state (Pretty patch) test -> Oven state (Pretty patch) test
- data TestInfo test
- run :: IO () -> TestInfo test
- threads :: Int -> TestInfo test -> TestInfo test
- threadsAll :: TestInfo test -> TestInfo test
- depend :: [test] -> TestInfo test -> TestInfo test
- require :: [String] -> TestInfo test -> TestInfo test
- priority :: Int -> TestInfo test -> TestInfo test
- startServer :: (Stringy state, Stringy patch, Stringy test) => Port -> [Author] -> Seconds -> String -> Bool -> Oven state patch test -> IO ()
- startClient :: (Stringy state, Stringy patch, Stringy test) => (Host, Port) -> Author -> String -> Int -> [String] -> Double -> Oven state patch test -> IO ()
- garbageCollect :: Integer -> Double -> Seconds -> [FilePath] -> IO ()
- sendPause :: (Host, Port) -> Author -> IO ()
- sendUnpause :: (Host, Port) -> Author -> IO ()
- sendAddPatch :: (Host, Port) -> Author -> String -> IO ()
- sendDelPatch :: (Host, Port) -> Author -> String -> IO ()
- sendDelAllPatches :: (Host, Port) -> Author -> IO ()
- sendRequeue :: (Host, Port) -> Author -> IO ()
- sendAddSkip :: (Host, Port) -> Author -> String -> IO ()
- sendDelSkip :: (Host, Port) -> Author -> String -> IO ()
- sendSetState :: (Host, Port) -> Author -> String -> IO ()
- type Host = String
- type Port = Int
- type Author = String
Execute
bake :: (Stringy state, Stringy patch, Stringy test) => 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:
ovenInit
will always be called single-threaded from bake-init
;
ovenUpdate
will always be called single-threaded from bake-update-hash
;
ovenPatchExtra
will always be called from bake-extra-hash
;
ovenPrepare
and run
will always be called from bake-test-hash
.
Oven | |
|
defaultOven :: Oven () () () Source
The default oven, which doesn't do anything interesting. Usually the starting point.
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.
Oven modifiers
ovenTest :: IO [test] -> (test -> TestInfo test) -> Oven state patch () -> Oven state patch test Source
ovenGit :: String -> String -> Maybe FilePath -> Oven () () test -> Oven SHA1 SHA1 test Source
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.
:: IO [FilePath] | Function that does a compile and returns the pieces that should be available at test time |
-> String | Git repo you are using |
-> String | Branch used as the initial starting point |
-> Maybe FilePath | Path under which the git will be checked out |
-> Oven () () test | Normal oven |
-> Oven SHA1 SHA1 test |
Oven creation for modules using git with the step strategy.
ovenNotifyAdd :: ([Author] -> String -> IO ()) -> Oven state patch test -> Oven state patch test Source
Add an additional notification to the list.
ovenNotifyStdout :: Oven state patch test -> Oven state patch test Source
Produce notifications on stdout
when users should be notified about success/failure.
ovenNotifyEmail :: (Host, Port) -> (Author -> [String]) -> Oven state patch test -> Oven state patch test Source
Email notifications when users should be notified about success/failure.
ovenPretty :: Oven state patch test -> Oven state (Pretty patch) test Source
ovenPrettyMerge :: Oven state (Pretty patch) test -> Oven state (Pretty patch) test Source
TestInfo members
threads :: Int -> TestInfo test -> TestInfo test Source
Change the number of threads a test requires, defaults to 1.
threadsAll :: TestInfo test -> TestInfo test Source
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.
depend :: [test] -> TestInfo test -> TestInfo test Source
Require the following tests have been evaluated on this machine before this test is run. Typically used to require compilation before running most tests.
require :: [String] -> TestInfo test -> TestInfo test Source
Is a particular client capable of running a test.
Usually an OS check. To run a test must have all its requirements met.
Clients can satisfy a requirement by passing --provide=...
on the command line.
priority :: Int -> TestInfo test -> TestInfo test Source
Set the priority of a test, those with higher priority are run first. Tests have a default priority of 0.
Operations
startServer :: (Stringy state, Stringy patch, Stringy test) => Port -> [Author] -> Seconds -> String -> Bool -> Oven state patch test -> IO () Source
startClient :: (Stringy state, Stringy patch, Stringy test) => (Host, Port) -> Author -> String -> Int -> [String] -> Double -> Oven state patch test -> IO () Source
:: Integer | Minimum number of bytes you want free on the drive (use 0 if you don't want any) |
-> Double | Ratio of the drive you want free, e.g. 0.25 to demand a quarter of the drive free (1 to delete everything you can) |
-> Seconds | Minimum age to delete in seconds |
-> [FilePath] | Directories containing Bake stuff |
-> IO () |
Garbage collect enough files to satisfy the requirements.