-
Notifications
You must be signed in to change notification settings - Fork 721
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 cabal-cache #4717
Use cabal-cache #4717
Conversation
22e09ef
to
c94fe3e
Compare
echo "cabal-store=$(dirname "$cabal_config_file")/store" | tee -a "$GITHUB_OUTPUT" | ||
else | ||
echo "cabal-store=C:\\cabal\\store" | tee -a "$GITHUB_OUTPUT" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unify the computation of the cabal
store directory to a single step. This makes referencing the cabal store in later steps easier.
This also fixes the problem where on MacOS
, the cabal-store=/home/runner/.cabal/store
is incorrect. This should be /Users/runner/.cabal/store
.
To avoid this problem in future, on Linux and MacOS, the step queries cabal
for the some information to compute the location of the cabal
store.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put this as a comment in the file?
store-path: ${{ steps.cabal-store.outputs.cabal-store }} | ||
threads: 16 | ||
archive-uri: ${{ secrets.BINARY_CACHE_URI }} | ||
skip: "${{ secrets.BINARY_CACHE_URI == '' }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This step syncs the cabal store with S3
, an object store service (think a service for storing files).
The S3 bucket is set to s3://iohk.cache.haskellworks.io
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise
threads: 16 | ||
archive-uri: https://iohk.cache.haskellworks.io | ||
skip: "${{ secrets.BINARY_CACHE_URI != '' }}" | ||
enable-save: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's important to ensure that people who fork this repository can not only successfully build in CI by default, but also have meaning cabal store caching.
Because syncing with S3 requires credentials, we cannot rely on S3 for this. For this reason a https
fallback is used. The https
server mirrors the content of the S3 bucket. The https
cabal store archive is read-only for security reasons.
Users who fork this repository who want to have a writable cabal store archive are encouraged to set up their own S3 bucket.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this
@@ -288,6 +291,8 @@ jobs: | |||
# - name: Setup tmate session | |||
# if: ${{ failure() }} | |||
# uses: mxschmitt/action-tmate@v3 | |||
# with: | |||
# limit-access-to-actor: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this to the commented out tmate
step for security reasons in case someone decides to use it.
ecac7f4
to
54e5140
Compare
33dde0c
to
f49bfd4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍 . Just add the comments to the haskell.yml
file
f49bfd4
to
0d75329
Compare
Use
cabal-cache
to cachecabal
packages.This is better than using
actions/cache@v2
becausecabal-cache
is a fine grained cache that caches each built cabal package individually.This means that if any packages were built successfully in CI, even if CI fails, we can still upload those packages that successfully built. This is far superior to the situation we have now which is if CI fails we cache nothing.
This is especially useful for those occasions where we update the index state or change our package dependencies (including package dependency bounds) because currently for those cases, a failed build means we cache nothing which hurts iteration times very badly.
The change keeps the build time more reliably tight:
Compare this to the old caching method:
The PR also fixes a bug which mean that MacOS builds weren't cached at all (ie. the
89m
MacOS build time in the old caching method).