From 00168d76b117994a7175e61979453a4f5830f986 Mon Sep 17 00:00:00 2001 From: jneira Date: Sat, 1 Jan 2022 23:23:47 +0100 Subject: [PATCH 1/5] Update cabal before freeze --- .github/workflows/bench.yml | 6 +++--- .github/workflows/caching.yml | 7 +++---- .github/workflows/test.yml | 7 +++---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index cf248d8664..a135c5fd81 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -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: | @@ -121,9 +124,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 diff --git a/.github/workflows/caching.yml b/.github/workflows/caching.yml index 61c05d8936..ba58381ca6 100644 --- a/.github/workflows/caching.yml +++ b/.github/workflows/caching.yml @@ -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: | @@ -183,10 +186,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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9430e72156..518277e549 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: | @@ -182,10 +185,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 From be8dd84eab6025c877855583d716f9aedb5c145d Mon Sep 17 00:00:00 2001 From: jneira Date: Sun, 2 Jan 2022 16:19:06 +0100 Subject: [PATCH 2/5] Use step outputs for cache key --- .github/workflows/flags.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/flags.yml b/.github/workflows/flags.yml index 3fe0ac69d2..1a358e5e07 100644 --- a/.github/workflows/flags.yml +++ b/.github/workflows/flags.yml @@ -86,7 +86,7 @@ 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 "" && \ @@ -95,6 +95,7 @@ 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 @@ -112,7 +113,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 }}- From 20365688862bb95bd2ba8f6ececee2d887753bf2 Mon Sep 17 00:00:00 2001 From: jneira Date: Sun, 2 Jan 2022 16:19:46 +0100 Subject: [PATCH 3/5] Remove rm freeze file --- .github/workflows/bench.yml | 2 -- .github/workflows/caching.yml | 2 -- .github/workflows/test.yml | 2 -- 3 files changed, 6 deletions(-) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index a135c5fd81..90d0d05ada 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -99,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 diff --git a/.github/workflows/caching.yml b/.github/workflows/caching.yml index ba58381ca6..789ec0ff46 100644 --- a/.github/workflows/caching.yml +++ b/.github/workflows/caching.yml @@ -156,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`. diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 518277e549..7ed443d518 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -160,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 From f6a63a8c27cf90b26506ae128f279d95c2a123b2 Mon Sep 17 00:00:00 2001 From: jneira Date: Sun, 2 Jan 2022 18:14:43 +0100 Subject: [PATCH 4/5] Move cabal update for flags --- .github/workflows/flags.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/flags.yml b/.github/workflows/flags.yml index 1a358e5e07..b72877d046 100644 --- a/.github/workflows/flags.yml +++ b/.github/workflows/flags.yml @@ -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: | @@ -119,10 +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 - - 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" From 997229dc7c94b06ae03d600282c8fc61f63e2893 Mon Sep 17 00:00:00 2001 From: jneira Date: Sun, 2 Jan 2022 18:40:51 +0100 Subject: [PATCH 5/5] Flags workflow needs rm freeze file --- .github/workflows/flags.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/flags.yml b/.github/workflows/flags.yml index b72877d046..608d9ed544 100644 --- a/.github/workflows/flags.yml +++ b/.github/workflows/flags.yml @@ -99,6 +99,8 @@ jobs: 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