Skip to content

Commit

Permalink
Upgrade GHC to 8.8.4 (#1204)
Browse files Browse the repository at this point in the history
* Bump alpine to 3.12 for GHC

* Install GHC using ghcup

* Add ncurses-dev to prebuilder

* Parametrize builder image using the same way as others

* Upgrade to LTS 16.14, GHC 8.8.4

* Use upstream master branch of HaskelNet-SSL

* Use merge-request branch of wai-predicates

* Use merge-request branch of redis-io

* Upgrade saml2-web-sso to support GHC 8.8

* Upgrade our fork of bloodhound to support GHC 8.8

* Replace 'mapM' with 'sequence $ map ...' in bonanza tests

Bug report in GHC: https://gitlab.haskell.org/ghc/ghc/-/issues/18730

* Tidy up stack.yaml
  • Loading branch information
akshaymankar authored Sep 28, 2020
1 parent 86c59f9 commit fab4983
Show file tree
Hide file tree
Showing 111 changed files with 329 additions and 336 deletions.
7 changes: 3 additions & 4 deletions build/alpine/Dockerfile.builder
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Requires docker >= 17.05 (requires support for multi-stage builds)

ARG prebuilder_tag=latest
ARG prebuilder=quay.io/wire/alpine-prebuilder

FROM ${prebuilder}:${prebuilder_tag}
FROM ${prebuilder}
WORKDIR /
# Download stack indices and compile/cache dependencies to speed up subsequent
Expand All @@ -13,6 +11,7 @@ WORKDIR /
# a Haddock segfault. See https://github.com/haskell/haddock/issues/928

ARG wire_server_branch=develop
ARG THREADS=4
RUN set -x && \
echo ${wire_server_branch} && \
git clone -b ${wire_server_branch} https://github.com/wireapp/wire-server.git && \
Expand All @@ -21,7 +20,7 @@ RUN set -x && \
echo "allow-different-user: true" >> /root/.stack/config.yaml && \
stack build --haddock --dependencies-only haskell-src-exts && \
stack build --haddock --no-haddock-hyperlink-source haskell-src-exts && \
stack build --pedantic --haddock --test --no-run-tests --bench --no-run-benchmarks --dependencies-only && \
stack build --pedantic --haddock --test --no-run-tests --bench --no-run-benchmarks --dependencies-only -j${THREADS} && \
stack install ormolu && \
cd / && \
# we run the build only to cache the built source in /root/.stack, we can remove the source code itself
Expand Down
4 changes: 2 additions & 2 deletions build/alpine/Dockerfile.deps
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Requires docker >= 17.05 (requires support for multi-stage builds)

FROM alpine:3.11 as cryptobox-builder
FROM alpine:3.12 as cryptobox-builder

# compile cryptobox-c
RUN apk add --no-cache cargo file libsodium-dev git && \
Expand All @@ -11,7 +11,7 @@ RUN apk add --no-cache cargo file libsodium-dev git && \
cargo build --release

# Minimal dependencies for alpine-compiled, dynamically linked wire-server Haskell services
FROM alpine:3.11
FROM alpine:3.12

COPY --from=cryptobox-builder /tmp/cryptobox-c/target/release/libcryptobox.so /usr/lib

Expand Down
18 changes: 13 additions & 5 deletions build/alpine/Dockerfile.prebuilder
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Requires docker >= 17.05 (requires support for multi-stage builds)

FROM alpine:3.11 as cryptobox-builder
FROM alpine:3.12 as cryptobox-builder

# compile cryptobox-c
RUN apk add --no-cache cargo file libsodium-dev git && \
Expand All @@ -10,7 +10,7 @@ RUN apk add --no-cache cargo file libsodium-dev git && \
export SODIUM_USE_PKG_CONFIG=1 && \
cargo build --release

FROM alpine:3.11
FROM alpine:3.12

# install cryptobox-c in the new container
COPY --from=cryptobox-builder /tmp/cryptobox-c/target/release/libcryptobox.so /usr/lib/libcryptobox.so
Expand All @@ -22,9 +22,10 @@ RUN apk add --no-cache \
ca-certificates \
linux-headers \
zlib-dev \
ghc \
ghc-dev \
ghc-doc \
perl \
gmp-dev \
libffi-dev \
make \
libsodium-dev \
openssl-dev \
protobuf \
Expand All @@ -37,10 +38,17 @@ RUN apk add --no-cache \
libxml2-dev \
git \
ncurses \
ncurses-dev \
sed

# get static version of Haskell Stack and use system ghc by default
ARG STACK_ALPINE_VERSION=2.3.1
RUN curl -sSfL https://github.com/commercialhaskell/stack/releases/download/v${STACK_ALPINE_VERSION}/stack-${STACK_ALPINE_VERSION}-linux-x86_64-static.tar.gz \
| tar --wildcards -C /usr/local/bin --strip-components=1 -xzvf - '*/stack' && chmod 755 /usr/local/bin/stack && \
stack config set system-ghc --global true

ARG GHC_VERSION=8.8.4
RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org \
| BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=${GHC_VERSION} sh

ENV PATH=/root/.ghcup/bin:${PATH}
1 change: 0 additions & 1 deletion libs/api-bot/src/Network/Wire/Bot/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ import Control.Concurrent.Async
import Control.Concurrent.STM (retry)
import Control.Monad.Base
import Control.Monad.Catch hiding (try)
import Control.Monad.Fail (MonadFail)
import Control.Monad.Trans.Control
import qualified Data.HashMap.Strict as HashMap
import Data.Id
Expand Down
1 change: 0 additions & 1 deletion libs/bilge/src/Bilge/Assert.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import Control.Monad.Writer.Class
import Control.Monad.Writer.Strict
import qualified Data.ByteString as S
import qualified Data.ByteString.Lazy as Lazy
import Data.List (intersperse, isInfixOf)
import Imports
import Network.HTTP.Client
import System.Console.ANSI
Expand Down
1 change: 0 additions & 1 deletion libs/bilge/src/Bilge/IO.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ import Bilge.Request
import Bilge.Response
import Control.Monad.Base
import Control.Monad.Catch
import Control.Monad.Fail (MonadFail)
import Control.Monad.Trans.Control
import qualified Data.ByteString.Lazy as LB
import qualified Data.ByteString.Lazy as Lazy
Expand Down
16 changes: 8 additions & 8 deletions libs/brig-types/src/Brig/Types/Instances.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ instance Cql PrekeyId where
ctype = Tagged IntColumn
toCql = CqlInt . fromIntegral . keyId
fromCql (CqlInt i) = return $ PrekeyId (fromIntegral i)
fromCql _ = fail "PrekeyId: Int expected"
fromCql _ = Left "PrekeyId: Int expected"

instance Cql ServiceTag where
ctype = Tagged BigIntColumn

fromCql (CqlBigInt i) = case intToTag i of
Just t -> return t
Nothing -> fail $ "unexpected service tag: " ++ show i
fromCql _ = fail "service tag: int expected"
Nothing -> Left $ "unexpected service tag: " ++ show i
fromCql _ = Left "service tag: int expected"

toCql = CqlBigInt . tagToInt

Expand All @@ -50,10 +50,10 @@ instance Cql ServiceKeyPEM where

fromCql (CqlBlob b) =
maybe
(fail "service key pem: malformed key")
(Left "service key pem: malformed key")
pure
(fromByteString' b)
fromCql _ = fail "service key pem: blob expected"
fromCql _ = Left "service key pem: blob expected"

toCql = CqlBlob . toByteString

Expand All @@ -74,15 +74,15 @@ instance Cql ServiceKey where
p <- required "pem"
case (t :: Int32) of
0 -> return $! ServiceKey RsaServiceKey s p
_ -> fail $ "Unexpected service key type: " ++ show t
_ -> Left $ "Unexpected service key type: " ++ show t
where
required :: Cql r => Text -> Either String r
required f =
maybe
(fail ("ServiceKey: Missing required field '" ++ show f ++ "'"))
(Left ("ServiceKey: Missing required field '" ++ show f ++ "'"))
fromCql
(lookup f fs)
fromCql _ = fail "service key: udt expected"
fromCql _ = Left "service key: udt expected"

toCql (ServiceKey RsaServiceKey siz pem) =
CqlUdt
Expand Down
1 change: 0 additions & 1 deletion libs/brig-types/src/Brig/Types/Provider/Tag.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ where

import Cassandra.CQL (Cql)
import Data.Bits
import Data.List (foldl')
import Data.Range
import qualified Data.Set as Set
import Imports
Expand Down
2 changes: 0 additions & 2 deletions libs/extended/src/Servant/API/Extended.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
-- errors instead of plaintext.
module Servant.API.Extended where

import Control.Monad.Trans (liftIO)
import qualified Data.ByteString.Lazy as BL
import Data.EitherR (fmapL)
import Data.Maybe (fromMaybe)
import Data.String.Conversions (cs)
import Data.Typeable
import GHC.TypeLits
Expand Down
1 change: 0 additions & 1 deletion libs/galley-types/src/Galley/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ import Wire.API.Conversation.Typing
import Wire.API.CustomBackend
import Wire.API.Event.Conversation
import Wire.API.Message
import Wire.API.User (UserIdList (..))
import Wire.API.User.Client

--------------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion libs/galley-types/src/Galley/Types/Teams.hs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ import Data.String.Conversions (cs)
import Imports
import Wire.API.Event.Team
import Wire.API.Team
import Wire.API.Team (NewTeam (..), Team (..), TeamBinding (..))
import Wire.API.Team.Conversation
import Wire.API.Team.Feature
import Wire.API.Team.Member
Expand Down
2 changes: 1 addition & 1 deletion libs/gundeck-types/src/Gundeck/Types/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ instance ToByteString URI where
instance FromByteString URI where
parser = takeByteString >>= parse . Bytes.unpack

parse :: Monad m => String -> m URI
parse :: (Monad m, MonadFail m) => String -> m URI
parse = maybe (fail "Invalid URI") (return . URI) . Net.parseURI
22 changes: 11 additions & 11 deletions libs/hscim/hscim.cabal
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.31.2.
-- This file has been generated from package.yaml by hpack version 0.33.0.
--
-- see: https://github.com/sol/hpack
--
-- hash: 1b9add2104b5ee4d50f0d991824c3a07c5c0816d995bb90e64c48ce47717d7c5
-- hash: 6f50966a204628956d641ded5887d6d680439edc24085d2d5a39ffaa42bb9f48

name: hscim
version: 0.3.4
Expand Down Expand Up @@ -72,7 +72,7 @@ library
aeson >=1.4.5 && <1.5
, aeson-qq >=0.8.2 && <0.9
, attoparsec >=0.13.2 && <0.14
, base >=4.12 && <4.13
, base >=4.12 && <4.14
, bytestring >=0.10.8 && <0.11
, email-validate >=2.3.2 && <2.4
, errors >=2.3.0 && <2.4
Expand All @@ -97,9 +97,9 @@ library
, stm >=2.5.0 && <2.6
, stm-containers >=1.1.0 && <1.2
, string-conversions >=0.4.0 && <0.5
, template-haskell >=2.14.0 && <2.15
, template-haskell >=2.14.0 && <2.16
, text >=1.2.3 && <1.3
, time >=1.8.0 && <1.9
, time >=1.8.0 && <1.10
, unordered-containers >=0.2.10 && <0.3
, uuid >=1.3.13 && <1.4
, vector >=0.12.0 && <0.13
Expand All @@ -121,7 +121,7 @@ executable hscim-server
aeson >=1.4.5 && <1.5
, aeson-qq >=0.8.2 && <0.9
, attoparsec >=0.13.2 && <0.14
, base >=4.12 && <4.13
, base >=4.12 && <4.14
, bytestring >=0.10.8 && <0.11
, email-validate >=2.3.2 && <2.4
, errors >=2.3.0 && <2.4
Expand All @@ -147,9 +147,9 @@ executable hscim-server
, stm >=2.5.0 && <2.6
, stm-containers >=1.1.0 && <1.2
, string-conversions >=0.4.0 && <0.5
, template-haskell >=2.14.0 && <2.15
, template-haskell >=2.14.0 && <2.16
, text >=1.2.3 && <1.3
, time >=1.8.0 && <1.9
, time >=1.8.0 && <1.10
, unordered-containers >=0.2.10 && <0.3
, uuid >=1.3.13 && <1.4
, vector >=0.12.0 && <0.13
Expand Down Expand Up @@ -183,7 +183,7 @@ test-suite spec
aeson >=1.4.5 && <1.5
, aeson-qq >=0.8.2 && <0.9
, attoparsec >=0.13.2 && <0.14
, base >=4.12 && <4.13
, base >=4.12 && <4.14
, bytestring >=0.10.8 && <0.11
, email-validate >=2.3.2 && <2.4
, errors >=2.3.0 && <2.4
Expand All @@ -209,9 +209,9 @@ test-suite spec
, stm >=2.5.0 && <2.6
, stm-containers >=1.1.0 && <1.2
, string-conversions >=0.4.0 && <0.5
, template-haskell >=2.14.0 && <2.15
, template-haskell >=2.14.0 && <2.16
, text >=1.2.3 && <1.3
, time >=1.8.0 && <1.9
, time >=1.8.0 && <1.10
, unordered-containers >=0.2.10 && <0.3
, uuid >=1.3.13 && <1.4
, vector >=0.12.0 && <0.13
Expand Down
6 changes: 3 additions & 3 deletions libs/hscim/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ dependencies:
- aeson >= 1.4.5 && < 1.5
- attoparsec >= 0.13.2 && < 0.14
- bytestring >= 0.10.8 && < 0.11
- base >= 4.12 && < 4.13
- base >= 4.12 && < 4.14
- scientific >= 0.3.6 && < 0.4
- hashable >= 1.2.7 && < 1.4
- text >= 1.2.3 && < 1.3
- time >= 1.8.0 && < 1.9
- template-haskell >= 2.14.0 && < 2.15
- time >= 1.8.0 && < 1.10
- template-haskell >= 2.14.0 && < 2.16
- unordered-containers >= 0.2.10 && < 0.3
- vector >= 0.12.0 && < 0.13
- aeson-qq >= 0.8.2 && < 0.9
Expand Down
1 change: 0 additions & 1 deletion libs/hscim/src/Web/Scim/Capabilities/MetaSchema.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ where
import Data.Aeson
import qualified Data.HashMap.Lazy as HML
import Data.Text (Text)
import GHC.Generics (Generic)
import Servant hiding (URI)
import Servant.API.Generic
import Servant.Server.Generic
Expand Down
1 change: 0 additions & 1 deletion libs/hscim/src/Web/Scim/Class/Group.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ where
import Data.Aeson
import qualified Data.Aeson as Aeson
import Data.Text
import GHC.Generics (Generic)
import Servant
import Servant.API.Generic
import Servant.Server.Generic
Expand Down
1 change: 0 additions & 1 deletion libs/hscim/src/Web/Scim/Class/User.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ module Web.Scim.Class.User
where

import Data.Aeson.Types (FromJSON)
import GHC.Generics (Generic)
import Servant
import Servant.API.Generic
import Servant.Server.Generic
Expand Down
1 change: 0 additions & 1 deletion libs/hscim/src/Web/Scim/Schema/PatchOp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
module Web.Scim.Schema.PatchOp where

import Control.Applicative
import Control.Monad (guard)
import Control.Monad.Except
import Data.Aeson.Types (FromJSON (parseJSON), ToJSON (toJSON), Value (String), object, withObject, withText, (.:), (.:?), (.=))
import qualified Data.Aeson.Types as Aeson
Expand Down
1 change: 0 additions & 1 deletion libs/hscim/src/Web/Scim/Schema/User.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ module Web.Scim.Schema.User
)
where

import Control.Monad (foldM)
import Control.Monad.Except
import Data.Aeson
import qualified Data.HashMap.Strict as HM
Expand Down
1 change: 0 additions & 1 deletion libs/hscim/src/Web/Scim/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ module Web.Scim.Server
)
where

import GHC.Generics (Generic)
import Network.Wai
import Servant
import Servant.API.Generic
Expand Down
2 changes: 1 addition & 1 deletion libs/hscim/src/Web/Scim/Test/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ where

import qualified Control.Retry as Retry
import Data.Aeson
import Data.Aeson.Internal (JSONPathElement (Key), (<?>))
import Data.Aeson.QQ
import Data.Aeson.Types (JSONPathElement (Key))
import Data.ByteString (ByteString)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8
Expand Down
1 change: 0 additions & 1 deletion libs/imports/src/Imports.hs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ import Data.Text (Text)
import qualified Data.Text.Lazy
import Data.Traversable
import Data.Tuple
import Data.Typeable (Typeable)
import Data.Void
import Data.Word
import GHC.Generics (Generic)
Expand Down
2 changes: 0 additions & 2 deletions libs/metrics-wai/src/Data/Metrics/Middleware/Prometheus.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ module Data.Metrics.Middleware.Prometheus
)
where

