diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5c150db..e9fc125 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,14 +20,10 @@ jobs: matrix: os: - ubuntu-latest + - macos-12 ghc: - - '9.4' - - '9.6' - - '9.8' - '9.10' - include: - - os: macos-12 - ghc: system + steps: - uses: actions/checkout@v3 - uses: hspec/setup-haskell@v1 @@ -54,12 +50,13 @@ jobs: run: cabal build all - shell: bash - run: echo | cabal repl sensei --build-depends hspec-meta - - - shell: bash - run: cabal exec -- $(cabal list-bin spec) --times --print-slow - env: - HSPEC_OPTIONS: --color + run: | + for GHC in 9.4 9.6 9.8 9.10 + do + ghcup install ghc $GHC --no-set + cabal install -z -w ghc-$GHC --package-env=./$GHC.env --lib hspec hspec-meta + SENSEI_GHC=ghc-$GHC GHC_ENVIRONMENT=$(pwd)/$GHC.env $(cabal list-bin spec) + done success: needs: build diff --git a/cabal.project b/cabal.project index a4eadbd..63f8c7f 100644 --- a/cabal.project +++ b/cabal.project @@ -1,3 +1,5 @@ +with-compiler: ghc-9.10.1 + packages: sensei.cabal diff --git a/package.yaml b/package.yaml index 5f4548d..9482e98 100644 --- a/package.yaml +++ b/package.yaml @@ -40,7 +40,7 @@ dependencies: - async - containers - transformers - - mtl + - mtl >= 2.3.1 - aeson - yaml - casing diff --git a/sensei.cabal b/sensei.cabal index 061e932..f9599d4 100644 --- a/sensei.cabal +++ b/sensei.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.36.0. +-- This file has been generated from package.yaml by hpack version 0.37.0. -- -- see: https://github.com/sol/hpack @@ -63,7 +63,7 @@ executable seito , fsnotify ==0.4.* , http-client >=0.5.0 , http-types - , mtl + , mtl >=2.3.1 , network , process , stm @@ -121,7 +121,7 @@ executable sensei , fsnotify ==0.4.* , http-client >=0.5.0 , http-types - , mtl + , mtl >=2.3.1 , network , process , stm @@ -179,7 +179,7 @@ executable sensei-web , fsnotify ==0.4.* , http-client >=0.5.0 , http-types - , mtl + , mtl >=2.3.1 , network , process , stm @@ -260,7 +260,7 @@ test-suite spec , http-client >=0.5.0 , http-types , mockery - , mtl + , mtl >=2.3.1 , network , process , stm diff --git a/src/Trigger.hs b/src/Trigger.hs index 132d602..77b8232 100644 --- a/src/Trigger.hs +++ b/src/Trigger.hs @@ -14,12 +14,8 @@ module Trigger ( import Imports -#if MIN_VERSION_mtl(2,3,1) import Control.Monad.Trans.Writer.CPS (runWriterT) import Control.Monad.Writer.CPS hiding (pass) -#else -import Control.Monad.Writer.Strict hiding (pass) -#endif import Control.Monad.Except diff --git a/test/Language/Haskell/GhciWrapperSpec.hs b/test/Language/Haskell/GhciWrapperSpec.hs index 54bad2d..d7f9bad 100644 --- a/test/Language/Haskell/GhciWrapperSpec.hs +++ b/test/Language/Haskell/GhciWrapperSpec.hs @@ -121,7 +121,7 @@ spec = do context "with -XNoImplicitPrelude" $ do it "works" $ withInterpreter ["-XNoImplicitPrelude"] $ \ ghci -> do - Interpreter.eval ghci "putStrLn \"foo\"" >>= (`shouldContain` "Variable not in scope: putStrLn") + (unwords . map (dropWhile isSpace) . lines <$> Interpreter.eval ghci "putStrLn \"foo\"") >>= (`shouldContain` "Variable not in scope: putStrLn") Interpreter.eval ghci "23" `shouldReturn` "23\n" describe "reload" do diff --git a/test/TriggerSpec.hs b/test/TriggerSpec.hs index 9be4a19..26c3ce7 100644 --- a/test/TriggerSpec.hs +++ b/test/TriggerSpec.hs @@ -3,6 +3,8 @@ module TriggerSpec (spec) where import Helper +import qualified Data.Text as Text + import qualified Session import Session (Session) import Language.Haskell.GhciWrapper (Config(..)) @@ -11,7 +13,7 @@ import Trigger hiding (trigger, triggerAll) import qualified Trigger normalize :: String -> [String] -normalize = normalizeTiming . lines +normalize = normalizeTiming . lines . forGhc9dot4 where normalizeTiming :: [String] -> [String] normalizeTiming = normalizeLine "Finished in " @@ -23,6 +25,11 @@ normalize = normalizeTiming . lines | message `isPrefixOf` line = message ++ "..." | otherwise = line + forGhc9dot4 :: String -> String + forGhc9dot4 = Text.unpack + . Text.replace " error: Variable not in scope: " " error: [GHC-88464] Variable not in scope: " + . Text.pack + withSession :: FilePath -> [String] -> (Session -> IO a) -> IO a withSession specPath args = do Session.withSession ghciConfig {configWorkingDirectory = Just dir} $ @@ -155,19 +162,14 @@ spec = do it "stops after reloading" $ \ name -> do withSession name [] $ \ session -> do writeFile name (passingSpec ++ "foo = bar") - (trigger session >> trigger session) `shouldReturn` (Failure, [ + + let + fitterNotNull :: [String] -> [String] + fitterNotNull = filter (not . null) + + (fmap fitterNotNull <$> (trigger session >> trigger session)) `shouldReturn` (Failure, [ "[1 of 1] Compiling Spec" -#if __GLASGOW_HASKELL__ < 910 - , "" -#endif -#if __GLASGOW_HASKELL__ >= 906 , "Spec.hs:9:7: error: [GHC-88464] Variable not in scope: bar" -#else - , "Spec.hs:9:7: error: Variable not in scope: bar" -#endif -#if __GLASGOW_HASKELL__ >= 910 - , "" -#endif , withColor Red "RELOADING FAILED" ])