Skip to content

Not merging patches, delayed/queued builds #15

Description

@nkaretnikov

I'm on Bake 0.3 because I use stack and the said version is on
Hackage. I've modified the provided Example.hs slightly (an aside:
I've read in some issue here that you recommend to run Bake outside
the project directory, but my version doesn't support that for now due
to a call to stack build despite the fact that functions take a repo
argument, ignore this sloppiness).

For now, I just want to build the project with stack build on
Compile and call the test executable on Run. The code seems to
work, but some things I don't understand yet.

I ran bake server and bake client from the project root, made a
new branch, committed a patch, and ran bake addpatch on that hash.
Then I looked at the server UI and there were no signs of activity, so
I committed another patch and added it to Bake (I gathered it might
trigger it or something). After a while, Bake started building and
testing the first patch. Why was there a delay? The build succeeded
according to the status message, so I expected it to be merged into
master, which didn't happen. Here's the tail of the build log:

Registering Snowdrift-0.1.4...
Waited 0.00s to acquire the file lock /home/nikita/haskell/snowdrift/bake-step-git-4762652644488644249/.bake-lock
[BAKE-TIME] 13.47s (total of 13.53s): git fetch
Waited 0.00s to acquire the file lock /home/nikita/haskell/snowdrift/bake-step-git-4762652644488644249/.bake-lock
[BAKE-TIME] 0.19s (total of 13.71s): git checkout --force -B master e08749f1a95646702edc84c535ff87ce3e10e1bc
[BAKE-TIME] 0.62s (total of 14.33s): git merge a6fb84fcc4798fdcb1f46c60ff1aa5037c75fe3a
[BAKE-TIME] 5m35s (total of 5m49s): stepPrepare user action
[BAKE-TIME] 1.39s (total of 5m51s): tar -cf ../bake-step-git-4762652644488644249/../bake-step-point-3521543077975254953/result.tar -C ../bake-step-git-4762652644488644249/repo /home/nikita/haskell/snowdrift/dist/build/test/test
[BAKE-TIME] 0.15s (total of 5m51s): tar -xf ../bake-step-git-4762652644488644249/../bake-step-point-3521543077975254953/result.tar -C .
From /home/nikita/haskell/snowdrift
 * [new branch]      bake       -> origin/bake
Reset branch 'master'
tar: Removing leading `/' from member names

Is my assumption incorrect, or did something go wrong?

The other two patches have been in the "Queued" status for 40 minutes
or so, nothing shows up on the server UI or at the logs. The client
(Thomas) has "None" at the "Running" field. What's the problem?

{-# LANGUAGE FlexibleInstances #-}

module Main where

import Prelude

import Control.Monad
import Data.List.Extra
import Data.Maybe
import Data.Tuple.Extra
import Development.Bake
import Development.Shake.Command
import System.Environment.Extra
import System.FilePath

data Platform = Linux {-| Windows-} deriving (Show,Read)
data Action = Compile | Run deriving (Show,Read)

instance Stringy (Platform, Action) where
    stringyTo (a,b) = show a ++ " " ++ show b
    stringyFrom = (read *** read) . word1

platforms :: [Platform]
platforms = [Linux{-,Windows-}]

main :: IO ()
main = do
    let env      = "REPO"
        envError = "You need to set an environment variable named $"
                ++ env ++ " for the Git repo"
    repo <- fromMaybe (error envError) `fmap` lookupEnv env
    bake $
        ovenPretty $
        ovenStepGit (compile repo) repo "master" Nothing $
        ovenNotifyStdout $
        ovenTest (return allTests) (execute repo)
        defaultOven{ovenServer=("127.0.0.1",5000)}

allTests :: [(Platform, Action)]
allTests = [(p,t) | p <- platforms, t <- [Compile,Run]]

exe :: FilePath -> FilePath
exe repo = repo </> "dist/build/test/test"

compile :: FilePath -> IO [FilePath]
compile repo = do unit $ cmd "stack build"; return [exe repo]

execute :: FilePath -> (Platform,Action) -> TestInfo (Platform,Action)
execute repo (p, Compile) =
    require [show p] $ run $ void $ compile repo
execute repo (p, Run) =
    depend [(p,Compile)] $ require [show p] $ run $ cmd $ exe repo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions