File tree Expand file tree Collapse file tree 3 files changed +41
-20
lines changed Expand file tree Collapse file tree 3 files changed +41
-20
lines changed Original file line number Diff line number Diff line change 6565      - name : Set PATH 
6666        run : | 
6767          echo "$HOME/.cabal/bin" >> $GITHUB_PATH 
68- name : Install cabal-env 
69-         run : | 
70-           mkdir -p $HOME/.cabal/bin 
71-           curl -sL https://github.com/phadej/cabal-extras/releases/download/preview-20191225/cabal-env-snapshot-20191225-x86_64-linux.xz > cabal-env.xz 
72-           echo "1b567d529c5f627fd8c956e57ae8f0d9f11ee66d6db34b7fb0cb1c370b4edf01  cabal-env.xz" | sha256sum -c - 
73-           xz -d < cabal-env.xz > $HOME/.cabal/bin/cabal-env 
74-           rm -f cabal-env.xz 
75-           chmod a+x $HOME/.cabal/bin/cabal-env 
7668uses : actions/cache@v1 
7769        with :
7870          path : ~/.cabal/store 
@@ -91,17 +83,12 @@ jobs:
9183        run : | 
9284          ghcup --version 
9385          ghcup config set cache true  
94-           ghcup install ghc recommended 
95-           ghcup set ghc recommended  
86+           ghcup install ghc --set  recommended 
87+           ghcup install cabal --set latest  
9688name : Update Hackage index 
9789        run : cabal v2-update 
98-       - name : Install doctest 
99-         run : cabal v2-install doctest 
100-       - name : Install libraries 
101-         run : | 
102-           cabal-env --transitive QuickCheck 
103-           cabal-env array bytestring containers deepseq directory filepath pretty process time binary unix text parsec mtl 
104-           cat $HOME/.ghc/*/environments/default 
10590      - uses : actions/checkout@v3 
91+       - name : Install doctest 
92+         run : make doctest-install 
10693      - name : Doctest 
10794        run : make doctest 
Original file line number Diff line number Diff line change @@ -71,15 +71,27 @@ ghcid-lib :
7171ghcid-cli  :
7272	ghcid -c ' cabal v2-repl cabal-install' 
7373
74- #  doctests (relies on .ghc.environment files)
75- 
74+ #  Artem, 2023-02-03, https://github.com/haskell/cabal/issues/8504
75+ #  The new and prefered way to call the doctest tool (as of now) is based on cabal repl --with-ghc=doctest.
76+ #  The call below reflects the current documentation of the doctest tool except one caveat,
77+ #  which is https://github.com/haskell/cabal/issues/6859, i.e. we have to hide allow-newer in our project
78+ #  file from cabal/doctest. This is easy: we just select a project file with no allow-newer (e.g. cabal.project.libonly).
79+ # 
80+ #  TODO: Cabal-described should be added here but its doctests currently broken, see:
81+ #        https://github.com/haskell/cabal/issues/8734
82+ #        Just as well, cabal-install(-solver) doctests (the target below) bitrotted and need some care.
7683doctest  :
77- 	doctest --fast -XHaskell2010 Cabal-syntax/src Cabal/src
84+ 	cabal repl --with-ghc=doctest --build-depends=QuickCheck --build-depends=template-haskell --repl-options=" -w" " cabal.project.validate" 
85+ 	cabal repl --with-ghc=doctest --build-depends=QuickCheck --build-depends=template-haskell --repl-options=" -w" " cabal.project.validate" 
86+ 
7887
7988#  This is not run as part of validate.sh (we need hackage-security, which is tricky to get).
8089doctest-cli  :
8190	doctest -D__DOCTEST__ --fast cabal-install/src cabal-install-solver/src cabal-install-solver/src-assertion
8291
92+ doctest-install :
93+ 	cabal install doctest --overwrite-policy=always --ignore-project
94+ 
8395#  tests
8496
8597check-tests  :
Original file line number Diff line number Diff line change @@ -25,6 +25,28 @@ There are a few useful flags:
2525  the autodetection doesn't work correctly (which may be the
2626  case for old versions of GHC.)
2727
28+ doctests
29+ ======== 
30+ 
31+ You need to install the doctest tool. Make sure it's compiled with your current
32+ GHC, and don't forget to reinstall it every time you switch GHC version:
33+ 
34+ ```  shellsession 
35+ cabal install doctest --overwrite-policy=always --ignore-project 
36+ ``` 
37+ 
38+ After that you can run doctests for a component of your choice via the following command:
39+ 
40+ ```  shellsession 
41+ cabal repl --with-ghc=doctest --build-depends=QuickCheck --build-depends=template-haskell --repl-options="-w" --project-file="cabal.project.validate" Cabal-syntax 
42+ ``` 
43+ 
44+ In this example we have run doctests in ` Cabal-syntax ` . Notice, that some
45+ components have broken doctests
46+ ([ #8734  ] ( https://github.com/haskell/cabal/issues/8734 ) );
47+ our CI currently checks that ` Cabal-syntax `  and ` Cabal `  doctests pass via
48+ ` make doctest-install && make doctest `  (you can use this make-based workflow too).
49+ 
2850How to write
2951------------ 
3052
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments