Use cabal-install to invoke doctest

This commit is contained in:
Janus Troelsen 2022-03-07 21:32:15 -06:00
parent 7ef9730f77
commit 222ccf107c
4 changed files with 14 additions and 27 deletions

View file

@ -47,10 +47,7 @@ jobs:
- name: Configure - name: Configure
run: | run: |
# Using separate store-dir because default one already has 'ghc-paths' package installed cabal install --ignore-project -j2 doctest --constraint='doctest ^>=0.20'
# 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'
- name: Build - name: Build
run: | run: |
@ -68,24 +65,17 @@ jobs:
# Necessary for doctest to be found in $PATH # Necessary for doctest to be found in $PATH
export PATH="$HOME/.cabal/bin:$PATH" export PATH="$HOME/.cabal/bin:$PATH"
# Filter out base-compat-batteries from .ghc.environment.*, as its modules DOCTEST="cabal repl --with-ghc=doctest --ghc-options=-w"
# conflict with those of base-compat. (cd servant && eval $DOCTEST)
# (cd servant-client && eval $DOCTEST)
# FIXME: This is an ugly hack. Ultimately, we'll want to use cabal-doctest (cd servant-client-core && eval $DOCTEST)
# (or cabal v2-doctest, if it ever lands) to provide a clean GHC environment. (cd servant-http-streams && eval $DOCTEST)
# This might allow running doctests in GHCJS build as well. (cd servant-docs && eval $DOCTEST)
perl -i -e 'while (<ARGV>) { print unless /package-id\s+(base-compat-batteries)-\d+(\.\d+)*/; }' .ghc.environment.* (cd servant-foreign && eval $DOCTEST)
(cd servant-server && eval $DOCTEST)
(cd servant && doctest src) (cd servant-machines && eval $DOCTEST)
(cd servant-client && doctest src) (cd servant-conduit && eval $DOCTEST)
(cd servant-client-core && doctest src) (cd servant-pipes && eval $DOCTEST)
(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)
stack: stack:
name: stack / ghc ${{ matrix.ghc }} name: stack / ghc ${{ matrix.ghc }}

View file

@ -52,9 +52,6 @@ tests: True
optimization: False optimization: False
-- reorder-goals: True -- reorder-goals: True
-- needed for doctests
write-ghc-environment-files: always
-- https://github.com/chordify/haskell-servant-pagination/pull/12 -- 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
allow-newer: servant-pagination-2.2.2:servant-server allow-newer: servant-pagination-2.2.2:servant-server

View file

@ -92,7 +92,7 @@ test-suite doctests
build-depends: build-depends:
base, base,
directory >= 1.0, directory >= 1.0,
doctest >= 0.17 && <0.19, doctest >= 0.17 && <0.21,
servant, servant,
QuickCheck, QuickCheck,
filepath filepath