Skip to content

CI: remove dependency on cabal-plan (#8891) #8893

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

Merged
merged 1 commit into from
Apr 17, 2023
Merged

Conversation

ulysses4ever
Copy link
Collaborator

Let's see what CI thinks...

@@ -369,7 +368,6 @@ step_time_summary() {
step_build() {
print_header "build"
timed $CABALNEWBUILD $TARGETS --dry-run || exit 1
$CABALPLAN topo --builddir=$BUILDDIR || exit 1
Copy link
Member

@fgaz fgaz Apr 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we still want a list of packages in the plan (though not topologically sorted) we can do it with a jq command:

jq -r '."install-plan" | map(."pkg-name" + "-" + ."pkg-version" + " " + ."component-name") | join("\n")' "$BUILDDIR/cache/plan.json"

iirc it's installed by default on github runners

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I don't see a big value in this list. If someone feels strongly about it, I could add this oneliner, perhaps. But I'm not a fan of this solution either: it looks rather fragile to my uniformed taste.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I guess, it was requested here: #8440 so there are users for it...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since #8440 was opened by @andreasabel, paging him in... Andreas, maybe you have a preference between:

  1. keeping cabal-plan; possibly, switching to binary distribution to save time and dependency management;
  2. removing cabal-plan and print the list of dependencies to be built using the on-liner provided above by fgaz;
  3. removing cabal-plan and keeping the list of dependencies to be built that is already produced by cabal build [--dry-run] actually; (see e.g. here)

I personally lean towards (3) as I fail to see much advantage of anything else. One difference between cabal build --dry-run and cabal-plan topo that I noticed today (and you can check it using the CI link above) is that the latter seems to print nearly twice as much as the former. I'm not sure why that is...

Copy link
Member

@fgaz fgaz Apr 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One difference between cabal build --dry-run and cabal-plan topo that I noticed today (and you can check it using the CI link above) is that the latter seems to print nearly twice as much as the former. I'm not sure why that is...

cabal build does not print cached stuff, it only prints what it's going to download/build

If we want the whole build plan we need 1. or 2. (or cabal freeze I guess)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know, thank you!

I don't see much emotion one way or another, so I'm just leaving the current version (with your oneliner) for the review...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the one-liner replacement for the cabal-plan printing? I cannot see it, I only see the deletion of the cabal-plan step.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andreasabel oops: forgot to commit. Fixed.

@ulysses4ever
Copy link
Collaborator Author

Hmm, CI fails with rather mysterious solver error in the testsuite... https://github.com/haskell/cabal/actions/runs/4598996409/jobs/8123811204?pr=8893

@fgaz
Copy link
Member

fgaz commented Apr 3, 2023

>>> -j2 --hide-successes --with-ghc=ghc

Probably cabal list-bin returned nothing in $(cabal list-bin some_exe) -j2 [...]

@ulysses4ever
Copy link
Collaborator Author

Probably cabal list-bin returned nothing in $(cabal list-bin some_exe) -j2 [...]

Well, yes, but the solver error I was referring to above happens before this. And because of this error cabal list-bin is not functional, as it requires a resolved plan...

@ulysses4ever
Copy link
Collaborator Author

All right, i can reproduce it under GHC 844 on Linux but not 944. CI also showed the failure only under 844/Linux and stopped in all other configuration. Still no idea why it happens. The actual build ends fine but then list-bin kicks the solver again for some mysterious reason, and that fails...

@ulysses4ever
Copy link
Collaborator Author

Got it: list-bin needed to have the same project file as was used for the build.

@ulysses4ever ulysses4ever force-pushed the ci-no-cabal-plan branch 2 times, most recently from 3d1ca1d to 4432d40 Compare April 6, 2023 12:53
@ulysses4ever ulysses4ever marked this pull request as ready for review April 7, 2023 20:15
@ulysses4ever
Copy link
Collaborator Author

All right, please review!

Copy link
Member

@andreasabel andreasabel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work on this, @ulysses4ever!

The printing of the complete build plan was added for a reason, which can be read up upon in #8398 (comment): Folks relax an upper bound, which is not picked up by the solver due to another dependency, and then CI/build passes and people think relaxing the bound was fine.
So, the correct workflow is:

  1. relax the bound of a dependency,
  2. build,
  3. check that the new version of the dependency was indeed picked up.

The inclusion of cabal-plan served to enable step 3 by inspecting logs of CI runs.
@andreabedini added this rather recently (Aug 2022) upon my request. We have to avoid the whack-a-mole-situation, that one developer adds a feature that the next developer removes, which is then missed and added again etc.

If you want to remove it, you need to explain how step 3 of the bump workflow can be facilitated. Ideally would be a check that in the latest GHC, all the maximum versions of the dependencies are indeed picked up. Atm, cabal does not offer such a check.
As pointed out by @fgaz, cabal build does not output the complete build plan, only what has to be built, which does not include existing builds that can be reused.

@@ -369,7 +368,6 @@ step_time_summary() {
step_build() {
print_header "build"
timed $CABALNEWBUILD $TARGETS --dry-run || exit 1
$CABALPLAN topo --builddir=$BUILDDIR || exit 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the one-liner replacement for the cabal-plan printing? I cannot see it, I only see the deletion of the cabal-plan step.

@ulysses4ever ulysses4ever force-pushed the ci-no-cabal-plan branch 2 times, most recently from 504a7a3 to bdebdbf Compare April 8, 2023 17:22
@ulysses4ever
Copy link
Collaborator Author

@andreasabel thanks for the review and I whole-heartedly agree. Let's leave the full list of dependencies then (getting it one way or another). I'm sad to say: I have no clue about the procedure for bumping dependencies you're describing. Perhaps, it'd be good to document it somewhere. Although, I'm not sure which place is the best for such information. Maybe we could have a little "CI Maintainer Guide" or something and reference it from validate.sh and validate.yml...

@ulysses4ever
Copy link
Collaborator Author

@fgaz @andreabedini any interest here for a review or an opinion?

Copy link
Member

@andreasabel andreasabel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update.

Copy link
Member

@fgaz fgaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ulysses4ever ulysses4ever added the merge me Tell Mergify Bot to merge label Apr 14, 2023
@mergify mergify bot added the merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days label Apr 17, 2023
@mergify mergify bot merged commit dbfce81 into master Apr 17, 2023
@fgaz fgaz deleted the ci-no-cabal-plan branch April 19, 2023 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days merge me Tell Mergify Bot to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants