haskell / actions

Github actions for Haskell CI
147 stars 54 forks source link

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

Open minimapletinytools opened 1 year ago

minimapletinytools commented 1 year ago

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.

sol commented 1 year ago

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 commented 1 year ago

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