Skip to content

Prepare for GHC 9.8 / Cabal 3.11 #1235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 30 additions & 27 deletions .github/workflows/cabal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
strategy:
fail-fast: false
matrix:
ghc: ['9.4.4', '9.2.7', '9.0.2']
cabal: ['3.8.1.0']
ghc: ['9.6.2', '9.4.5', '9.2.8', '9.0.2']
cabal: ['3.10.1.0']
os: [ubuntu-latest]
name: Cabal with GHC ${{ matrix.ghc }}
steps:
- uses: actions/checkout@v3
- name: Setup Haskell
uses: haskell/actions/setup@v2
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
Expand All @@ -33,27 +33,30 @@ jobs:
run: cabal test all --enable-tests
- name: Haddock
run: cabal haddock all
build_with_mtl_2_3:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
ghc: ['9.4.4']
cabal: ['3.8.1.0']
os: [ubuntu-latest]
name: Cabal with GHC ${{ matrix.ghc }} and mtl >= 2.3.1
steps:
- uses: actions/checkout@v3
- name: Setup Haskell
uses: haskell/actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Install dependencies
run: sudo apt install -y libbrotli-dev libgd-dev
- name: Build dependencies with mtl >= 2.3.1
# 2022-12-30: 'transformers >= 0.6' is needed because of happstack-server
run: cabal build all --disable-tests --dependencies-only -O0 --constraint 'mtl >= 2.3.1' --constraint 'transformers >= 0.6' --allow-newer='Cabal:mtl' --allow-newer='Cabal:transformers'
- name: Build with mtl >= 2.3.1
# 2022-12-30: 'transformers >= 0.6' is needed because of happstack-server
run: cabal build all --disable-tests -O0 --constraint 'mtl >= 2.3.1' --constraint 'transformers >= 0.6' --allow-newer='Cabal:mtl' --allow-newer='Cabal:transformers'

## Andreas, 2023-08-03: mtl-2.3 is covered by GHC 9.6
#
# build_with_mtl_2_3:
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# ghc: ['9.4.4']
# cabal: ['3.8.1.0']
# os: [ubuntu-latest]
# name: Cabal with GHC ${{ matrix.ghc }} and mtl >= 2.3.1
# steps:
# - uses: actions/checkout@v3
# - name: Setup Haskell
# uses: haskell/actions/setup@v2
# with:
# ghc-version: ${{ matrix.ghc }}
# cabal-version: ${{ matrix.cabal }}
# - name: Install dependencies
# run: sudo apt install -y libbrotli-dev libgd-dev
# - name: Build dependencies with mtl >= 2.3.1
# # 2022-12-30: 'transformers >= 0.6' is needed because of happstack-server
# run: cabal build all --disable-tests --dependencies-only -O0 --constraint 'mtl >= 2.3.1' --constraint 'transformers >= 0.6' --allow-newer='Cabal:mtl' --allow-newer='Cabal:transformers'
# - name: Build with mtl >= 2.3.1
# # 2022-12-30: 'transformers >= 0.6' is needed because of happstack-server
# run: cabal build all --disable-tests -O0 --constraint 'mtl >= 2.3.1' --constraint 'transformers >= 0.6' --allow-newer='Cabal:mtl' --allow-newer='Cabal:transformers'
22 changes: 11 additions & 11 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.15.20230321
# version: 0.16.6.20230729
#
# REGENDATA ("0.15.20230321",["github","hackage-server.cabal"])
# REGENDATA ("0.16.6.20230729",["github","hackage-server.cabal"])
#
name: Haskell-CI
on:
Expand All @@ -34,19 +34,19 @@ jobs:
strategy:
matrix:
include:
- compiler: ghc-9.6.1
- compiler: ghc-9.6.2
compilerKind: ghc
compilerVersion: 9.6.1
compilerVersion: 9.6.2
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.4.4
- compiler: ghc-9.4.5
compilerKind: ghc
compilerVersion: 9.4.4
compilerVersion: 9.4.5
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.2.7
- compiler: ghc-9.2.8
compilerKind: ghc
compilerVersion: 9.2.7
compilerVersion: 9.2.8
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.0.2
Expand All @@ -71,7 +71,7 @@ jobs:
apt-get update
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
mkdir -p "$HOME/.ghcup/bin"
curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup"
curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
Expand Down Expand Up @@ -142,8 +142,8 @@ jobs:
- name: install cabal-plan
run: |
mkdir -p $HOME/.cabal/bin
curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > cabal-plan.xz
echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c -
curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.7.3.0/cabal-plan-0.7.3.0-x86_64-linux.xz > cabal-plan.xz
echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c -
xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan
rm -f cabal-plan.xz
chmod a+x $HOME/.cabal/bin/cabal-plan
Expand Down
21 changes: 14 additions & 7 deletions hackage-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ copyright: 2008-2015 Duncan Coutts,
license: BSD-3-Clause
license-file: LICENSE

