From 5c1bae566171433040e1438c230135b08f5a7820 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Mon, 27 Dec 2021 14:09:52 +0200 Subject: [PATCH 1/8] CI: caching: do `bench` & `test` separately `cabal v2-build all --enable-tests --enable-benchmarks` inferres 1 version per dep keeping all targets. People (frequently) & CI do `test` & `bench` separately. So `all tests` & `all bench` deps may not end up. Even current code does not match the CI guarantees, as all plugins get `test` separately, so their deps can not match-up. `caching` should not assume guarantees bigger then provided. --- .github/workflows/caching.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/caching.yml b/.github/workflows/caching.yml index 66ab4cd876..65f3622968 100644 --- a/.github/workflows/caching.yml +++ b/.github/workflows/caching.yml @@ -45,7 +45,7 @@ on: - cron: "25 2/8 * * *" env: - cabalBuild: "v2-build all --enable-tests --enable-benchmarks --keep-going" + cabalBuild: "v2-build all --keep-going" jobs: @@ -186,8 +186,10 @@ jobs: - if: steps.compiled-deps.outputs.cache-hit != 'true' name: Download all sources + # Downloaded separately, to match the tested work/PR workflow guarantees run: | - cabal $cabalBuild --only-download + cabal $cabalBuild --enable-benchmarks --only-download + cabal $cabalBuild --enable-tests --only-download # repeating builds to workaround segfaults in windows and ghc-8.8.4 # This build agenda in not to have successful code, @@ -197,10 +199,12 @@ jobs: - if: steps.compiled-deps.outputs.cache-hit != 'true' name: Build all targets; try 3 times continue-on-error: true + # Done separately, matching the tested work/PR workflow guarantees 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 + cabal $cabalBuild --enable-benchmarks || cabal $cabalBuild --enable-benchmarks || cabal $cabalBuild --enable-benchmarks + cabal $cabalBuild --enable-test || cabal $cabalBuild --enable-test || cabal $cabalBuild --enable-test From c4ee4d561a3dda823792b27da6d42fb206d18582 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Mon, 27 Dec 2021 14:21:09 +0200 Subject: [PATCH 2/8] CI: caching: rm workaround This workaround was not addressing the CI behaviour. --- .github/workflows/caching.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/caching.yml b/.github/workflows/caching.yml index 65f3622968..7eed115e3c 100644 --- a/.github/workflows/caching.yml +++ b/.github/workflows/caching.yml @@ -201,10 +201,5 @@ jobs: continue-on-error: true # Done separately, matching the tested work/PR workflow guarantees run: | - - # 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 cabal $cabalBuild --enable-benchmarks || cabal $cabalBuild --enable-benchmarks || cabal $cabalBuild --enable-benchmarks cabal $cabalBuild --enable-test || cabal $cabalBuild --enable-test || cabal $cabalBuild --enable-test From 316a0a04dcc424b523dd2d4aa1772f119b78532d Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Mon, 27 Dec 2021 14:23:47 +0200 Subject: [PATCH 3/8] CI: {caching, test, bench}: output `freeze` or warning --- .github/workflows/bench.yml | 12 +++++++----- .github/workflows/caching.yml | 12 +++++++----- .github/workflows/test.yml | 12 +++++++----- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index cf713e2f1c..3fc14fd785 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -88,11 +88,13 @@ jobs: - name: Form the package list ('cabal.project.freeze') continue-on-error: true run: | - cabal v2-freeze - echo '' - echo 'Output:' - echo '' - cat 'cabal.project.freeze' + cabal v2-freeze && \ + echo '' && \ + echo 'Output:' && \ + echo '' && \ + cat 'cabal.project.freeze' && \ + echo '' || \ + echo 'WARNING: Could not produce the `freeze`. - name: Hackage sources cache uses: actions/cache@v2 diff --git a/.github/workflows/caching.yml b/.github/workflows/caching.yml index 7eed115e3c..56a4c73eda 100644 --- a/.github/workflows/caching.yml +++ b/.github/workflows/caching.yml @@ -145,11 +145,13 @@ jobs: - name: Form the package list ('cabal.project.freeze') continue-on-error: true run: | - cabal v2-freeze - echo '' - echo 'Output:' - echo '' - cat 'cabal.project.freeze' + cabal v2-freeze && \ + echo '' && \ + echo 'Output:' && \ + echo '' && \ + cat 'cabal.project.freeze' && \ + echo '' || \ + echo 'WARNING: Could not produce the `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 f16d1c1f2e..68f8870107 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -149,11 +149,13 @@ jobs: - name: Form the package list ('cabal.project.freeze') continue-on-error: true run: | - cabal v2-freeze - echo '' - echo 'Output:' - echo '' - cat 'cabal.project.freeze' + cabal v2-freeze && \ + echo '' && \ + echo 'Output:' && \ + echo '' && \ + cat 'cabal.project.freeze' && \ + echo '' || \ + echo 'WARNING: Could not produce the `freeze`. - name: Hackage sources cache uses: actions/cache@v2 From 27ec2c81c9fc7817cdc7faafaa9c576c8fc77678 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Mon, 27 Dec 2021 14:32:38 +0200 Subject: [PATCH 4/8] CI: {caching, test, bench}: m v2-update unification --- .github/workflows/bench.yml | 3 ++- .github/workflows/caching.yml | 2 +- .github/workflows/test.yml | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 3fc14fd785..66ebceb875 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -118,7 +118,8 @@ jobs: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}- ${{ env.cache-name }}-${{ runner.os }}- - - run: cabal update + - run: | + cabal v2-update # max-backjumps is increased as a temporary solution # for dependency resolution failure diff --git a/.github/workflows/caching.yml b/.github/workflows/caching.yml index 56a4c73eda..5df983437b 100644 --- a/.github/workflows/caching.yml +++ b/.github/workflows/caching.yml @@ -184,7 +184,7 @@ jobs: - if: steps.compiled-deps.outputs.cache-hit != 'true' run: | - cabal update + cabal v2-update - if: steps.compiled-deps.outputs.cache-hit != 'true' name: Download all sources diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 68f8870107..73c56ed71c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -179,7 +179,8 @@ jobs: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}- ${{ env.cache-name }}-${{ runner.os }}- - - run: cabal v2-update + - run: | + cabal v2-update # repeating builds to workaround segfaults in windows and ghc-8.8.4 - name: Build From 81dced9c7328834a1e356d4554cb92cd6404ea9c Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Mon, 27 Dec 2021 14:48:50 +0200 Subject: [PATCH 5/8] CI: caching: do bench caching only for what gets used Efficient use of available space. --- .github/workflows/caching.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/caching.yml b/.github/workflows/caching.yml index 5df983437b..e775e97074 100644 --- a/.github/workflows/caching.yml +++ b/.github/workflows/caching.yml @@ -186,11 +186,16 @@ jobs: run: | cabal v2-update - - if: steps.compiled-deps.outputs.cache-hit != 'true' - name: Download all sources + - 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 run: | cabal $cabalBuild --enable-benchmarks --only-download + + - if: steps.compiled-deps.outputs.cache-hit != 'true' + name: Download the rest of the sources + # Downloaded separately, to match the tested work/PR workflow guarantees + run: | cabal $cabalBuild --enable-tests --only-download # repeating builds to workaround segfaults in windows and ghc-8.8.4 @@ -198,10 +203,16 @@ jobs: # but to cache what can be cached, so step is fault tolerant & would always succseed. # 2021-12-11: NOTE: Building all targets, since # current Cabal does not allow `all --enable-tests --enable-benchmarks --only-dependencies` + + - if: steps.compiled-deps.outputs.cache-hit != 'true' && runner.os == 'Linux' && matrix.ghc == '8.10.7' + name: (For Bench workflow) Build benchmark targets + # Downloaded separately, to match the tested work/PR workflow guarantees + run: | + cabal $cabalBuild --enable-benchmarks || cabal $cabalBuild --enable-benchmarks || cabal $cabalBuild --enable-benchmarks + - if: steps.compiled-deps.outputs.cache-hit != 'true' - name: Build all targets; try 3 times + name: Build targets; try 3 times continue-on-error: true # Done separately, matching the tested work/PR workflow guarantees run: | - cabal $cabalBuild --enable-benchmarks || cabal $cabalBuild --enable-benchmarks || cabal $cabalBuild --enable-benchmarks cabal $cabalBuild --enable-test || cabal $cabalBuild --enable-test || cabal $cabalBuild --enable-test From d7a4afcd093398df2d2ba37d25320f764dbeef69 Mon Sep 17 00:00:00 2001 From: Anton Latukha Date: Mon, 27 Dec 2021 18:07:32 +0200 Subject: [PATCH 6/8] CI: caching: fx benchmark caching step Co-authored-by: Javier Neira --- .github/workflows/caching.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/caching.yml b/.github/workflows/caching.yml index e775e97074..89d54de93c 100644 --- a/.github/workflows/caching.yml +++ b/.github/workflows/caching.yml @@ -206,6 +206,7 @@ jobs: - if: steps.compiled-deps.outputs.cache-hit != 'true' && runner.os == 'Linux' && matrix.ghc == '8.10.7' name: (For Bench workflow) Build benchmark targets + continue-on-error: true # Downloaded separately, to match the tested work/PR workflow guarantees run: | cabal $cabalBuild --enable-benchmarks || cabal $cabalBuild --enable-benchmarks || cabal $cabalBuild --enable-benchmarks From d22a317d61d765d783a08091233276eb3a4c6a28 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Mon, 27 Dec 2021 18:02:13 +0200 Subject: [PATCH 7/8] CI: {caching, test, bench}: `haskell/actions/setup` does the update --- .github/workflows/bench.yml | 3 --- .github/workflows/caching.yml | 4 ---- .github/workflows/test.yml | 3 --- 3 files changed, 10 deletions(-) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 66ebceb875..e3185c56de 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -118,9 +118,6 @@ jobs: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}- ${{ env.cache-name }}-${{ runner.os }}- - - run: | - cabal v2-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 89d54de93c..c4dec070b0 100644 --- a/.github/workflows/caching.yml +++ b/.github/workflows/caching.yml @@ -182,10 +182,6 @@ jobs: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}- ${{ env.cache-name }}-${{ runner.os }}- - - if: steps.compiled-deps.outputs.cache-hit != 'true' - run: | - cabal v2-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 73c56ed71c..6d52f515ea 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -179,9 +179,6 @@ jobs: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}- ${{ env.cache-name }}-${{ runner.os }}- - - run: | - cabal v2-update - # repeating builds to workaround segfaults in windows and ghc-8.8.4 - name: Build run: cabal build || cabal build || cabal build From 9a751d99b82a1b3bce84197a53a8cc48897b9e3b Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Mon, 27 Dec 2021 18:02:57 +0200 Subject: [PATCH 8/8] CI: caching: m fx --- .github/workflows/caching.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/caching.yml b/.github/workflows/caching.yml index c4dec070b0..0f91111971 100644 --- a/.github/workflows/caching.yml +++ b/.github/workflows/caching.yml @@ -186,19 +186,19 @@ jobs: name: Download sources for bench # Downloaded separately, to match the tested work/PR workflow guarantees run: | - cabal $cabalBuild --enable-benchmarks --only-download + cabal $cabalBuild --only-download --enable-benchmarks - if: steps.compiled-deps.outputs.cache-hit != 'true' name: Download the rest of the sources # Downloaded separately, to match the tested work/PR workflow guarantees run: | - cabal $cabalBuild --enable-tests --only-download + cabal $cabalBuild --only-download --enable-tests # repeating builds to workaround segfaults in windows and ghc-8.8.4 # This build agenda in not to have successful code, - # but to cache what can be cached, so step is fault tolerant & would always succseed. - # 2021-12-11: NOTE: Building all targets, since - # current Cabal does not allow `all --enable-tests --enable-benchmarks --only-dependencies` + # but to cache what can be cached, so step is fault tolerant & would always succeed. + # 2021-12-11: NOTE: Need to building all targets (build the project also), since + # current Cabal does not allow `all --enable-tests --enable-benchmarks --only-dependencies` combination - if: steps.compiled-deps.outputs.cache-hit != 'true' && runner.os == 'Linux' && matrix.ghc == '8.10.7' name: (For Bench workflow) Build benchmark targets