Skip to content

Commit

Permalink
integrate ghc-9.2.1 builds
Browse files Browse the repository at this point in the history
  • Loading branch information
shayne-fletcher committed Nov 14, 2021
1 parent 8a652af commit 35360b0
Show file tree
Hide file tree
Showing 5 changed files with 203 additions and 137 deletions.
171 changes: 83 additions & 88 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,105 +41,99 @@ strategy:
# +---------+-----------------+------------+
# | OS | ghc-lib flavour | GHC |
# +=========+=================+============+
# | linux | ghc-master | ghc-9.0.1 |
# | macOS | ghc-master | ghc-9.0.1 |
# | linux | ghc-master | ghc-8.10.4 |
# | macOS | ghc-master | ghc-8.10.4 |
# | windows | ghc-master | ghc-8.10.4 |
# | linux | ghc-master | ghc-9.2.1 |
# | macOS | ghc-master | ghc-9.2.1 |
# +---------+-----------------+------------+
linux-ghc-master-9.0.1:
image: "ubuntu-latest"
mode: "--ghc-flavor ghc-master"
resolver: "ghc-9.0.1"
stack-yaml: "stack-exact.yaml"
linux-ghc-master-8.10.4:
image: "ubuntu-latest"
mode: "--ghc-flavor ghc-master"
stack-yaml: "stack.yaml"
resolver: "nightly-2021-03-07"
mac-ghc-master-9.0.1:
image: "macOS-latest"
mode: "--ghc-flavor ghc-master"
resolver: "ghc-9.0.1"
stack-yaml: "stack-exact.yaml"
mac-ghc-master-8.10.4:
image: "macOS-latest"
mode: "--ghc-flavor ghc-master"
resolver: "nightly-2021-03-07"
stack-yaml: "stack.yaml"
windows-ghc-master-8.10.4:
# linux-ghc-master-9.2.1:
# image: "ubuntu-latest"
# mode: "--ghc-flavor ghc-master"
# resolver: "ghc-9.2.1"
# stack-yaml: "stack-exact.yaml"
# mac-ghc-master-9.2.1:
# image: "macOS-latest"
# mode: "--ghc-flavor ghc-master"
# resolver: "ghc-9.2.1"
# stack-yaml: "stack-exact.yaml"
windows-ghc-master-9.2.1:
image: "windows-latest"
mode: "--ghc-flavor ghc-master"
resolver: "nightly-2021-03-07"
stack-yaml: "stack.yaml"

# +---------+-----------------+------------+
# | OS | ghc-lib flavour | GHC |
# +=========+=================+============+
# | linux | ghc-9.2.1 | ghc-9.0.1 |
# | macOS | ghc-9.2.1 | ghc-8.10.6 |
# +---------+-----------------+------------+
linux-ghc-9.2.1-9.0.1:
image: "ubuntu-latest"
mode: "--ghc-flavor ghc-9.2.1"
resolver: "ghc-9.0.1"
stack-yaml: "stack-exact.yaml"
mac-ghc-9.2.1-8.10.6:
image: "macOS-latest"
mode: "--ghc-flavor ghc-9.2.1"
resolver: "ghc-8.10.6"
resolver: "ghc-9.2.1"
stack-yaml: "stack-exact.yaml"

# +---------+-----------------+------------+
# | OS | ghc-lib flavour | GHC |
# +=========+=================+============+
# | linux | ghc-9.0.1 | ghc-8.10.6 |
# | macOS | ghc-9.0.1 | ghc-8.10.6 |
# | linux | ghc-master | ghc-9.0.1 |
# | macOS | ghc-master | ghc-9.0.1 |
# | linux | ghc-master | ghc-8.10.7 |
# | macOS | ghc-master | ghc-8.10.7 |
# | windows | ghc-master | ghc-8.10.7 |
# +---------+-----------------+------------+
linux-ghc-9.0.1-8.10.6:
image: "ubuntu-latest"
mode: "--ghc-flavor ghc-9.0.1"
resolver: "ghc-8.10.6"
stack-yaml: "stack-exact.yaml"
mac-ghc-9.0.1-8.10.6:
image: "macOS-latest"
mode: "--ghc-flavor ghc-9.0.1"
resolver: "ghc-8.10.6"
stack-yaml: "stack-exact.yaml"
# linux-ghc-master-9.0.1:
# image: "ubuntu-latest"
# mode: "--ghc-flavor ghc-master"
# resolver: "nightly-2021-11-14"
# stack-yaml: "stack-901.yaml"
# linux-ghc-master-8.10.7:
# image: "ubuntu-latest"
# mode: "--ghc-flavor ghc-master"
# resolver: "lts-18.16"
# stack-yaml: "stack.yaml"
# mac-ghc-master-9.0.1:
# image: "macOS-latest"
# mode: "--ghc-flavor ghc-master"
# resolver: "nightly-2021-11-14"
# stack-yaml: "stack-901.yaml"
# mac-ghc-master-8.10.7:
# image: "macOS-latest"
# mode: "--ghc-flavor ghc-master"
# resolver: "lts-18.16"
# stack-yaml: "stack.yaml"
# windows-ghc-master-8.10.7:
# image: "windows-latest"
# mode: "--ghc-flavor ghc-master"
# resolver: "lts-18.16"
# stack-yaml: "stack.yaml"