tested-with: GHC == { 9.6.1, 9.4.4, 9.2.7, 9.0.2, 8.10.7, 8.8.4 }
tested-with:
GHC == 9.6.2
GHC == 9.4.5
GHC == 9.2.8
GHC == 9.0.2
GHC == 8.10.7
GHC == 8.8.4

data-dir: datafiles
data-files:
Expand Down Expand Up @@ -111,11 +117,11 @@ common defaults
-- see `cabal.project.local-ghc-${VERSION}` files
build-depends:
, array >= 0.5 && < 0.6
, base >= 4.13 && < 4.19
, base >= 4.13 && < 4.20
, binary >= 0.8 && < 0.9
, bytestring >= 0.10 && < 0.12
, containers ^>= 0.6.0
, deepseq >= 1.4 && < 1.5
, deepseq >= 1.4 && < 1.6
, directory >= 1.3 && < 1.4
, filepath >= 1.4 && < 1.5
, mtl >= 2.2.1 && < 2.4
Expand All @@ -129,9 +135,9 @@ common defaults
, scientific
-- other dependencies shared by most components
build-depends:
, aeson ^>= 2.0.3.0 || ^>= 2.1.0.0
, Cabal ^>= 3.10.1.0
, Cabal-syntax ^>= 3.10.1.0
, aeson ^>= 2.2.0.0
, Cabal >= 3.10.1.0 && < 3.12
, Cabal-syntax >= 3.10.1.0 && < 3.12
-- Cabal-syntax needs to be bound to constrain hackage-security
-- see https://github.com/haskell/hackage-server/issues/1130
, fail ^>= 4.9.0
Expand Down Expand Up @@ -547,6 +553,7 @@ test-suite HighLevelTest
build-depends:
-- version constraints inherited from lib-server
, HTTP
, attoparsec-aeson ^>= 2.2.0.0
, base64-bytestring
, random
-- component-specific dependencies
Expand All @@ -563,7 +570,7 @@ test-suite ReverseDependenciesTest
, tasty ^>= 1.4
, tasty-hunit ^>= 0.10
, HUnit ^>= 1.6
, hedgehog ^>= 1.2
, hedgehog ^>= 1.3
, exceptions
, bimap
other-modules: RevDepCommon
Expand Down
20 changes: 19 additions & 1 deletion src/Distribution/Server/Framework/Instances.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts, BangPatterns, TypeFamilies #-}

{-# OPTIONS_GHC -fno-warn-orphans #-}
Expand Down Expand Up @@ -119,6 +120,9 @@ instance SafeCopy VersionRange where
instance SafeCopy OS where
errorTypeName _ = "OS"

#if !MIN_VERSION_Cabal_syntax(3,11,0)
putCopy (OtherOS "haiku") = contain $ putWord8 18
#endif
putCopy (OtherOS s) = contain $ putWord8 0 >> safePut s
putCopy Linux = contain $ putWord8 1
putCopy Windows = contain $ putWord8 2
Expand All @@ -137,6 +141,9 @@ instance SafeCopy OS where
putCopy Hurd = contain $ putWord8 15
putCopy Android = contain $ putWord8 16
putCopy Wasi = contain $ putWord8 17
#if MIN_VERSION_Cabal_syntax(3,11,0)
putCopy Haiku = contain $ putWord8 18
#endif

getCopy = contain $ do
tag <- getWord8
Expand All @@ -159,6 +166,11 @@ instance SafeCopy OS where
15 -> return Hurd
16 -> return Android
17 -> return Wasi
#if MIN_VERSION_Cabal_syntax(3,11,0)
18 -> return Haiku
#else
18 -> return $ OtherOS "haiku"
#endif
_ -> fail "SafeCopy OS getCopy: unexpected tag"

instance SafeCopy Arch where
Expand Down Expand Up @@ -382,7 +394,13 @@ instance Arbitrary OS where
arbitrary = oneof [ pure OtherOS <*> vectorOf 3 (choose ('A', 'Z'))
, pure Linux, pure Windows, pure OSX, pure FreeBSD
, pure OpenBSD, pure NetBSD, pure Solaris, pure AIX
, pure HPUX, pure IRIX, pure HaLVM, pure IOS ]
, pure HPUX, pure IRIX, pure HaLVM, pure IOS
#if MIN_VERSION_Cabal_syntax(3,11,0)
, pure Haiku
#else
, pure $ OtherOS "haiku"
#endif
]

instance Arbitrary FlagName where
arbitrary = mkFlagName <$> vectorOf 4 (choose ('a', 'z'))
Expand Down
3 changes: 2 additions & 1 deletion tests/HttpUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import Control.Monad
import Data.Maybe
import Network.HTTP hiding (user)
import Network.HTTP.Auth
import Data.Aeson (Result(..), Value(..), FromJSON(..), (.:), fromJSON, json')
import Data.Aeson (Result(..), Value(..), FromJSON(..), (.:), fromJSON)
import Data.Aeson.Parser (json')
import System.Exit (die)

import qualified Network.Http.Client as HC
Expand Down