iridium 0.1.5.4 → 0.1.5.5
raw patch · 7 files changed
+56/−35 lines, 7 filesdep ~CabalPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
Dependency ranges changed: Cabal
API changes (from Hackage documentation)
+ Development.Iridium.Utils: createDefaultCompilerFlag :: MonadMultiReader Config m => m [String]
Files
- ChangeLog.md +5/−0
- README.md +6/−4
- data/default-iridium.yaml +2/−0
- iridium.cabal +3/−3
- src/Development/Iridium.hs +2/−2
- src/Development/Iridium/Checks.hs +30/−26
- src/Development/Iridium/Utils.hs +8/−0
ChangeLog.md view
@@ -1,5 +1,10 @@ # Revision history for iridium +## 0.1.5.5 -- 2016-09-28++ * Slight improvements around the handling of testing against multiple+ compiler versions+ ## 0.1.5.4 -- 2016-05-21 * Fix git branch parsing issue
README.md view
@@ -8,6 +8,10 @@ iridium is a fancy wrapper around `cabal upload`. It aims to automate several typical steps when releasing a new package version to hackage. +Iridium does all testing locally, in contrast to e.g. github's travis.+This makes it easier to keep your published history free of commits that+fail any tests (without squashing or separate branches).+ Steps currently include: - Compilation and running tests using multiple compiler versions.@@ -20,11 +24,9 @@ - Uploading of both the package itself and the documentation. -iridium does all testing locally, in contrast to e.g. github's travis. - The output on errors is certainly not optimal; for example the stackage-upper bound checking will print a typical, hard-to-consume cabal hell error-message. iridium's aim is only to note _if_ something is wrong.+upper bound checking will print a typical, hard-to-consume cabal error+message. iridium's focus is on notifying _if_ something is wrong. # Usage
data/default-iridium.yaml view
@@ -8,6 +8,8 @@ # compiler-paths: # ghc-7.10.3: /opt/ghc-7.10.3/bin/ghc # ghc-7.8.4: /opt/ghc-7.8.4/bin/ghc+#+# default-compiler: ghc-7.10.3 # # hackage: # username: user
iridium.cabal view
@@ -1,6 +1,6 @@ name: iridium-version: 0.1.5.4-synopsis: Automated Testing and Package Uploading+version: 0.1.5.5+synopsis: Automated Local Testing and Package Uploading license: BSD3 license-file: LICENSE author: Lennart Spitzner@@ -79,7 +79,7 @@ , system-filepath >=0.4.13.4 && <0.5 , unordered-containers >=0.2.5.1 && <0.3 , multistate >=0.7.0.0 && <0.8- , Cabal >=1.22.5.0 && <1.23+ , Cabal >=1.22.5.0 && <1.25 , http-conduit >=2.1.8 && <2.2 , xmlhtml >=0.2.3.4 && <0.3 , foldl >=1.1.5 && <1.3
src/Development/Iridium.hs view
@@ -23,7 +23,7 @@ import Control.Monad.IO.Class import Control.Monad import Text.Read ( readMaybe )-import Control.Monad.Extra ( whenM )+import Control.Monad.Extra ( whenM, unlessM ) import Control.Monad.Trans.MultiRWS import Control.Monad.Trans.Control import Data.Proxy@@ -143,7 +143,7 @@ whenM (configIsEnabledM ["checks", "documentation"]) $ Checks.documentation -- we do this last so that we return in an "everything is compiled" state, -- if possible.- Checks.compile+ unlessM (configIsEnabledM ["checks", "compiler-versions"]) $ Checks.compile whenM (configIsEnabledM ["checks", "hlint"]) Checks.hlint whenM (configIsEnabledM ["checks", "lower-bounds-exist"]) $ Checks.lowerBounds whenM (configIsEnabledM ["checks", "upper-bounds-exist"]) $ Checks.upperBounds
src/Development/Iridium/Checks.hs view
@@ -123,7 +123,8 @@ else do changelogContentLines <- Turtle.fold (Turtle.input path) Foldl.list currentVersionStr <- liftM showVersion askPackageVersion- if any (Text.pack currentVersionStr `Text.isInfixOf`) changelogContentLines+ if any (Text.pack currentVersionStr `Text.isInfixOf`)+ changelogContentLines then return True else do pushLog LogLevelError $ "changelog does not contain " ++ currentVersionStr@@ -265,9 +266,10 @@ let testsArg = ["--enable-tests" | testsEnabled] let werrorArg = ["--ghc-options=\"-Werror\"" | werror] ++ ["--ghc-options=\"-w\"" | not werror]+ withDefaultCompiler <- createDefaultCompilerFlag runCommandSuccessCabal ["clean"]- runCommandSuccessCabal $ ["install", "--dep"] ++ testsArg- runCommandSuccessCabal $ ["configure"] ++ testsArg ++ werrorArg+ runCommandSuccessCabal $ ["install"] ++ withDefaultCompiler ++ ["--dep"] ++ testsArg+ runCommandSuccessCabal $ ["configure"] ++ withDefaultCompiler ++ testsArg ++ werrorArg runCommandSuccessCabal ["build"] when testsEnabled $ runCommandSuccessCabal ["test"]@@ -292,10 +294,11 @@ case buildtool of "cabal" -> mzeroToFalse $ do- runCommandSuccessCabal ["clean"]- runCommandSuccessCabal ["install", "--dep"]- runCommandSuccessCabal ["configure"]- runCommandSuccessCabal ["haddock"]+ withDefaultCompiler <- createDefaultCompilerFlag+ runCommandSuccessCabal $ ["clean"]+ runCommandSuccessCabal $ ["install", "--dep"] ++ withDefaultCompiler+ runCommandSuccessCabal $ ["configure"] ++ withDefaultCompiler+ runCommandSuccessCabal $ ["haddock"] "stack" -> do pushLog LogLevelError "TODO: stack build" return False@@ -328,23 +331,22 @@ ++ "-" ++ configReadString ["version"] val let checkBaseName = "Checking with compiler " ++ compilerStr- withStack compilerStr $- if warningsEnabled- then- fallbackCheck- (do- b <- runCheck checkBaseName $ checks compilerStr True- unless b $ do- incWarningCounter- addNotWallClean compilerStr- return b- )- (do- pushLog LogLevelPrint "Falling back on compilation without warnings."- runCheck (checkBaseName ++ " -w") $ checks compilerStr False- )- else- runCheck checkBaseName $ checks compilerStr False+ withStack compilerStr $ if warningsEnabled+ then+ fallbackCheck+ (do+ b <- runCheck checkBaseName $ checks compilerStr True+ unless b $ do+ incWarningCounter+ addNotWallClean compilerStr+ return b+ )+ (do+ pushLog LogLevelPrint "Falling back on compilation without warnings."+ runCheck (checkBaseName ++ " -w") $ checks compilerStr False+ )+ else+ runCheck checkBaseName $ checks compilerStr False where checks :: String -> Bool -> m Bool@@ -417,7 +419,8 @@ liftIO $ Text.IO.writeFile (encodeString cabalConfigPath) (Text.unlines filteredLines) let testsArg = ["--enable-tests" | testsEnabled] runCommandSuccessCabal ["clean"]- runCommandSuccessCabal $ ["--no-require-sandbox", "--ignore-sandbox", "install", "--dep", "--global", "--dry-run"] ++ testsArg+ withDefaultCompiler <- createDefaultCompilerFlag+ runCommandSuccessCabal $ ["--no-require-sandbox", "--ignore-sandbox", "install", "--dep", "--global", "--dry-run"] ++ withDefaultCompiler ++ testsArg pushLog LogLevelInfo $ "Cleanup (cabal.config)" unless alreadyExists $ Turtle.rm cabalConfigPath when alreadyExists $ Turtle.mv cabalConfigBackupPath cabalConfigPath@@ -503,7 +506,8 @@ "cabal" -> mzeroToFalse $ do runCommandSuccessCabal ["sdist"] let sdistName = pName ++ "-" ++ currentVersionStr ++ ".tar.gz"- runCommandSuccessCabal ["install", "dist/" ++ sdistName]+ withDefaultCompiler <- createDefaultCompilerFlag+ runCommandSuccessCabal $ ["install", "dist/" ++ sdistName] ++ withDefaultCompiler "stack" -> do pushLog LogLevelError "TODO: stack upper bound check" mzero
src/Development/Iridium/Utils.hs view
@@ -7,6 +7,7 @@ ( askAllBuildInfo , askPackageName , askPackageVersion+ , createDefaultCompilerFlag , mzeroToFalse , falseToMZero , runCheck@@ -113,6 +114,13 @@ askPackageVersion = do Infos _ pDesc _ _ <- mAsk return $ pkgVersion $ package $ packageDescription pDesc++createDefaultCompilerFlag :: MonadMultiReader Config m => m [String]+createDefaultCompilerFlag = liftM maybeToList $ runMaybeT $ do+ comp <- MaybeT $ configReadStringMaybeM ["setup", "default-compiler"]+ let confList = ["setup", "compiler-paths", comp]+ compilerPath <- MaybeT $ configReadStringMaybeM confList+ return $ "-w" ++ compilerPath mzeroToFalse :: Monad m => MaybeT m a -> m Bool mzeroToFalse m = do