From 4c76c469bdb6780f111fca0fb144753189980ea2 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Mon, 1 Jul 2024 19:57:37 +0300 Subject: [PATCH] history --- src/HaskellCI/Cabal.hs | 3 --- src/HaskellCI/Config/History.hs | 14 +++++++++++--- src/HaskellCI/Config/Initial.hs | 8 +++++--- src/HaskellCI/Config/Ubuntu.hs | 11 ++++++++++- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/HaskellCI/Cabal.hs b/src/HaskellCI/Cabal.hs index bfc0a334..f480e97c 100644 --- a/src/HaskellCI/Cabal.hs +++ b/src/HaskellCI/Cabal.hs @@ -4,9 +4,6 @@ import HaskellCI.Prelude import qualified Distribution.Version as C -defaultCabalInstallVersion :: Maybe Version -defaultCabalInstallVersion = Just (C.mkVersion [3,10]) - -- | Convert cabal-install version to a version ghcup understands. cabalGhcupVersion :: Version -> Version cabalGhcupVersion ver = case C.versionNumbers ver of diff --git a/src/HaskellCI/Config/History.hs b/src/HaskellCI/Config/History.hs index 49c41468..3999c73d 100644 --- a/src/HaskellCI/Config/History.hs +++ b/src/HaskellCI/Config/History.hs @@ -7,11 +7,19 @@ import HaskellCI.Config.Type import HaskellCI.Config.Ubuntu import HaskellCI.Prelude -history :: [(Int, Config -> Config)] +history :: [([Int], Config -> Config)] history = - [ 20241020 := \cfg -> cfg + [ ver 0 19 20240414 := \cfg -> cfg + -- https://github.com/haskell-CI/haskell-ci/pull/713/files (docspec) + , ver 0 19 20240420 := \cfg -> cfg & field @"cfgUbuntu" .~ Jammy + , ver 0 19 20240513 := \cfg -> cfg + -- defaultHeadHackage = C.orLaterVersion (C.mkVersion [9,11]) ] + where + ver x y z = [x, y, z] defaultConfig :: Config -defaultConfig = initialConfig +defaultConfig = foldl' f initialConfig history + where + f !cfg (_, g) = g cfg diff --git a/src/HaskellCI/Config/Initial.hs b/src/HaskellCI/Config/Initial.hs index 2aad0c0b..eb425979 100644 --- a/src/HaskellCI/Config/Initial.hs +++ b/src/HaskellCI/Config/Initial.hs @@ -4,7 +4,7 @@ module HaskellCI.Config.Initial where import HaskellCI.Prelude -import qualified Distribution.Types.VersionRange as C +import qualified Distribution.Version as C import HaskellCI.Config.Components import HaskellCI.Config.CopyFields @@ -17,11 +17,13 @@ import HaskellCI.Ghcup import HaskellCI.HeadHackage import HaskellCI.TestedWith +-- | This is an "initial" configuration. It's meant to stay immutable. +-- All changes to defaults should be done in History. initialConfig :: Config initialConfig = Config - { cfgCabalInstallVersion = Nothing + { cfgCabalInstallVersion = Just (C.mkVersion [3,10]) , cfgJobs = Nothing - , cfgUbuntu = Focal -- change to xenial + , cfgUbuntu = Bionic , cfgTestedWith = TestedWithUniform , cfgEnabledJobs = anyVersion , cfgCopyFields = CopyFieldsSome diff --git a/src/HaskellCI/Config/Ubuntu.hs b/src/HaskellCI/Config/Ubuntu.hs index abef3c31..86271e19 100644 --- a/src/HaskellCI/Config/Ubuntu.hs +++ b/src/HaskellCI/Config/Ubuntu.hs @@ -6,13 +6,20 @@ import qualified Distribution.Parsec as C import qualified Distribution.Pretty as C import qualified Text.PrettyPrint as PP -data Ubuntu = Focal | Jammy | Noble +data Ubuntu + = Xenial + | Bionic + | Focal + | Jammy + | Noble deriving (Eq, Ord, Show, Enum, Bounded) instance C.Parsec Ubuntu where parsec = do t <- C.parsecToken case t of + "xenial" -> return Xenial + "bionic" -> return Bionic "focal" -> return Focal "jammy" -> return Jammy "noble" -> return Noble @@ -22,6 +29,8 @@ instance C.Pretty Ubuntu where pretty = PP.text . showUbuntu showUbuntu :: Ubuntu -> String +showUbuntu Xenial = "xenial" +showUbuntu Bionic = "bionic" showUbuntu Focal = "focal" showUbuntu Jammy = "jammy" showUbuntu Noble = "noble"