actions / setup-haskell

Set up your GitHub Actions workflow with a specific version of Haskell (GHC and Cabal)
MIT License
71 stars 30 forks source link

Option to disable cabal update #18

Closed mbj closed 4 years ago

mbj commented 4 years ago

For projects that use stack this part of the haskell setup action job can likely be skipped:

Setting up cabal
  /opt/cabal/3.2/bin/cabal user-config update -a http-transport: plain-http -v3
  Config file path source is default config file.
  Config file /home/runner/.cabal/config not found.
  Writing default configuration to /home/runner/.cabal/config
  Renaming /home/runner/.cabal/config to /home/runner/.cabal/config.backup.
  Writing merged config to /home/runner/.cabal/config.
  /opt/cabal/3.2/bin/cabal update
  Downloading the latest package list from hackage.haskell.org

Especially the download after cabal update takes multiple seconds that are AFAIK just redundant on a stack build.

I suspect that it may be best to have a build-tool: stack|cabal option (defaulting to cabal). And if stack is selected it removes the cabal specific actions, and also sets enable-stack: true.

jkachmar commented 4 years ago

I think the issue you're running into might be resolved by toggling the stack-no-global option to true (cf. the Inputs section).


That being said, I think an option to disable installing cabal-install and running cabal update would be really nice in certain use cases.

For example, I've currently got a workflow that uses stack with the version that this action provides. I'm not using cabal so I'd prefer that cabal update not run, but there's no way to disable this without disabling the global GHC install.

mbj commented 4 years ago

@jkachmar Not entirely fixes my problem. This option indeed skips the Setting up cabal step but also skips the GHC setup. While stack can setup its own GHC, the ideal build latency is reached when using the already cached system GHC that is distributed with the GH action base images.

hazelweakly commented 4 years ago

I thought about creating a build-tool option, but given that it would introduce complexity, I opted to just not run cabal setup if stack is enabled for now. Many people run cabal update in their workflows anyway as the original action didn't run it for you. Doing it twice is pretty much instant, but doing it once when you don't need to takes up time. Will that work for you?

mbj commented 4 years ago

I opted to just not run cabal setup if stack is enabled for now.

That works for me.

Interestingly I had to update to actions/setup-haslell@v1.1.1 to get the new behavior. @v1.1 did not pick it up. I suspect this is a problem outside the scope of this project and has to do with the github actions inference, so not a blocker.

Your change removed ~30s from most of my haskell builds. Thanks. Closing this.

hazelweakly commented 4 years ago

It's because the 1.1 tag didn't get updated to point to 1.1.1 as well; only the v1 tag got updated. Not sure if that's a github practice or not.