File tree Expand file tree Collapse file tree 3 files changed +33
-17
lines changed Expand file tree Collapse file tree 3 files changed +33
-17
lines changed Original file line number Diff line number Diff line change 54
54
- name : Set PATH
55
55
run : |
56
56
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
57
- - name : Install cabal-env
58
- run : |
59
- mkdir -p $HOME/.cabal/bin
60
- curl -sL https://github.com/phadej/cabal-extras/releases/download/preview-20191225/cabal-env-snapshot-20191225-x86_64-linux.xz > cabal-env.xz
61
- echo "1b567d529c5f627fd8c956e57ae8f0d9f11ee66d6db34b7fb0cb1c370b4edf01 cabal-env.xz" | sha256sum -c -
62
- xz -d < cabal-env.xz > $HOME/.cabal/bin/cabal-env
63
- rm -f cabal-env.xz
64
- chmod a+x $HOME/.cabal/bin/cabal-env
65
57
- uses : actions/cache@v1
66
58
with :
67
59
path : ~/.cabal/store
@@ -70,16 +62,11 @@ jobs:
70
62
run : |
71
63
ghcup config set cache true
72
64
ghcup install ghc recommended
73
- ghcup set ghc recommended
65
+ ghcup install cabal latest
74
66
- name : Update Hackage index
75
67
run : cabal v2-update
76
68
- name : Install doctest
77
69
run : cabal v2-install doctest
78
- - name : Install libraries
79
- run : |
80
- cabal-env --transitive QuickCheck
81
- cabal-env array bytestring containers deepseq directory filepath pretty process time binary unix text parsec mtl
82
- cat $HOME/.ghc/*/environments/default
83
70
- uses : actions/checkout@v3
84
71
- name : Doctest
85
72
run : make doctest
Original file line number Diff line number Diff line change @@ -71,10 +71,19 @@ ghcid-lib :
71
71
ghcid-cli :
72
72
ghcid -c ' cabal v2-repl cabal-install'
73
73
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.
76
83
doctest :
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" --project-file=" cabal.project.validate" Cabal-syntax
85
+ cabal repl --with-ghc=doctest --build-depends=QuickCheck --build-depends=template-haskell --repl-options=" -w" --project-file=" cabal.project.validate" Cabal
86
+
78
87
79
88
# This is not run as part of validate.sh (we need hackage-security, which is tricky to get).
80
89
doctest-cli :
Original file line number Diff line number Diff line change @@ -25,6 +25,26 @@ There are a few useful flags:
25
25
the autodetection doesn't work correctly (which may be the
26
26
case for old versions of GHC.)
27
27
28
+ doctests
29
+ ========
30
+
31
+ You need to install the doctest tool. Make sure it's compiled with your current
32
+ GHC:
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 Cabal
42
+ ```
43
+
44
+ In this example we run doctests in ` Cabal-syntax ` and ` Cabal ` . Exactly the same
45
+ can be done via ` make doctest ` (that's what our CI does). Notice, that some
46
+ components have broken doctests ([ #8734 ] ( https://github.com/haskell/cabal/issues/8734 ) ).
47
+
28
48
How to write
29
49
------------
30
50
You can’t perform that action at this time.
0 commit comments