haskell-CI / haskell-ci

Scripts and instructions for using CI services (e.g. Travis CI or Appveyor) with multiple GHC configurations
GNU General Public License v3.0
431 stars 70 forks source link

Jammy is not compatible with GHC versions `<= 8.8` #729

Closed BinderDavid closed 4 weeks ago

BinderDavid commented 4 weeks ago

I just used the current version from master to generate a new CI config for ghc-events in this pull request: https://github.com/haskell/ghc-events/pull/105

The generated CI configuration doesn't seem to work for GHC versions <= 8.8. The build failure in the logs looks like this:

E: The repository 'https://ppa.launchpadcontent.net/hvr/ghc/ubuntu jammy Release' does not have a Release file.
Repository: 'deb https://ppa.launchpadcontent.net/hvr/ghc/ubuntu/ jammy main'
phadej commented 4 weeks ago

I'm confused. The haskell-ci uses ghcup by default on jammy, see e.g. https://github.com/haskell-unordered-containers/hashable/blob/7837d1d54799a03794d0868cff49f99663048256/.github/workflows/haskell-ci.yml which doesn't has any particular configuration related which installed method to use.

In particular, when distribution is jammy, we force to use ghcup for all fjobs: https://github.com/haskell-CI/haskell-ci/blob/28aae7df5ae36ec1eb1814e810a7a02af64c5c99/src/HaskellCI/Config.hs#L273

As the linked issue moved to use a haskell-ci fork (so I cannot see what they did, why the issue failed), I'll close this as invalid if no further information is provided.

BinderDavid commented 4 weeks ago

Sorry, I forgot that force-pushing on that branch prohibits you from seeing the last version.

Here are the steps to reproduce:

This results in the following output on the command line:

No haskell-ci.sh, skipping bash regeneration
*INFO* Generating GitHub config for testing for GHC versions: 8.0.2 8.2.2 8.4.4 8.6.5 8.8.4 8.10.7 9.0.2 9.2.4 9.4.2 9.6.1 9.8.1

And the following diff:

--- a/.github/workflows/haskell-ci.yml
+++ b/.github/workflows/haskell-ci.yml
@@ -8,9 +8,9 @@
 #
 # For more information, see https://github.com/haskell-CI/haskell-ci
 #
-# version: 0.17.20231203
+# version: 0.19.20240514
 #
-# REGENDATA ("0.17.20231203",["github","ghc-events.cabal"])
+# REGENDATA ("0.19.20240514",["github","ghc-events.cabal"])
 #
 name: Haskell-CI
 on:
@@ -23,7 +23,7 @@ jobs:
     timeout-minutes:
       60
     container:
-      image: buildpack-deps:bionic
+      image: buildpack-deps:jammy
     continue-on-error: ${{ matrix.allow-failure }}
     strategy:
       matrix:
@@ -187,7 +187,7 @@ jobs:
           chmod a+x $HOME/.cabal/bin/cabal-plan
           cabal-plan --version
       - name: checkout
-        uses: actions/checkout@v3
+        uses: actions/checkout@v4
         with:
           path: source
       - name: initial cabal.project for sdist
@@ -215,7 +215,7 @@ jobs:
           if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "    ghc-options: -Werror=missing-methods" >> cabal.project ; fi
           cat >> cabal.project <<EOF
           EOF
-          $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(ghc-events)$/; }' >> cabal.project.local
+          $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(ghc-events)$/; }' >> cabal.project.local
           cat cabal.project
           cat cabal.project.local
       - name: dump install plan
@@ -223,7 +223,7 @@ jobs:
           $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
           cabal-plan
       - name: restore cache
-        uses: actions/cache/restore@v3
+        uses: actions/cache/restore@v4
         with:
           key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
           path: ~/.cabal/store
@@ -253,7 +253,7 @@ jobs:
           rm -f cabal.project.local
           $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
       - name: save cache
-        uses: actions/cache/save@v3
+        uses: actions/cache/save@v4
         if: always()
         with:
           key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}

The previous version of the script already used the setup-method: hvr-ppa option. Using haskell-ci regenerate then replaced the image by jammy, but didn't change the setup-method to ghcup. This leaves the regenerated build script in a state which doesn't work.

phadej commented 4 weeks ago

Ok. I see, the bug is that the code i linked is not run if cabal.haskell-ci config file doesn't exist. If you add (even an empty cabal.haskell-ci file), the diff will have things like

@@ -61,49 +61,39 @@ jobs:
           - compiler: ghc-8.8.4
             compilerKind: ghc
             compilerVersion: 8.8.4
-            setup-method: hvr-ppa
+            setup-method: ghcup
             allow-failure: false

I have to investigate why the no-config file and config file case differs; but the "workaround" isn't too bad for now.