haskell-CI / haskell-ci

Scripts and instructions for using CI services (e.g. Travis CI or Appveyor) with multiple GHC configurations
GNU General Public License v3.0
438 stars 71 forks source link

GHA: generated script fails if .cabal file is in a subdirectory #442

Open andreasabel opened 3 years ago

andreasabel commented 3 years ago

I suppose I should invoke haskell-ci in the project root folder. If the .cabal file is a subdirectory, the GHA generation succeeds, but the generated actions fail.

I tried this for my project https://github.com/BNFC/bnfc :

~/bnfc$ haskell-ci github source/BNFC.cabal 
*INFO* Generating GitHub config for testing for GHC versions: 7.10.3 8.0.2 8.2.2 8.4.4 8.6.5 8.8.4 8.10.2

Here is part of the generated action script: https://github.com/BNFC/bnfc/blob/f6cb500ec755ae144d6661061ac1936acf8c5d29/.github/workflows/haskell-ci.yml#L112-L120

The action fails at sdist https://github.com/BNFC/bnfc/runs/1589741681?check_suite_focus=true :

Run mkdir -p sdist
  mkdir -p sdist
  cd source || false
  $CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist
  shell: sh -e {0}
  env: 
     ...
No cabal.project file or cabal file matching the default glob './*.cabal' was found.
Please create a package description file <pkgname>.cabal or a cabal.project file referencing the packages you want to build.
phadej commented 3 years ago

Add a top level cabal.project with packages: source/. That is something you would do if you used cabal for development.

Then you could use haskell-ci ... cabal.project.

i'm not sure we want to complicated things with supporting definitions in a non-root of the repository.

andreasabel commented 3 years ago

Thanks! That worked.

For discoverability of the solution, could the following change to haskell-ci make sense?