# +---------+-----------------+------------+
# | OS | ghc-lib flavour | GHC |
# +=========+=================+============+
# | linux | ghc-8.10.6 | ghc-8.8.4 |
# +---------+-----------------+------------+
linux-ghc-8.10.6-8.8.4:
image: "ubuntu-latest"
mode: "--ghc-flavor ghc-8.10.6"
resolver: "nightly-2020-03-14"
stack-yaml: "stack.yaml"
# # +---------+-----------------+------------+
# # | OS | ghc-lib flavour | GHC |
# # +=========+=================+============+
# # | linux | ghc-9.2.1 | ghc-9.0.1 |
# # | macOS | ghc-9.2.1 | ghc-8.10.7 |
# # +---------+-----------------+------------+
# linux-ghc-9.2.1-9.0.1:
# image: "ubuntu-latest"
# mode: "--ghc-flavor ghc-9.2.1"
# resolver: "nightly-2021-11-14"
# stack-yaml: "stack-901.yaml"
# mac-ghc-9.2.1-8.10.7:
# image: "macOS-latest"
# mode: "--ghc-flavor ghc-9.2.1"
# resolver: "lts-18.16"
# stack-yaml: "stack.yaml"

# +---------+-----------------+------------+
# | OS | ghc-lib flavour | GHC |
# +=========+=================+============+
# | linux | da-ghc-8.8.1 | ghc-8.8.1 |
# | windows | da-ghc-8.8.1 | ghc-8.8.1 |
# | macOS | da-ghc-8.8.1 | ghc-8.8.1 |
# +---------+-----------------+------------+
linux-da-ghc-8.8.1-8.8.1:
image: "ubuntu-latest"
mode: "--da"
resolver: "nightly-2020-01-08"
stack-yaml: "stack.yaml"
windows-da-ghc-8.8.1-8.8.1:
image: "windows-latest"
mode: "--da"
resolver: "nightly-2020-01-08"
stack-yaml: "stack.yaml"
mac-da-ghc-8.8.1-8.8.1:
image: "macOS-latest"
mode: "--da"
resolver: "nightly-2020-01-08"
stack-yaml: "stack.yaml"
# # +---------+-----------------+------------+
# # | OS | ghc-lib flavour | GHC |
# # +=========+=================+============+
# # | linux | da-ghc-8.8.1 | ghc-8.8.1 |
# # | windows | da-ghc-8.8.1 | ghc-8.8.1 |
# # | macOS | da-ghc-8.8.1 | ghc-8.8.1 |
# # +---------+-----------------+------------+
# linux-da-ghc-8.8.1-8.8.1:
# image: "ubuntu-latest"
# mode: "--da"
# resolver: "nightly-2020-01-08"
# stack-yaml: "stack.yaml"
# windows-da-ghc-8.8.1-8.8.1:
# image: "windows-latest"
# mode: "--da"
# resolver: "nightly-2020-01-08"
# stack-yaml: "stack.yaml"
# mac-da-ghc-8.8.1-8.8.1:
# image: "macOS-latest"
# mode: "--da"
# resolver: "nightly-2020-01-08"
# stack-yaml: "stack.yaml"

pool: {vmImage: '$(image)'}

Expand All @@ -160,5 +154,6 @@ steps:
curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/travis.sh | sh -s examples/mini-hlint/test/Main.hs
curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/travis.sh | sh -s examples/mini-compile/src
stack setup --stack-yaml $(stack-yaml) --resolver $(resolver) > /dev/null
stack install --stack-yaml $(stack-yaml) --resolver $(resolver) alex happy > /dev/null
stack exec --stack-yaml $(stack-yaml) --resolver $(resolver) --package extra --package optparse-applicative ghc -- -package extra -package optparse-applicative -Wall -Wno-name-shadowing -Werror -c CI.hs
stack runhaskell --stack-yaml $(stack-yaml) --resolver $(resolver) --package extra --package optparse-applicative -- CI.hs $(mode) --stack-yaml $(stack-yaml) --resolver $(resolver)
62 changes: 41 additions & 21 deletions examples/mini-hlint/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,44 @@ runTest flavor f =
((isNothing . stripInfix "MiniHlintTest_non_fatal_error.hs" $ f) || (flavor >= Ghc8101))

