Skip to content

Commit 7fddc85

Browse files
committed
Add GHCup version translations
1 parent fb22818 commit 7fddc85

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

src/HaskellCI/Ghcup.hs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,15 @@ import qualified Distribution.Version as C
66

77
initialGhcupVersion :: Version
88
initialGhcupVersion = C.mkVersion [0,1,20,0]
9+
10+
-- https://github.com/haskell/cabal/issues/10836#issuecomment-2757855218
11+
-- if you interface with GHCup, you SHOULD be able to deal with non-PVP versions.
12+
--
13+
-- Perfectly, we'd have these mappings configurable;
14+
-- but for now they are hardcoded.
15+
--
16+
translateGhcVersion :: Version -> String
17+
translateGhcVersion = prettyShow
18+
19+
translateCabalVersion :: Version -> String
20+
translateCabalVersion = prettyShow

src/HaskellCI/GitHub.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import HaskellCI.Config.Jobs
4040
import HaskellCI.Config.PackageScope
4141
import HaskellCI.Config.Ubuntu
4242
import HaskellCI.Config.Validity
43+
import HaskellCI.Ghcup
4344
import HaskellCI.GitConfig
4445
import HaskellCI.GitHub.Yaml
4546
import HaskellCI.HeadHackage
@@ -561,7 +562,7 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do
561562
mainJobName = "linux"
562563

563564
ubuntuVer = showUbuntu cfgUbuntu
564-
cabalFullVer = dispCabalVersion cfgCabalInstallVersion
565+
cabalFullVer = maybe "head" translateCabalVersion cfgCabalInstallVersion
565566

566567
Auxiliary {..} = auxiliary config prj jobs
567568

src/HaskellCI/GitHub/Yaml.hs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import HaskellCI.Prelude
88
import qualified Data.Map.Strict as M
99

1010
import HaskellCI.Compiler
11+
import HaskellCI.Ghcup
1112
import HaskellCI.List
1213
import HaskellCI.SetupMethod
1314
import HaskellCI.Sh
@@ -129,12 +130,20 @@ instance ToYaml GitHubJob where
129130

130131
instance ToYaml GitHubMatrixEntry where
131132
toYaml GitHubMatrixEntry {..} = ykeyValuesFilt []
132-
[ "compiler" ~> fromString (dispGhcVersion ghmeCompiler)
133+
[ "compiler" ~> fromString compiler
133134
, "compilerKind" ~> fromString (compilerKind ghmeCompiler)
134135
, "compilerVersion" ~> fromString (compilerVersion ghmeCompiler)
135136
, "setup-method" ~> toYaml ghmeSetupMethod
136137
, "allow-failure" ~> toYaml ghmeAllowFailure
137138
]
139+
where
140+
compiler
141+
| GHCUP <- ghmeSetupMethod
142+
, GHC v <- ghmeCompiler
143+
= "ghc-" ++ translateGhcVersion v
144+
145+
| otherwise
146+
= dispGhcVersion ghmeCompiler
138147

139148
instance ToYaml GitHubStep where
140149
toYaml GitHubStep {..} = ykeyValuesFilt [] $ buildList $ do

0 commit comments

Comments
 (0)