Skip to content

Commit 1708c1c

Browse files
committed
Make (GHC) version mapping configurable
1 parent 6d1a5ef commit 1708c1c

File tree

18 files changed

+66
-39
lines changed

18 files changed

+66
-39
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ jobs:
181181
- name: cache (tools)
182182
uses: actions/cache/restore@v4
183183
with:
184-
key: ${{ runner.os }}-${{ matrix.compiler }}-tools-1e9b3b69
184+
key: ${{ runner.os }}-${{ matrix.compiler }}-tools-ff63ec70
185185
path: ~/.haskell-ci-tools
186186
- name: install cabal-plan
187187
run: |
@@ -209,7 +209,7 @@ jobs:
209209
if: always()
210210
uses: actions/cache/save@v4
211211
with:
212-
key: ${{ runner.os }}-${{ matrix.compiler }}-tools-1e9b3b69
212+
key: ${{ runner.os }}-${{ matrix.compiler }}-tools-ff63ec70
213213
path: ~/.haskell-ci-tools
214214
- name: checkout
215215
uses: actions/checkout@v4

cabal.haskell-ci

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,6 @@ raw-project
145145
keep-going: False
146146
package bytestring
147147
tests: False
148+
149+
-- Mapping of GHC versions (used for prereleases)
150+
version-mapping: 9.12.1:9.12.0.20241114

fixtures/all-versions.github

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ jobs:
2828
strategy:
2929
matrix:
3030
include:
31-
- compiler: ghc-9.12.0.20241031
31+
- compiler: ghc-9.12.0.20241114
3232
compilerKind: ghc
33-
compilerVersion: 9.12.0.20241031
33+
compilerVersion: 9.12.0.20241114
3434
setup-method: ghcup-prerelease
3535
allow-failure: false
3636
- compiler: ghc-9.10.1

fixtures/doctest-version.github

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ jobs:
2828
strategy:
2929
matrix:
3030
include:
31-
- compiler: ghc-9.12.0.20241031
31+
- compiler: ghc-9.12.0.20241114
3232
compilerKind: ghc
33-
compilerVersion: 9.12.0.20241031
33+
compilerVersion: 9.12.0.20241114
3434
setup-method: ghcup-prerelease
3535
allow-failure: false
3636
- compiler: ghc-9.10.1

fixtures/doctest.github

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ jobs:
2828
strategy:
2929
matrix:
3030
include:
31-
- compiler: ghc-9.12.0.20241031
31+
- compiler: ghc-9.12.0.20241114
3232
compilerKind: ghc
33-
compilerVersion: 9.12.0.20241031
33+
compilerVersion: 9.12.0.20241114
3434
setup-method: ghcup-prerelease
3535
allow-failure: false
3636
- compiler: ghc-9.10.1

fixtures/enabled-jobs.github

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ jobs:
2828
strategy:
2929
matrix:
3030
include:
31-
- compiler: ghc-9.12.0.20241031
31+
- compiler: ghc-9.12.0.20241114
3232
compilerKind: ghc
33-
compilerVersion: 9.12.0.20241031
33+
compilerVersion: 9.12.0.20241114
3434
setup-method: ghcup-prerelease
3535
allow-failure: false
3636
- compiler: ghc-9.10.1

src/HaskellCI.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,6 @@ configFromCabalFile cfg (cabalFile, gpd) = do
549549
lastStableGhcVers
550550
= nubBy ((==) `on` ghcMajVer)
551551
$ sortBy (flip compare)
552-
$ filter (not . isPreviewGHC . GHC)
553552
$ knownGhcVersions
554553

555554
isTwoDigitGhcVersion :: VersionRange -> Maybe Version