goldenTests :: StackYaml -> Resolver -> GhcFlavor -> [FilePath] -> TestTree
goldenTests stackYaml resolver (GhcFlavor ghcFlavor) hsFiles =
testGroup "mini-hlint tests"
[ goldenVsString
testName
expectFile
genStringAction
| hsFile <- filter (runTest ghcFlavor) hsFiles
, let testName = hsFile
, let expectFile =
let f = case ghcFlavor of
GhcMaster ->
case takeFileName hsFile of
"MiniHlintTest_fatal_error.hs" ->
takeDirectory hsFile </> "MiniHlintTest_fatal_error-ghc-master.hs"
"MiniHlintTest_non_fatal_error.hs" ->
takeDirectory hsFile </> "MiniHlintTest_non_fatal_error-ghc-master.hs"
_ -> hsFile
_ -> hsFile
in replaceExtension f $ (if isWindows then ".windows" else "") ++ ".expect"
, let genStringAction = stack stackYaml resolver $ "--no-terminal exec -- mini-hlint " ++ hsFile
]
goldenTests stackYaml@(StackYaml yaml) stackResolver@(Resolver resolver) (GhcFlavor ghcFlavor) hsFiles =
-- Note: You'll get very confused if you load expect files into your
-- emacs where you automatically delete whitespace at end of line on
-- save In this case, disable the 'delete-trailing-whitespace' save
-- hook and set the local buffer variable 'show-trailing-whitespace'
-- to 't'. E.g. at this time on master, there's this example: 'Found
-- `qualified' in postpositive position. '
case (yaml, resolver) of
-- Running ghc-9.2.1 with stack 2.7.3 produces
-- "Stack has not been tested with GHC versions above 9.0, and using 9.2.1, this may fail"
-- "Stack has not been tested with Cabal versions above 3.4, but version 3.6.0.0 was found, this may fail"
-- on stderr which being unexpected, causes the golden tests to fail.
--
-- I judge it more work than it's worth to put in expect files
-- configured for this case since the next stack release will fix
-- it. So, for now just don't run this test.
(Just "../../stack-exact.yaml", Nothing) -> -- implicit resolver 'ghc-9.2.1'
testGroup "mini-hlint tests" []
(_, Just "ghc-9.2.1") -> -- explicit resolver 'ghc-9.2.1'
testGroup "mini-hlint tests" []
(_, _) ->
testGroup "mini-hlint tests"
[ goldenVsString
testName
expectFile
genStringAction
| hsFile <- filter (runTest ghcFlavor) hsFiles
, let testName = hsFile
, let expectFile =
let f = case ghcFlavor of
GhcMaster ->
case takeFileName hsFile of
"MiniHlintTest_fatal_error.hs" ->
takeDirectory hsFile </> "MiniHlintTest_fatal_error-ghc-master.hs"
"MiniHlintTest_non_fatal_error.hs" ->
takeDirectory hsFile </> "MiniHlintTest_non_fatal_error-ghc-master.hs"
_ -> hsFile
_ -> hsFile
in replaceExtension f $ (if isWindows then ".windows" else "") ++ ".expect"
, let genStringAction = stack stackYaml stackResolver $ "--no-terminal exec -- mini-hlint " ++ hsFile
]
17 changes: 16 additions & 1 deletion ghc-lib-gen/src/Ghclibgen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
-- its affiliates. All rights reserved. SPDX-License-Identifier:
-- (Apache-2.0 OR BSD-3-Clause)

{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE LambdaCase #-}
#if __GLASGOW_HASKELL__ >= 902
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
#endif

module Ghclibgen (
applyPatchHeapClosures
Expand Down Expand Up @@ -43,6 +47,9 @@ import qualified Data.Set as Set

import qualified Data.Text as T
import Data.Aeson.Types(parse, Result(..))
#if MIN_VERSION_aeson(2, 0, 2)
import Data.Aeson.KeyMap(toHashMap)
#endif
import qualified Data.Yaml as Y
import Data.Yaml (ToJSON(..), (.:?), (.!=))
import qualified Data.HashMap.Strict as HMS
Expand Down Expand Up @@ -845,7 +852,15 @@ applyPatchHadrianStackYaml ghcFlavor = do
case parse (\cfg -> cfg .:? "ghc-options" .!= HMS.empty) config of
Success os -> os :: HMS.HashMap T.Text Y.Value
Error msg -> error msg
let config' = HMS.insert "extra-deps" (toJSON deps) (HMS.insert "ghc-options" (toJSON opts) config)
let config' =
HMS.insert "extra-deps" (toJSON deps)
(HMS.insert "ghc-options" (toJSON opts)
#if !MIN_VERSION_aeson(2, 0, 2)
config
#else
(toHashMap config)
#endif
)
Y.encodeFile hadrianStackYaml config'

-- | Data type representing an approximately parsed Cabal file.
Expand Down
18 changes: 18 additions & 0 deletions stack-901.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This is 'stack.yaml' but with an explicit version for happy

# happy-1.21.0 has crept into the ghc-9.0.1 resolvers but ghc-9.2.1
# (at least and master for now), do not admit building with this
# version (probibted by .configure).

resolver: nightly-2021-11-14 # ghc-9.0.1

ghc-options:
# try and speed up recompilation on the CI server
"$everything": -O0 -j

extra-deps:
- happy-1.20.0 # override happy-1.21.0 (can't build ghc-9.2 or head)

# Packages MUST go at the end, since we append to it during the CI.hs script
packages:
- .
Loading

0 comments on commit 35360b0

Please sign in to comment.