actions
actions copied to clipboard
`ghc: could not execute: hspec-discover` when running haskell workflow
Hitting build failures with ghc: could not execute: hspec-discover which is the hspec preprocessor that discovers all the test files in the project.
See https://github.com/pdlla/tinytools/actions/runs/5051277877/jobs/9062940842
Unclear to me if this is in the domain of haskell/actions but hspec seems common enough that I thought it would be worth reporting here.
Make sure to add
tests:
tinytools-test:
build-tools: hspec-discover
to your package.yaml.
(or build-tool-depends: hspec-discover:hspec-discover if you are using plain .cabal)
This is needed if you want to build your project with cabal. For stack it's not required.
Also note that cabal test all may skip tests. You have to use cabal test all --enable-tests (sounds comical, but sadly it's true https://github.com/haskell/cabal/issues/5079).
Alternatively, run cabal configure --enable-tests --enable-benchmarks first.
This is what you probably want to use: https://github.com/sol/run-haskell-tests/blob/main/action.yml#L15-L24