Skip to content

CI: {caching,test,bench}: mk cache aware of package dep versions #2532

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

12 changes: 11 additions & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ jobs:
INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-')
echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV

- name: Form the package list ('cabal.project.freeze')
continue-on-error: true
run: |
cabal v2-freeze
echo ''
echo 'Output:'
echo ''
cat 'cabal.project.freeze'

- name: Hackage sources cache
uses: actions/cache@v2
env:
Expand All @@ -84,12 +93,13 @@ jobs:
restore-keys: ${{ env.cache-name }}-

- name: Compiled deps cache
id: compiled-deps
uses: actions/cache@v2
env:
cache-name: compiled-deps
with:
path: ${{ steps.HaskEnvSetup.outputs.cabal-store }}
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project') }}
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: |
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-
Expand Down
24 changes: 20 additions & 4 deletions .github/workflows/caching.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@ jobs:
INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-')
echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV

- name: Form the package list ('cabal.project.freeze')
continue-on-error: true
run: |
cabal v2-freeze
echo ''
echo 'Output:'
echo ''
cat 'cabal.project.freeze'

# 2021-12-02: NOTE: Cabal Hackage source tree storage does not depend on OS or GHC really,
# but can depend on `base`.
# But this caching is happens only inside `master` for `master` purposes of compiling the deps
Expand All @@ -135,9 +144,11 @@ jobs:
env:
cache-name: hackage-sources
with:
path: ${{ env.CABAL_PKGS_DIR }}
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
restore-keys: ${{ env.cache-name }}-
path: ${{ env.CABAL_PKGS_DIR }}
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: |
${{ env.cache-name }}-${{ env.INDEX_STATE }}-
${{ env.cache-name }}-

- name: Compiled deps cache
id: compiled-deps
Expand All @@ -146,7 +157,7 @@ jobs:
cache-name: compiled-deps
with:
path: ${{ steps.HaskEnvSetup.outputs.cabal-store }}
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project') }}
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: |
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-
Expand All @@ -171,3 +182,8 @@ jobs:
continue-on-error: true
run: |
cabal $cabalBuild || cabal $cabalBuild || cabal $cabalBuild

# Despite the `continue-on-error: true` directive - CI does not ignore the return code of the last step
- name: Workaround to CI platform
run: |
true
12 changes: 11 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ jobs:
INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-')
echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV

- name: Form the package list ('cabal.project.freeze')
continue-on-error: true
run: |
cabal v2-freeze
echo ''
echo 'Output:'
echo ''
cat 'cabal.project.freeze'

- name: Hackage sources cache
uses: actions/cache@v2
env:
Expand All @@ -133,12 +142,13 @@ jobs:
restore-keys: ${{ env.cache-name }}-

- name: Compiled deps cache
id: compiled-deps
uses: actions/cache@v2
env:
cache-name: compiled-deps
with:
path: ${{ steps.HaskEnvSetup.outputs.cabal-store }}
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project') }}
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: |
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-
Expand Down