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

Centralized caching workflow #2419

Merged
merged 2 commits into from
Dec 1, 2021

Conversation

Anton-Latukha
Copy link
Collaborator

@Anton-Latukha Anton-Latukha commented Nov 30, 2021

Discussed in: https://matrix.to/#/!oOjZFsoNYPAbTEgSOA:libera.chat/$ckv7h8SSMbimsa_5pCaCFn2uMm_nEVIy6gy0QyFgc8M?via=libera.chat&via=matrix.org&via=monoid.al

Short: Cabal builds deps from the source. Currently, cache gets saved only on the successful passing of the CI workflow pipeline (includes dependencies built, then all HLS projects built & then successful passing of all tests, core word is "successful" passing of all of that), while successful Cabal dependency build stage depends only on does Hackage snapshot state (success of Cabal dependency build stage).

Basic idea - is to run cabal v2-build --only-dependencies, which would ensure saving & sharing of the snapshot of successfully built dependencies into pull requests. To run on schedule & on push to master.

@Anton-Latukha Anton-Latukha changed the title Centralized caching workflow [WIP] Centralized caching workflow Nov 30, 2021
@Anton-Latukha Anton-Latukha marked this pull request as ready for review November 30, 2021 15:04
@Anton-Latukha Anton-Latukha marked this pull request as draft November 30, 2021 15:07
@jneira jneira self-requested a review November 30, 2021 15:56
@Anton-Latukha Anton-Latukha force-pushed the 2021-11-30-ci-upd-cache branch from 63573e1 to 52118df Compare November 30, 2021 21:59
@Anton-Latukha Anton-Latukha changed the title [WIP] Centralized caching workflow Centralized caching workflow Nov 30, 2021
@Anton-Latukha
Copy link
Collaborator Author

Anton-Latukha commented Nov 30, 2021

Cache for *-build-* stores:

        with:
          path: |
            ${{ env.CABAL_PKGS_DIR }}
            ${{ env.CABAL_STORE_DIR }}

That is ~/.cabal/packages & ~/.cabal/store which are build dependency storage. That means that build is just a dependency cache & that is seen from that dist-newstyle build artifacts are not cached at all.

So introducing dependency caching already as is - uses *-build-* already properly.

@Anton-Latukha
Copy link
Collaborator Author

The first successful caching happened in: https://github.com/haskell/haskell-language-server/runs/4369337368?check_suite_focus=true. Further builds are cache reuse.

@Anton-Latukha Anton-Latukha force-pushed the 2021-11-30-ci-upd-cache branch from 371e75a to ca0faab Compare November 30, 2021 22:09
@Anton-Latukha Anton-Latukha marked this pull request as ready for review November 30, 2021 22:09
@Anton-Latukha Anton-Latukha force-pushed the 2021-11-30-ci-upd-cache branch from ca0faab to 418688f Compare November 30, 2021 22:41
@Anton-Latukha Anton-Latukha force-pushed the 2021-11-30-ci-upd-cache branch from 418688f to b0621d7 Compare November 30, 2021 22:55
@@ -0,0 +1,121 @@
name: Caching of dependencies

# 2021-11-30: NOTE: This workflow currently a trimmed copy of a main `test.yml` workflow. Workflows need further deduplication: https://docs.github.com/en/actions/learn-github-actions/reusing-workflows#overview
Copy link
Member

Choose a reason for hiding this comment

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

I am a little bit worried too by the duplication between this and the test workflow (to the already existing duplication with the build workflow). But well we can tackle it in next pr's
Will take a look to the link you provided to see how can we remove it
have you planned working on that?

Copy link
Member

@jneira jneira left a comment

Choose a reason for hiding this comment

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

lgtm, many thanks for helping to improve ci

@jneira jneira merged commit 0b74792 into haskell:master Dec 1, 2021
@jneira
Copy link
Member

jneira commented Dec 1, 2021

Not related at all with this pr but the nix build in master has failed with

primitive-extras> Preprocessing library for primitive-extras-0.10.1..
primitive-extras> Building library for primitive-extras-0.10.1..
primitive-extras> [ 1 of 10] Compiling PrimitiveExtras.Prelude ( library/PrimitiveExtras/Prelude.hs, dist/build/PrimitiveExtras/Prelude.o, dist/build/PrimitiveExtras/Prelude.dyn_o )
primitive-extras> [ 2 of 10] Compiling PrimitiveExtras.Types ( library/PrimitiveExtras/Types.hs, dist/build/PrimitiveExtras/Types.o, dist/build/PrimitiveExtras/Types.dyn_o )
primitive-extras> [ 3 of 10] Compiling PrimitiveExtras.SmallArray ( library/PrimitiveExtras/SmallArray.hs, dist/build/PrimitiveExtras/SmallArray.o, dist/build/PrimitiveExtras/SmallArray.dyn_o )
primitive-extras> [ 4 of 10] Compiling PrimitiveExtras.Bitmap ( library/PrimitiveExtras/Bitmap.hs, dist/build/PrimitiveExtras/Bitmap.o, dist/build/PrimitiveExtras/Bitmap.dyn_o )
primitive-extras> library/PrimitiveExtras/Bitmap.hs:5:3: error:
primitive-extras>     Ambiguous occurrence ‘singleton’
primitive-extras>     It could refer to
primitive-extras>        either ‘PrimitiveExtras.Prelude.singleton’,
primitive-extras>               imported from ‘PrimitiveExtras.Prelude’ at library/PrimitiveExtras/Bitmap.hs:25:1-70
primitive-extras>               (and originally defined in ‘base-4.15.0.0:Data.OldList’)
primitive-extras>            or ‘PrimitiveExtras.Bitmap.singleton’,
primitive-extras>               defined at library/PrimitiveExtras/Bitmap.hs:53:1
primitive-extras>   |
primitive-extras> 5 |   singleton,
primitive-extras>   |   ^^^^^^^^^
primitive-extras> [ 6 of 10] Compiling PrimitiveExtras.UnliftedArray ( library/PrimitiveExtras/UnliftedArray.hs, dist/build/PrimitiveExtras/UnliftedArray.o, dist/build/PrimitiveExtras/UnliftedArray.dyn_o )

so i guess some hackage change has triggered it? the nix build soes not use the pinned hackage index from cabal.project?

//cc @maralorn @michaelpj

@jneira
Copy link
Member

jneira commented Dec 1, 2021

EDITED: we are building an older release 0.10.1 which seems to be not compatible with ghc-9.0.1

@Anton-Latukha
Copy link
Collaborator Author

lgtm, many thanks for helping to improve ci

Thank you also.

It is highly motivating to get work accepted & get maintainer notes on what can be made further.

Would take another round on CI code.

drsooch pushed a commit to drsooch/haskell-language-server that referenced this pull request Dec 3, 2021
* CI: add workflow to cache build dependencies

* delete this pull request push trigger before
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

Successfully merging this pull request may close these issues.

2 participants