From 96b086851b8644d93dbefde33f4e1a80d44d8c66 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Mon, 11 Nov 2024 17:02:23 +0200 Subject: [PATCH] WIP --- .github/workflows/haskell-ci.yml | 7 ++++++- src/HaskellCI/Config/History.hs | 5 +++-- src/HaskellCI/GitHub.hs | 16 ++++++++++++---- src/HaskellCI/GitHub/Yaml.hs | 8 +++++--- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index c7441878..b8c5d976 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -40,6 +40,11 @@ jobs: compilerVersion: 9.8.3 setup-method: ghcup allow-failure: false + - compiler: ghc-9.8.3 + compilerKind: ghc + compilerVersion: 9.8.3 + setup-method: ghcup-vanilla + allow-failure: false - compiler: ghc-9.8.2 compilerKind: ghc compilerVersion: 9.8.2 @@ -112,7 +117,7 @@ jobs: - name: Install GHC (GHCup vanilla) if: matrix.setup-method == 'ghcup-vanilla' run: | - "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" -s https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-vanilla-0.0.8.yaml install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') diff --git a/src/HaskellCI/Config/History.hs b/src/HaskellCI/Config/History.hs index 79a9bce8..f3effb48 100644 --- a/src/HaskellCI/Config/History.hs +++ b/src/HaskellCI/Config/History.hs @@ -36,8 +36,9 @@ configHistory = , ver 0 19 20240708 := \cfg -> cfg & field @"cfgGhcupVersion" .~ C.mkVersion [0,1,30,0] , ver 0 19 20241111 := \cfg -> cfg - & field @"cfgGhcupJobs" .~ C.intersectVersionRanges ghcupNormalRange (invertVersionRange (C.withinVersion (C.mkVersion [9,8,3]))) - & field @"cfgGhcupVanillaJobs" .~ C.withinVersion (C.mkVersion [9,8,3]) + & field @"cfgGhcupJobs" .~ C.intersectVersionRanges (C.intersectVersionRanges ghcupNormalRange (C.earlierVersion (C.mkVersion [9,12,0]))) (invertVersionRange (C.withinVersion (C.mkVersion [9,8,3]))) + & field @"cfgGhcupVanillaJobs" .~ C.withinVersion (C.mkVersion [9,8,3]) + & field @"cfgGhcupPrereleaseJobs" .~ C.orLaterVersion (C.mkVersion [9,12,0]) ] where ver x y z = [x, y, z] diff --git a/src/HaskellCI/GitHub.hs b/src/HaskellCI/GitHub.hs index 27d553dc..3bef7815 100644 --- a/src/HaskellCI/GitHub.hs +++ b/src/HaskellCI/GitHub.hs @@ -177,7 +177,7 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do ghcupGhcEnv whenWithinGhcRange cfgGhcupVanillaJobs $ githubRunIf' "Install GHC (GHCup vanilla)" "matrix.setup-method == 'ghcup-vanilla'" envEnv $ do - sh $ "\"$HOME/.ghcup/bin/ghcup\" install ghc \"$HCVER\" || (cat \"$HOME\"/.ghcup/logs/*.* && false)" + sh $ "\"$HOME/.ghcup/bin/ghcup\" -s https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-vanilla-0.0.8.yaml install ghc \"$HCVER\" || (cat \"$HOME\"/.ghcup/logs/*.* && false)" ghcupGhcEnv whenWithinGhcRange cfgGhcupPrereleaseJobs $ githubRunIf' "Install GHC (GHCup prerelease)" "matrix.setup-method == 'ghcup-prerelease'" envEnv $ do @@ -528,19 +528,27 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do , ghjServices = mconcat [ Map.singleton "postgres" postgresService | cfgPostgres ] , ghjTimeout = max 10 cfgTimeoutMinutes - , ghjMatrix = - [ GitHubMatrixEntry + , ghjMatrix = concat $ + [ [ GitHubMatrixEntry { ghmeCompiler = translateCompilerVersion $ compiler , ghmeAllowFailure = isGHCHead compiler || maybeGHC False (`C.withinRange` cfgAllowFailures) compiler - , ghmeSetupMethod = if isGHCUP compiler then GHCUP else HVRPPA + , ghmeSetupMethod = sp } + | sp <- [GHCUP, GHCUPvanilla, GHCUPprerelease, HVRPPA] + , compilerWithinGhcRange compiler $ case sp of + GHCUP -> cfgGhcupJobs + GHCUPvanilla -> cfgGhcupVanillaJobs + GHCUPprerelease -> cfgGhcupPrereleaseJobs + HVRPPA -> cfgHvrPpaJobs + ] | compiler <- reverse $ toList linuxVersions , compiler /= GHCHead -- TODO: Make this work -- https://github.com/haskell-CI/haskell-ci/issues/458 ] }) + unless (null cfgIrcChannels) $ ircJob actionName mainJobName projectName config gitconfig } diff --git a/src/HaskellCI/GitHub/Yaml.hs b/src/HaskellCI/GitHub/Yaml.hs index 5703930c..a7be74c1 100644 --- a/src/HaskellCI/GitHub/Yaml.hs +++ b/src/HaskellCI/GitHub/Yaml.hs @@ -42,7 +42,7 @@ data GitHubJob = GitHubJob } deriving (Show) -data SetupMethod = HVRPPA | GHCUP +data SetupMethod = HVRPPA | GHCUP | GHCUPvanilla | GHCUPprerelease deriving Show data GitHubMatrixEntry = GitHubMatrixEntry @@ -130,8 +130,10 @@ instance ToYaml GitHubJob where item $ "steps" ~> ylistFilt [] (map toYaml $ filter notEmptyStep ghjSteps) instance ToYaml SetupMethod where - toYaml HVRPPA = "hvr-ppa" - toYaml GHCUP = "ghcup" + toYaml HVRPPA = "hvr-ppa" + toYaml GHCUP = "ghcup" + toYaml GHCUPvanilla = "ghcup-vanilla" + toYaml GHCUPprerelease = "ghcup-prerelease" instance ToYaml GitHubMatrixEntry where toYaml GitHubMatrixEntry {..} = ykeyValuesFilt []