Skip to content

Fix freeze cache key correctly #2560

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 5 commits into from
Jan 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ jobs:
INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-')
echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV

# To ensure we get the lastest hackage index and not relying on haskell action logic
- run: cabal update

- name: Form the package list ('cabal.project.freeze')
id: compute-cache-key
run: |
Expand All @@ -96,8 +99,6 @@ jobs:
echo '' || \
echo 'WARNING: Could not produce the `freeze`.'
echo ::set-output name=value::${{ hashFiles('cabal.project.freeze') }}
# Removing freeze file as it can break builds using allow-newer
rm -f cabal.project.freeze

- name: Hackage sources cache
uses: actions/cache@v2
Expand All @@ -121,9 +122,6 @@ jobs:
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-
${{ env.cache-name }}-${{ runner.os }}-

# To ensure we get the lastest hackage index and not relying on haskell action logic
- run: cabal update

# max-backjumps is increased as a temporary solution
# for dependency resolution failure
- run: cabal configure --enable-benchmarks --max-backjumps 12000
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/caching.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ jobs:
INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-')
echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV

# To ensure we get the lastest hackage index and not relying on haskell action logic
- run: cabal update

- name: Form the package list ('cabal.project.freeze')
id: compute-cache-key
run: |
Expand All @@ -153,8 +156,6 @@ jobs:
echo '' || \
echo 'WARNING: Could not produce the `freeze`.'
echo ::set-output name=value::${{ hashFiles('cabal.project.freeze') }}
# Removing freeze file as it can break builds using allow-newer
rm -f 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`.
Expand Down Expand Up @@ -183,10 +184,6 @@ jobs:
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-
${{ env.cache-name }}-${{ runner.os }}-

# To ensure we get the lastest hackage index and not relying on haskell action logic
- if: steps.compiled-deps.outputs.cache-hit != 'true'
run: cabal update

- if: steps.compiled-deps.outputs.cache-hit != 'true' && runner.os == 'Linux' && matrix.ghc == '8.10.7'
name: Download sources for bench
# Downloaded separately, to match the tested work/PR workflow guarantees
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/flags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,11 @@ jobs:
INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-')
echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV

# To ensure we get the lastest hackage index and not relying on haskell action logic
- run: cabal update

- name: Form the package list ('cabal.project.freeze')
continue-on-error: true
id: compute-cache-key
run: |
cabal v2-freeze && \
echo "" && \
Expand All @@ -95,6 +98,9 @@ jobs:
cat 'cabal.project.freeze' && \
echo "" || \
echo 'WARNING: Could not produce the `freeze`.'
echo ::set-output name=value::${{ hashFiles('cabal.project.freeze') }}
# Removing freeze file as it breaks builds with alternative flags
rm -rf cabal.project.freeze

- name: Hackage sources cache
uses: actions/cache@v2
Expand All @@ -112,16 +118,12 @@ 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.freeze') }}
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ steps.compute-cache-key.outputs.value }}
Comment on lines -115 to +121
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thank you for catching this.

restore-keys: |
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-
${{ env.cache-name }}-${{ runner.os }}-

# To ensure we get the lastest hackage index and not relying on haskell action logic
- if: steps.compiled-deps.outputs.cache-hit != 'true'
run: cabal update

- name: Build `hls-graph` with flags
run: cabal v2-build hls-graph --flags="pedantic embed-files stm-stats"

Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ jobs:
INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-')
echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV

# To ensure we get the lastest hackage index and not relying on haskell action logic
- run: cabal update

- name: Compute the cache key
id: compute-cache-key
run: |
Expand All @@ -157,8 +160,6 @@ jobs:
echo '' || \
echo 'WARNING: Could not produce the `freeze`.'
echo ::set-output name=value::${{ hashFiles('cabal.project.freeze') }}
# Removing freeze file as it can break builds using allow-newer
rm -rf cabal.project.freeze

- name: Hackage sources cache
uses: actions/cache@v2
Expand All @@ -182,10 +183,6 @@ jobs:
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-
${{ env.cache-name }}-${{ runner.os }}-

# To ensure we get the lastest hackage index and not relying on haskell action logic
- if: steps.compiled-deps.outputs.cache-hit != 'true'
run: cabal update

# repeating builds to workaround segfaults in windows and ghc-8.8.4
- name: Build
run: cabal build || cabal build || cabal build
Expand Down