Skip to content

Commit

Permalink
Merge pull request #69 from marinelli/servant-0.20
Browse files Browse the repository at this point in the history
Support servant-0.20 and add ghc-9.4 in CI
  • Loading branch information
tchoutri authored Sep 18, 2023
2 parents ffeefec + 36a229e commit a1fd549
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 23 deletions.
37 changes: 28 additions & 9 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.16
# version: 0.17.20230826
#
# REGENDATA ("0.16",["github","cabal.project","--allow-failures",">= 9.2","--distribution","focal"])
# REGENDATA ("0.17.20230826",["github","cabal.project","--allow-failures",">= 9.2","--distribution","focal"])
#
name: Haskell-CI
on:
Expand All @@ -32,9 +32,14 @@ jobs:
strategy:
matrix:
include:
- compiler: ghc-9.2.7
- compiler: ghc-9.4.7
compilerKind: ghc
compilerVersion: 9.2.7
compilerVersion: 9.4.7
setup-method: ghcup
allow-failure: true
- compiler: ghc-9.2.8
compilerKind: ghc
compilerVersion: 9.2.8
setup-method: ghcup
allow-failure: true
- compiler: ghc-9.0.2
Expand Down Expand Up @@ -65,7 +70,7 @@ jobs:
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
if [ "${{ matrix.setup-method }}" = ghcup ]; then
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 All @@ -74,7 +79,7 @@ jobs:
apt-get update
apt-get install -y "$HCNAME"
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 cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
fi
Expand All @@ -90,10 +95,12 @@ jobs:
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
HCDIR=/opt/$HCKIND/$HCVER
if [ "${{ matrix.setup-method }}" = ghcup ]; then
HC=$HOME/.ghcup/bin/$HCKIND-$HCVER
HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER")
HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#')
HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#')
echo "HC=$HC" >> "$GITHUB_ENV"
echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV"
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
else
HC=$HCDIR/bin/$HCKIND
Expand Down Expand Up @@ -243,16 +250,28 @@ jobs:
- name: prepare for constraint sets
run: |
rm -f cabal.project.local
- name: constraint set servant-0.20
run: |
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.20.*' all --dry-run
cabal-plan topo | sort
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.20.*' --dependencies-only -j2 all
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.20.*' all
- name: constraint set servant-0.19
run: |
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.19.*' all --dry-run
cabal-plan topo | sort
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.19.*' --dependencies-only -j2 all
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.19.*' all
- name: constraint set servant-0.18
run: |
if [ $((HCNUMVER < 90200)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.18.*' all --dry-run ; fi
if [ $((HCNUMVER < 90200)) -ne 0 ] ; then cabal-plan topo | sort ; fi
if [ $((HCNUMVER < 90200)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.18.*' --dependencies-only -j2 all ; fi
if [ $((HCNUMVER < 90200)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.18.*' all ; fi
- name: constraint set servant-0.17
run: |
if [ $((HCNUMVER < 81000)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.17.*' all --dry-run ; fi
if [ $((HCNUMVER < 81000)) -ne 0 ] ; then cabal-plan topo | sort ; fi
if [ $((HCNUMVER < 81000)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.17.*' --dependencies-only -j2 all ; fi
if [ $((HCNUMVER < 81000)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='servant ==0.17.*' all ; fi
- name: save cache
Expand Down
6 changes: 5 additions & 1 deletion cabal.haskell-ci
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@ constraint-set servant-0.18
constraints: servant ==0.18.*

constraint-set servant-0.19
ghc: >= 8.0 && <9.4
ghc: >= 8.6 && <9.6
constraints: servant ==0.19.*

constraint-set servant-0.20
ghc: >= 8.6 && <9.8
constraints: servant ==0.20.*
5 changes: 3 additions & 2 deletions servant-multipart-api/servant-multipart-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ tested-with:
|| ==8.8.4
|| ==8.10.7
|| ==9.0.2
|| ==9.2.7
|| ==9.2.8
|| ==9.4.7

library
default-language: Haskell2010
Expand All @@ -36,7 +37,7 @@ library

-- other dependencies
build-depends:
servant >=0.16 && <0.20
servant >=0.16 && <0.21

-- servant-0.19 dropped support for GHC-8.4 (latest GHCJS version),
-- due to QuantifiedConstraints
Expand Down
7 changes: 4 additions & 3 deletions servant-multipart-client/servant-multipart-client.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ tested-with:
|| ==8.8.4
|| ==8.10.7
|| ==9.0.2
|| ==9.2.7
|| ==9.2.8
|| ==9.4.7

library
default-language: Haskell2010
Expand All @@ -38,8 +39,8 @@ library
build-depends:
servant-multipart-api == 0.12.*
, http-media >=0.7.1.3 && <0.9
, servant >=0.16 && <0.20
, servant-client-core >=0.16 && <0.20
, servant >=0.16 && <0.21
, servant-client-core >=0.16 && <0.21

-- servant-0.19 dropped support for GHC-8.4 (latest GHCJS version),
-- due to QuantifiedConstraints
Expand Down
4 changes: 2 additions & 2 deletions servant-multipart-client/src/Servant/Multipart/Client.hs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ instance MultipartClient Tmp where
readHandle hdl = fromActionStep LBS.null (LBS.hGet hdl 4096)

instance MultipartClient Mem where
loadFile _ = source . pure
loadFile _ = source . pure @[]

-- | Generates a boundary to be used to separate parts of the multipart.
-- Requires 'IO' because it is randomized.
Expand Down Expand Up @@ -132,7 +132,7 @@ multipartToBody boundary mp = RequestBodySource $ files' <> source ["--", bounda
renderInput input = renderPart (lencode . iName $ input)
"text/plain"
""
(source . pure . lencode . iValue $ input)
(source . pure @[] . lencode . iValue $ input)
inputs' = foldl' (\acc x -> acc `mappend'` renderInput x) mempty' (inputs mp)
renderFile :: FileData tag -> SourceIO LBS.ByteString
renderFile file = renderPart (lencode . fdInputName $ file)
Expand Down
13 changes: 7 additions & 6 deletions servant-multipart/servant-multipart.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ tested-with:
|| ==8.8.4
|| ==8.10.7
|| ==9.0.2
|| ==9.2.7
|| ==9.2.8
|| ==9.4.7

library
default-language: Haskell2010
Expand All @@ -37,11 +38,11 @@ library
build-depends:
servant-multipart-api == 0.12.*
, lens >=4.17 && <5.3
, resourcet >=1.2.2 && <1.3
, servant >=0.16 && <0.20
, servant-docs >=0.10 && <0.20
, servant-foreign >=0.15 && <0.20
, servant-server >=0.16 && <0.20
, resourcet >=1.2.2 && <1.4
, servant >=0.16 && <0.21
, servant-docs >=0.10 && <0.14
, servant-foreign >=0.15 && <0.17
, servant-server >=0.16 && <0.21
, string-conversions >=0.4.0.1 && <0.5
, wai >=3.2.1.2 && <3.3
, wai-extra >=3.0.24.3 && <3.2
Expand Down

0 comments on commit a1fd549

Please sign in to comment.