import Data.Maybe (fromMaybe)
import Data.Metrics.Types (Paths, treeLookup)
import Data.Metrics.WaiRoute (treeToPaths)
import Data.Text (Text)
import qualified Data.Text.Encoding as T
import Imports
import qualified Network.Wai as Wai
Expand Down
1 change: 0 additions & 1 deletion libs/ssl-util/src/Ssl/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import Data.Byteable (constEqBytes)
import Data.Dynamic (fromDynamic)
import Data.Time.Clock (getCurrentTime)
import Imports
import Network.HTTP.Client (defaultRequest)
import Network.HTTP.Client.Internal
import OpenSSL.BN (integerToMPI)
import OpenSSL.EVP.Digest (Digest, digestLBS)
Expand Down
2 changes: 1 addition & 1 deletion libs/tasty-cannon/src/Test/Tasty/Cannon.hs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ where

import Control.Concurrent.Async
import Control.Concurrent.Timeout hiding (threadDelay)
import Control.Exception (SomeAsyncException, asyncExceptionFromException, throwIO)
import Control.Exception (asyncExceptionFromException, throwIO)
import Control.Monad.Catch hiding (bracket)
import qualified Control.Monad.Catch as Catch
import Data.Aeson (FromJSON, Value (..), decodeStrict', fromJSON)
Expand Down
Loading

0 comments on commit fab4983

Please sign in to comment.