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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ci update hackage index #2562

Merged
merged 3 commits into from
Jan 4, 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
25 changes: 13 additions & 12 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,22 @@ jobs:
INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-')
echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV

# We have to restore package sources before `cabal update`
# cause it overwrites the hackage index with the cached one
- name: Hackage sources cache
uses: actions/cache@v2
env:
cache-name: hackage-sources
with:
path: ${{ env.CABAL_PKGS_DIR }}
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
restore-keys: ${{ env.cache-name }}-

# To ensure we get the lastest hackage index and not relying on haskell action logic
# It has to be done before `cabal freeze` to make it aware of the new index
- run: cabal update

- name: Form the package list ('cabal.project.freeze')
id: compute-cache-key
run: |
cabal v2-freeze && \
echo "" && \
Expand All @@ -98,16 +109,6 @@ jobs:
cat 'cabal.project.freeze' && \
echo '' || \
echo 'WARNING: Could not produce the `freeze`.'
echo ::set-output name=value::${{ hashFiles('cabal.project.freeze') }}

- name: Hackage sources cache
uses: actions/cache@v2
env:
cache-name: hackage-sources
with:
path: ${{ env.CABAL_PKGS_DIR }}
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
restore-keys: ${{ env.cache-name }}-

- name: Compiled deps cache
id: compiled-deps
Expand All @@ -116,7 +117,7 @@ jobs:
cache-name: compiled-deps
with:
path: ${{ steps.HaskEnvSetup.outputs.cabal-store }}
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ steps.compute-cache-key.outputs.value }}
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
33 changes: 17 additions & 16 deletions .github/workflows/caching.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,26 +142,13 @@ 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: |
cabal v2-freeze && \
echo "" && \
echo 'Output:' && \
echo "" && \
cat 'cabal.project.freeze' && \
echo '' || \
echo 'WARNING: Could not produce the `freeze`.'
echo ::set-output name=value::${{ hashFiles('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
# so having a shared pool here that depends only on Hackage pin & does not depend on `base` is "good enough"
# & used such because it preserves 10% of a global cache storage pool.
# We have to restore package sources before `cabal update`
# cause it overwrites the hackage index with the cached one
- name: Hackage sources cache
uses: actions/cache@v2
env:
Expand All @@ -171,14 +158,28 @@ jobs:
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
restore-keys: ${{ env.cache-name }}-

# To ensure we get the lastest hackage index and not relying on haskell action logic
# It has to be done before `cabal freeze` to make it aware of the new index
- run: cabal update

- name: Form the package list ('cabal.project.freeze')
run: |
cabal v2-freeze && \
echo "" && \
echo 'Output:' && \
echo "" && \
cat 'cabal.project.freeze' && \
echo '' || \
echo 'WARNING: Could not produce the `freeze`.'

- 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 }}-${{ steps.compute-cache-key.outputs.value }}
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
33 changes: 18 additions & 15 deletions .github/workflows/flags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,31 +85,30 @@ jobs:
INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-')
echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV

# We have to restore package sources before `cabal update`
# cause it overwrites the hackage index with the cached one
- name: Hackage sources cache
uses: actions/cache@v2
env:
cache-name: hackage-sources
with:
path: ${{ env.CABAL_PKGS_DIR }}
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
restore-keys: ${{ env.cache-name }}-

# To ensure we get the lastest hackage index and not relying on haskell action logic
# It has to be done before `cabal freeze` to make it aware of the new index
- run: cabal update

- name: Form the package list ('cabal.project.freeze')
id: compute-cache-key
run: |
cabal v2-freeze && \
echo "" && \
echo 'Output:' && \
echo "" && \
cat 'cabal.project.freeze' && \
echo "" || \
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
env:
cache-name: hackage-sources
with:
path: ${{ env.CABAL_PKGS_DIR }}
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
restore-keys: ${{ env.cache-name }}-

- name: Compiled deps cache
id: compiled-deps
Expand All @@ -118,12 +117,16 @@ jobs:
cache-name: compiled-deps
with:
path: ${{ steps.HaskEnvSetup.outputs.cabal-store }}
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ steps.compute-cache-key.outputs.value }}
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 }}-
${{ env.cache-name }}-${{ runner.os }}-

# Removing freeze file cause it breaks builds with alternative flags
- name: Remove freeze file
run: rm -f cabal.project.freeze

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

Expand Down
23 changes: 18 additions & 5 deletions .github/workflows/hackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,32 @@ jobs:
cache-name: hackage-sources
with:
path: ${{ env.CABAL_PKGS_DIR }}
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
restore-keys: ${{ env.cache-name }}-

# To ensure we get the lastest hackage index and not relying on haskell action logic
Anton-Latukha marked this conversation as resolved.
Show resolved Hide resolved
# It has to be done before `cabal freeze` to make it aware of the new index
- name: "Ensure we will use hackage head"
run: cabal update

- name: Form the package list ('cabal.project.freeze')
run: |
cabal v2-freeze && \
echo "" && \
echo 'Output:' && \
echo "" && \
cat 'cabal.project.freeze' && \
echo '' || \
echo 'WARNING: Could not produce the `freeze`.'

- 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 Expand Up @@ -116,9 +132,6 @@ jobs:
- name: "Unpack package source in an isolated location"
run: cabal unpack ${{ steps.generate-dist-tarball.outputs.path }} --destdir=./incoming

- name: "Ensure we will use hackage head"
run: cabal update

- name: "Try to get the current hackage version"
id: get-hackage-version
run: |
Expand Down
27 changes: 14 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,22 @@ jobs:
INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-')
echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV

# We have to restore package sources before `cabal update`
# cause it overwrites the hackage index with the cached one
- name: Hackage sources cache
uses: actions/cache@v2
env:
cache-name: hackage-sources
with:
path: ${{ env.CABAL_PKGS_DIR }}
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
restore-keys: ${{ env.cache-name }}-

# To ensure we get the lastest hackage index and not relying on haskell action logic
# It has to be done before `cabal freeze` to make it aware of the new index
- run: cabal update

- name: Compute the cache key
id: compute-cache-key
- name: Form the package list ('cabal.project.freeze')
run: |
cabal v2-freeze && \
echo "" && \
Expand All @@ -159,16 +170,6 @@ jobs:
cat 'cabal.project.freeze' && \
echo '' || \
echo 'WARNING: Could not produce the `freeze`.'
echo ::set-output name=value::${{ hashFiles('cabal.project.freeze') }}

Anton-Latukha marked this conversation as resolved.
Show resolved Hide resolved
- name: Hackage sources cache
uses: actions/cache@v2
env:
cache-name: hackage-sources
with:
path: ${{ env.CABAL_PKGS_DIR }}
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
restore-keys: ${{ env.cache-name }}-

- name: Compiled deps cache
id: compiled-deps
Expand All @@ -177,7 +178,7 @@ jobs:
cache-name: compiled-deps
with:
path: ${{ steps.HaskEnvSetup.outputs.cabal-store }}
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ steps.compute-cache-key.outputs.value }}
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