Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of source-repository-packages/cabal.project in CI #91

Open
RyanGlScott opened this issue Apr 7, 2021 · 7 comments
Open

Use of source-repository-packages/cabal.project in CI #91

RyanGlScott opened this issue Apr 7, 2021 · 7 comments

Comments

@RyanGlScott
Copy link
Collaborator

I recently committed some fixes to another branch in an attempt to fix the CI for bifunctors. I haven't pushed to master yet, however, because it does a couple of opinionated things:

  1. Instead of using submodules, like in the master branch of distributive, it vendors in the comonad library using a source-repository-package in the cabal.project file. See here.
  2. Speaking of which, I'm using a cabal.project file. bifunctors used to have one, but @ekmett appears to have removed it in bc5d8e8 for reasons that aren't clear to me.

In any case, let me briefly explain why I favor (1) and (2) above:

  1. Using source-repository-package allows vendored libraries to be saved in cabal's store (using cabal-instal-3.4 or later), which means that you don't have to constantly rebuild them. More critically, it also means that vendored libraries can be cached in CI, so it will save quite a bit of CI time in the long run.
  2. Having a cabal.project file makes it so that I can check out the bifunctors repo within the context of another project with a cabal.project file and not have the latter cabal.project file clobber it. This is important for my workflows, as I manage bifunctors within another repo.

@ekmett: I'm raising this issue because I don't want to step on your toes when you're developing your libraries. Let me know your preferences and I can find a way to make both of us happy.

@ekmett
Copy link
Owner

ekmett commented Apr 7, 2021 via email

@ekmett
Copy link
Owner

ekmett commented Apr 7, 2021 via email

@ekmett
Copy link
Owner

ekmett commented Apr 7, 2021

Trying it with cabal.project using branch based source links seems to work and should potentially fix ci without undue tag # maintenance.

@RyanGlScott
Copy link
Collaborator Author

Thanks for the very thorough response, @ekmett! I also wish that the ergonomics of cabal.project allowed switching between source-repository-packages and submodules more easily. That being said, if using tag: <branch-name> works for you, then perhaps that's the best approach for now.

Using the bifunctors repo as a particular example, should I vendor in comonad's master branch as its tag?

@ekmett
Copy link
Owner

ekmett commented Apr 7, 2021 via email

@RyanGlScott
Copy link
Collaborator Author

RyanGlScott commented Apr 7, 2021

One concern I'm noting is that this workflow seems pretty brittle. When I go to do rebuilds after changes to the upstream branch, cabal gets confused, and fails to pull the updated branch correctly, and because each of these is getting a mini cabal.project file, i'm getting lots of dist-newstyle folders, meaning lots of redundant build work in my dev cycle. Neither of these is great for me, so I may recant using this style, but I'll at least try it for a few days first.

Good to know. If it is untenable, I'm not opposed to using submodules. The only catch is that I don't think haskell-ci's GitHub Actions supports automatically cloning submodules upon checkout at the moment, so I'd need to implement that before going further.

If it is untenable in practice, I could maybe see about using some tooling to handle the source-repository link management, by doing something like generating cabal.project.locals via tooling or something. There should be something in this corner of the design space that works without breaking CI at any rate.

That is an interesting idea. We could certainly check in two cabal.project files, one of which using submodules and the other using source-repository-packages, and we could use them as is appropriate for the task at hand.

@RyanGlScott
Copy link
Collaborator Author

Ah, I didn't notice that you already switched to using a source-repository-package in main. In that case, I went ahead and pushed a commit leveraging that to fix CI in 269d156. Do note that if you want to switch to submodules, I have just landed a patch in haskell-ci which permits this, so it would be straightforward to change how we vendor in other libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants