actions icon indicating copy to clipboard operation
actions copied to clipboard

`ghc: could not execute: hspec-discover` when running haskell workflow

Open minimapletinytools opened this issue 2 years ago • 2 comments

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.

minimapletinytools avatar May 22 '23 23:05 minimapletinytools

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.

sol avatar May 23 '23 04:05 sol

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

sol avatar May 23 '23 04:05 sol