From fed93f08e0b3cdae570cd82216cea0e94c3a53d5 Mon Sep 17 00:00:00 2001 From: Simon Hengel Date: Wed, 16 Oct 2024 19:45:57 +0700 Subject: [PATCH] Require GHC 9.10.1 --- .github/workflows/build.yml | 21 +++++++++------------ cabal.project | 4 +++- src/Language/Haskell/GhciWrapper.hs | 7 +++++-- test/ClientSpec.hs | 2 +- test/TriggerSpec.hs | 22 ++++++++++------------ 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5c150db..2340669 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=. --lib hspec hspec-meta + SENSEI_GHC=ghc-$GHC GHC_ENVIRONMENT=$(pwd)/.ghc.environment.x86_64-linux-9.8.2 $(cabal list-bin spec) + done success: needs: build diff --git a/cabal.project b/cabal.project index 282723f..63f8c7f 100644 --- a/cabal.project +++ b/cabal.project @@ -1,7 +1,9 @@ +with-compiler: ghc-9.10.1 + packages: sensei.cabal -package sensei +program-options ghc-options: -Werror tests: True diff --git a/src/Language/Haskell/GhciWrapper.hs b/src/Language/Haskell/GhciWrapper.hs index 43126d3..26769f1 100644 --- a/src/Language/Haskell/GhciWrapper.hs +++ b/src/Language/Haskell/GhciWrapper.hs @@ -64,16 +64,19 @@ new startupFile Config{..} args_ = do let mandatoryArgs :: [String] - mandatoryArgs = ["-fshow-loaded-modules"] + mandatoryArgs = ["-fshow-loaded-modules", "--interactive"] args :: [String] args = "-ghci-script" : startupFile : args_ ++ catMaybes [ if configIgnoreDotGhci then Just "-ignore-dot-ghci" else Nothing ] ++ mandatoryArgs + ghc :: String + ghc = fromMaybe "ghc" $ lookup "SENSEI_GHC" env + (stdoutReadEnd, stdoutWriteEnd) <- createPipe - (Just stdin_, Nothing, Nothing, processHandle ) <- createProcess (proc "ghci" args) { + (Just stdin_, Nothing, Nothing, processHandle ) <- createProcess (proc ghc args) { cwd = configWorkingDirectory , env = Just env , std_in = CreatePipe diff --git a/test/ClientSpec.hs b/test/ClientSpec.hs index 38dcfcd..b413fce 100644 --- a/test/ClientSpec.hs +++ b/test/ClientSpec.hs @@ -32,7 +32,7 @@ spec = do it "indicates failure" $ do withFailure $ \ dir -> do - client dir [] `shouldReturn` (False, "failure") + client dir ["--color"] `shouldReturn` (False, fromString $ withColor Red "failure") context "when server socket is missing" $ do it "reports error" $ do diff --git a/test/TriggerSpec.hs b/test/TriggerSpec.hs index 07d0477..4bc9b1e 100644 --- a/test/TriggerSpec.hs +++ b/test/TriggerSpec.hs @@ -26,7 +26,10 @@ normalize = normalizeTiming . lines . forGhc9dot4 | otherwise = line forGhc9dot4 :: String -> String - forGhc9dot4 = Text.unpack . Text.replace "Ok, modules loaded: Spec." "Ok, modules loaded: Spec (Spec.o)." . Text.pack + forGhc9dot4 = Text.unpack + . Text.replace "Ok, modules loaded: Spec." "Ok, modules loaded: Spec (Spec.o)." + . 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 @@ -173,19 +176,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 , modulesLoaded Failed [] , withColor Red "RELOADING FAILED" ])