Skip to content

Commit

Permalink
Merge pull request #1554 from ysangkok/repl-doctest
Browse files Browse the repository at this point in the history
Use cabal-install to invoke doctest
  • Loading branch information
Gaël Deest authored Mar 8, 2022
2 parents d05da71 + 222ccf1 commit de923fc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 27 deletions.
34 changes: 12 additions & 22 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ jobs:
- name: Configure
run: |
# Using separate store-dir because default one already has 'ghc-paths' package installed
# with hardcoded path to ghcup's GHC path (which it was built with). This leads to failure in
# doctest, as it tries to invoke that GHC, and it doesn't exist here.
cabal --store-dir /tmp/cabal-store install --ignore-project -j2 doctest --constraint='doctest ^>=0.18'
cabal install --ignore-project -j2 doctest --constraint='doctest ^>=0.20'
- name: Build
run: |
Expand All @@ -68,24 +65,17 @@ jobs:
# Necessary for doctest to be found in $PATH
export PATH="$HOME/.cabal/bin:$PATH"
# Filter out base-compat-batteries from .ghc.environment.*, as its modules
# conflict with those of base-compat.
#
# FIXME: This is an ugly hack. Ultimately, we'll want to use cabal-doctest
# (or cabal v2-doctest, if it ever lands) to provide a clean GHC environment.
# This might allow running doctests in GHCJS build as well.
perl -i -e 'while (<ARGV>) { print unless /package-id\s+(base-compat-batteries)-\d+(\.\d+)*/; }' .ghc.environment.*
(cd servant && doctest src)
(cd servant-client && doctest src)
(cd servant-client-core && doctest src)
(cd servant-http-streams && doctest src)
(cd servant-docs && doctest src)
(cd servant-foreign && doctest src)
(cd servant-server && doctest src)
(cd servant-machines && doctest src)
(cd servant-conduit && doctest src)
(cd servant-pipes && doctest src)
DOCTEST="cabal repl --with-ghc=doctest --ghc-options=-w"
(cd servant && eval $DOCTEST)
(cd servant-client && eval $DOCTEST)
(cd servant-client-core && eval $DOCTEST)
(cd servant-http-streams && eval $DOCTEST)
(cd servant-docs && eval $DOCTEST)
(cd servant-foreign && eval $DOCTEST)
(cd servant-server && eval $DOCTEST)
(cd servant-machines && eval $DOCTEST)
(cd servant-conduit && eval $DOCTEST)
(cd servant-pipes && eval $DOCTEST)
stack:
name: stack / ghc ${{ matrix.ghc }}
Expand Down
3 changes: 0 additions & 3 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ tests: True
optimization: False
-- reorder-goals: True

-- needed for doctests
write-ghc-environment-files: always

-- https://github.com/chordify/haskell-servant-pagination/pull/12
allow-newer: servant-pagination-2.2.2:servant
allow-newer: servant-pagination-2.2.2:servant-server
2 changes: 1 addition & 1 deletion servant-client/src/Servant/Client/Internal/HttpClient.hs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ defaultMakeClientRequest burl r = Client.defaultRequest
where
-- Content-Type and Accept are specified by requestBody and requestAccept
headers = filter (\(h, _) -> h /= "Accept" && h /= "Content-Type") $
toList $requestHeaders r
toList $ requestHeaders r

acceptHdr
| null hs = Nothing
Expand Down
2 changes: 1 addition & 1 deletion servant-swagger/servant-swagger.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ test-suite doctests
build-depends:
base,
directory >= 1.0,
doctest >= 0.17 && <0.19,
doctest >= 0.17 && <0.21,
servant,
QuickCheck,
filepath
Expand Down

0 comments on commit de923fc

Please sign in to comment.