src/HaskellCI/Auxiliary.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ data Auxiliary = Auxiliary
4646
, extraCabalProjectFields :: FilePath -> [C.PrettyField ()]
4747
, testShowDetails :: String
4848
, anyJobUsesHeadHackage :: Bool
49-
, anyJobUsesPreviewGHC :: Bool
5049
, runHaddock :: Bool
5150
, haddockFlags :: String
5251
}
@@ -139,9 +138,6 @@ auxiliary Config {..} prj JobVersions {..} = Auxiliary {..}
139138
anyJobUsesHeadHackage :: Bool
140139
anyJobUsesHeadHackage = not $ null headGhcVers
141140

142-
anyJobUsesPreviewGHC :: Bool
143-
anyJobUsesPreviewGHC = not $ null $ S.filter isPreviewGHC allVersions
144-
145141
pkgNameDirVariable' :: String -> String
146142
pkgNameDirVariable' n = "PKGDIR_" ++ map f n where
147143
f '-' = '_'

src/HaskellCI/Compiler.hs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ module HaskellCI.Compiler (
99
-- ** Predicates
1010
isGHCHead,
1111
usesHeadHackage,
12-
isPreviewGHC,
1312
-- ** Selectors
1413
compilerKind,
1514
compilerVersion,
@@ -31,8 +30,7 @@ module HaskellCI.Compiler (
3130
previewCabal,
3231
-- * Misc
3332
ghcMajVer,
34-
translateCompilerVersion,
35-
) where
33+
) where
3634

3735
import HaskellCI.Prelude
3836

@@ -189,9 +187,6 @@ dispGhcVersionShort (GHCJS v) = "ghcjs-" ++ C.prettyShow v
189187
dispCabalVersion :: Maybe Version -> String
190188
dispCabalVersion = maybe "head" C.prettyShow
191189

192-
ghcAlpha :: Maybe (Version, Version)
193-
ghcAlpha = Just (mkVersion [9,12,1], mkVersion [9,12,0,20241031])
194-
195190
-- | GHC HEAD, and versions specified by head.hackage option.
196191
usesHeadHackage
197192
:: VersionRange -- ^ head.hackage range
@@ -201,11 +196,6 @@ usesHeadHackage _vr GHCHead = True
201196
usesHeadHackage vr (GHC v) = withinRange v vr
202197
usesHeadHackage _vr (GHCJS _) = False
203198

204-
isPreviewGHC :: CompilerVersion -> Bool
205-
isPreviewGHC GHCHead = True
206-
isPreviewGHC (GHC v) = maybe False (\(v', _) -> v /= v') ghcAlpha
207-
isPreviewGHC (GHCJS _) = False
208-
209199
isGHCHead :: CompilerVersion -> Bool
210200
isGHCHead GHCHead = True
211201
isGHCHead _ = False
@@ -222,13 +212,3 @@ ghcMajVer :: Version -> (Int,Int)
222212
ghcMajVer v
223213
| x:y:_ <- versionNumbers v = (x,y)
224214
| otherwise = error $ "panic: ghcMajVer called with " ++ show v
225-
226-
-- | Map compiler version to one available to download.
227-
--
228-
-- This way we can map e.g. 9.4.1 to 9.4.0.20220501 i.e. a prerelease.
229-
translateCompilerVersion :: CompilerVersion -> CompilerVersion
230-
translateCompilerVersion (GHC v)
231-
| Just (u, w) <- ghcAlpha
232-
, v == u
233-
= GHC w
234-
translateCompilerVersion v = v

src/HaskellCI/Config/Grammar.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ configGrammar = Config
173173
^^^ help "The name of GitHub Action"
174174
<*> optionalFieldDef "timeout-minutes" (field @"cfgTimeoutMinutes") defaultConfig
175175
^^^ metahelp "MINUTES" "The maximum number of minutes to let a job run"
176+
<*> optionalFieldDefAla "version-mapping" (alaMap' C.NoCommaFSep VersionPair) (field @"cfgVersionMapping") defaultConfig
177+
^^^ metahelp "VERSIONS" "Mapping of GHC versions (used for prereleases)"
176178

177179
-------------------------------------------------------------------------------
178180
-- Env

0 commit comments

Comments
 (0)