Skip to content

Commit

Permalink
Remove cabal.project.freeze files in workflows after computing the ca…
Browse files Browse the repository at this point in the history
…che key (#2552)

* Enable tests for brittany and 9.0.2

* Enable tests for floskell plugin

* Remove cabal.project.freeze

* don't test Brittany for ghc-9.0.1

* restore src cache keys

* restore src cache keys

* remove freeze cache key

Co-authored-by: Anton Latukha <anton.latukha@gmail.com>
  • Loading branch information
jneira and Anton-Latukha authored Dec 31, 2021
1 parent 937fdd0 commit 2eaa2a4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 18 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,26 @@ jobs:
echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV
- name: Form the package list ('cabal.project.freeze')
continue-on-error: true
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 '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
env:
cache-name: hackage-sources
with:
path: ${{ env.CABAL_PKGS_DIR }}
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
path: ${{ env.CABAL_PKGS_DIR }}
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
restore-keys: ${{ env.cache-name }}-

- name: Compiled deps cache
Expand All @@ -112,7 +115,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.freeze') }}
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ steps.compute-cache-key.outputs.value }}
restore-keys: |
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/caching.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,18 @@ jobs:
echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV
- name: Form the package list ('cabal.project.freeze')
continue-on-error: true
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 '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 All @@ -164,10 +167,8 @@ jobs:
cache-name: hackage-sources
with:
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 }}-
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
restore-keys: ${{ env.cache-name }}-

- name: Compiled deps cache
id: compiled-deps
Expand All @@ -176,7 +177,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.freeze') }}
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ steps.compute-cache-key.outputs.value }}
restore-keys: |
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-
Expand Down
19 changes: 13 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,24 +146,27 @@ 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
- name: Compute the cache key
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 '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
env:
cache-name: hackage-sources
with:
path: ${{ env.CABAL_PKGS_DIR }}
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
path: ${{ env.CABAL_PKGS_DIR }}
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
restore-keys: ${{ env.cache-name }}-

- name: Compiled deps cache
Expand All @@ -173,7 +176,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.freeze') }}
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ steps.compute-cache-key.outputs.value }}
restore-keys: |
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-
Expand Down Expand Up @@ -229,6 +232,10 @@ jobs:
name: Test hls-brittany-plugin
run: cabal test hls-brittany-plugin --test-options="$TEST_OPTS" || cabal test hls-brittany-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-brittany-plugin --test-options="$TEST_OPTS"

- if: matrix.test
name: Test hls-floskell-plugin
run: cabal test hls-floskell-plugin --test-options="$TEST_OPTS" || cabal test hls-floskell-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-floskell-plugin --test-options="$TEST_OPTS"

- if: matrix.test
name: Test hls-class-plugin
run: cabal test hls-class-plugin --test-options="$TEST_OPTS" || cabal test hls-class-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-class-plugin --test-options="$TEST_OPTS"
Expand Down

0 comments on commit 2eaa2a4

Please # to comment.