diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index 42c23e1a..1c0cf2ba 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -55,11 +55,11 @@ jobs: - name: Configure run: | cabal update - cabal configure --enable-tests --enable-benchmarks --flag=pedantic + cabal configure --enable-tests --enable-benchmarks --flag=pedantic --flag=ci-depends - name: Install dependencies run: | cabal build --only-dependencies - name: Build run: cabal build - - name: Run spec test - run: cabal test --test-option=--color --test-show-details=streaming spec + - name: Run all enabled tests + run: cabal test --test-option=--color --test-show-details=streaming diff --git a/hackport.cabal b/hackport.cabal index b2b9ba7e..e73b0cc7 100644 --- a/hackport.cabal +++ b/hackport.cabal @@ -44,6 +44,11 @@ flag profile default: False manual: True +flag ci-depends + description: Enable build-tool-depends for use with CI systems + default: False + manual: True + -- Turn off all warnings (for external libs and doctests-v2) common no-warnings ghc-options: -Wno-default -Wno-incomplete-uni-patterns @@ -1026,9 +1031,6 @@ test-suite doctests test-suite doctests-v2 import: warnings - -- doctests-v2 is causing problems, looking for ghc lib and alex on - -- github CI. This may be fixable. - buildable: False type: exitcode-stdio-1.0 default-language: Haskell98 hs-source-dirs: tests/doctests-v2 @@ -1037,9 +1039,15 @@ test-suite doctests-v2 , base , process - build-tool-depends: - , cabal-install:cabal >=3.4 - , doctest:doctest >=0.8 + if flag(ci-depends) + cpp-options: -DCI_DEPENDS + build-tool-depends: + , cabal-install:cabal >=3.4 + , doctest:doctest >=0.8 + else + build-depends: + -- cabal-install should already be installed if this is being built... + , doctest >=0.8 if flag(cabal-v1) buildable: False @@ -1087,5 +1095,10 @@ test-suite spec , time , xml - build-tool-depends: hspec-discover:hspec-discover >=2.0 + if flag(ci-depends) + cpp-options: -DCI_DEPENDS + build-tool-depends: hspec-discover:hspec-discover >=2.0 + else + build-depends: + , hspec-discover other-extensions: DeriveDataTypeable diff --git a/tests/doctests-v2/Main.hs b/tests/doctests-v2/Main.hs index cc671d62..9e7efea8 100644 --- a/tests/doctests-v2/Main.hs +++ b/tests/doctests-v2/Main.hs @@ -1,14 +1,19 @@ +{-# LANGUAGE CPP #-} + module Main (main) where import Data.Foldable (for_) import System.Exit (ExitCode (..), exitWith) -import System.Process (readProcess, createProcess, proc, waitForProcess, getProcessExitCode) +import System.Process main :: IO () main = do - +#if defined(CI_DEPENDS) doctestPath:_ <- lines <$> readProcess "cabal" ["list-bin", "doctest"] [] +#else + let doctestPath = "/usr/bin/doctest" +#endif let components = [ "hackport:lib:hackport-internal"