Skip to content

Commit 59ce1d3

Browse files
committed
Update CI
1 parent 11b5cc4 commit 59ce1d3

File tree

4 files changed

+59
-42
lines changed

4 files changed

+59
-42
lines changed

Diff for: .github/workflows/haskell.yml

+14-12
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,30 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
ghc: ["9.2.2", "9.0.2", "8.10.7", "8.8.4", "8.6.5"]
20+
ghc: ["9.8.1", "9.6.3", "9.4.8", "9.2.8", "9.0.2", "8.10.7"]
2121
os: [ubuntu-latest, macOS-latest, windows-latest]
2222

23+
env:
24+
# Modify this value to "invalidate" the cabal cache.
25+
CABAL_CACHE_VERSION: "2024-01-05"
26+
2327
steps:
2428
- uses: actions/checkout@v2
2529

26-
- uses: haskell/actions/setup@v1
30+
- uses: haskell-actions/setup@v2
2731
id: setup-haskell
2832
with:
2933
ghc-version: ${{ matrix.ghc }}
30-
cabal-version: 3.6.2.0
34+
cabal-version: '3.10.2.1'
3135

3236
- name: Set some window specific things
3337
if: matrix.os == 'windows-latest'
3438
run: echo 'EXE_EXT=.exe' >> $GITHUB_ENV
3539

3640
- name: Configure project
37-
run: cabal configure --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+
41+
run: |
42+
cabal configure --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+
43+
cabal build all --enable-tests --enable-benchmarks --dry-run
3844
3945
- name: Cabal cache over S3
4046
uses: action-works/cabal-cache-s3@v1
@@ -46,7 +52,7 @@ jobs:
4652
dist-dir: dist-newstyle
4753
store-path: ${{ steps.setup-haskell.outputs.cabal-store }}
4854
threads: 16
49-
archive-uri: ${{ secrets.BINARY_CACHE_URI }}
55+
archive-uri: ${{ secrets.BINARY_CACHE_URI }}/${{ env.CABAL_CACHE_VERSION }}/${{ runner.os }}/${{ matrix.cabal }}/${{ matrix.ghc }}
5056
skip: "${{ secrets.BINARY_CACHE_URI == '' }}"
5157

5258
- name: Cabal cache over HTTPS
@@ -55,18 +61,14 @@ jobs:
5561
dist-dir: dist-newstyle
5662
store-path: ${{ steps.setup-haskell.outputs.cabal-store }}
5763
threads: 16
58-
archive-uri: https://cache.haskellworks.io/archive
64+
archive-uri: https://cache.haskellworks.io/${{ env.CABAL_CACHE_VERSION }}/${{ runner.os }}/${{ matrix.cabal }}/${{ matrix.ghc }}
5965
skip: "${{ secrets.BINARY_CACHE_URI != '' }}"
6066

6167
- name: Build
62-
# Try building it twice in case of flakey builds on Windows
63-
run: |
64-
cabal build all --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+ || \
65-
cabal build all --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+ -j1
68+
run: cabal build all --enable-tests --enable-benchmarks
6669

6770
- name: Test
68-
run: |
69-
cabal test all --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+
71+
run: cabal test all --enable-tests --enable-benchmarks
7072

7173
check:
7274
needs: build

Diff for: .vscode/tasks.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"label": "Build",
66
"type": "shell",
77
"command": "bash",
8-
"args": ["-lc", "./project.sh build && echo 'Done'"],
8+
"args": ["-lc", "cabal build all --enable-tests && echo 'Done'"],
99
"group": {
1010
"kind": "build",
1111
"isDefault": true
@@ -37,7 +37,7 @@
3737
"label": "Test",
3838
"type": "shell",
3939
"command": "bash",
40-
"args": ["-lc", "./project.sh test && echo 'Done'"],
40+
"args": ["-lc", "cabal test all --enable-tests && echo 'Done'"],
4141
"group": {
4242
"kind": "test",
4343
"isDefault": true

Diff for: hw-xml.cabal

+11-11
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,19 @@ source-repository head
2525

2626
common base { build-depends: base >= 4.11 && < 5 }
2727

28-
common ansi-wl-pprint { build-depends: ansi-wl-pprint >= 0.6.9 && < 0.7 }
28+
common prettyprinter { build-depends: prettyprinter >= 0.6.9 && < 2 }
2929
common array { build-depends: array >= 0.5.2.0 && < 0.6 }
3030
common attoparsec { build-depends: attoparsec >= 0.13.2.2 && < 0.15 }
31-
common bytestring { build-depends: bytestring >= 0.10.8.2 && < 0.12 }
31+
common bytestring { build-depends: bytestring >= 0.10.8.2 && < 0.13 }
3232
common cereal { build-depends: cereal >= 0.5.8.1 && < 0.6 }
33-
common containers { build-depends: containers >= 0.5.10.2 && < 0.7 }
33+
common containers { build-depends: containers >= 0.5.10.2 && < 0.8 }
3434
common criterion { build-depends: criterion >= 1.5.5.0 && < 1.7 }
35-
common deepseq { build-depends: deepseq >= 1.4.3.0 && < 1.5 }
36-
common doctest { build-depends: doctest >= 0.16.2 && < 0.21 }
35+
common deepseq { build-depends: deepseq >= 1.4.3.0 && < 1.6 }
36+
common doctest { build-depends: doctest >= 0.16.2 && < 0.23 }
3737
common doctest-discover { build-depends: doctest-discover >= 0.2 && < 0.3 }
3838
common generic-lens { build-depends: generic-lens >= 2.2 && < 2.3 }
39-
common ghc-prim { build-depends: ghc-prim >= 0.5 && < 0.10 }
40-
common hedgehog { build-depends: hedgehog >= 1.0 && < 1.3 }
39+
common ghc-prim { build-depends: ghc-prim >= 0.5 && < 0.12 }
40+
common hedgehog { build-depends: hedgehog >= 1.0 && < 1.5 }
4141
common hspec { build-depends: hspec >= 2.5 && < 3 }
4242
common hw-balancedparens { build-depends: hw-balancedparens >= 0.3.0.1 && < 0.5 }
4343
common hw-bits { build-depends: hw-bits >= 0.7.0.9 && < 0.8 }
@@ -49,9 +49,9 @@ common hw-rankselect-base { build-depends: hw-rankselect-base >=
4949
common lens { build-depends: lens >= 4.17.1 && < 6 }
5050
common mmap { build-depends: mmap >= 0.5.9 && < 0.6 }
5151
common mtl { build-depends: mtl >= 2.2.2 && < 3 }
52-
common optparse-applicative { build-depends: optparse-applicative >= 0.15.1.0 && < 0.18 }
53-
common resourcet { build-depends: resourcet >= 1.2.2 && < 1.3 }
54-
common text { build-depends: text >= 1.2.3.2 && < 2 }
52+
common optparse-applicative { build-depends: optparse-applicative >= 0.15.1.0 && < 0.19 }
53+
common resourcet { build-depends: resourcet >= 1.2.2 && < 2 }
54+
common text { build-depends: text >= 1.2.3.2 && < 3 }
5555
common transformers { build-depends: transformers >= 0.5 && < 0.7 }
5656
common vector { build-depends: vector >= 0.12.0.3 && < 0.14 }
5757
common word8 { build-depends: word8 >= 0.1.3 && < 0.2 }
@@ -64,7 +64,6 @@ common hw-xml
6464

6565
library
6666
import: base, config
67-
, ansi-wl-pprint
6867
, array
6968
, attoparsec
7069
, base
@@ -82,6 +81,7 @@ library
8281
, lens
8382
, mmap
8483
, mtl
84+
, prettyprinter
8585
, resourcet
8686
, text
8787
, transformers

Diff for: src/HaskellWorks/Data/Xml/RawValue.hs

+32-17
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{-# LANGUAGE MultiParamTypeClasses #-}
44
{-# LANGUAGE OverloadedStrings #-}
55
{-# LANGUAGE ScopedTypeVariables #-}
6+
{-# LANGUAGE TypeApplications #-}
67

78
module HaskellWorks.Data.Xml.RawValue
89
( RawValue(..)
@@ -15,7 +16,7 @@ import Data.Text (Text)
1516
import HaskellWorks.Data.Xml.Grammar
1617
import HaskellWorks.Data.Xml.Internal.Show
1718
import HaskellWorks.Data.Xml.Succinct.Index
18-
import Text.PrettyPrint.ANSI.Leijen hiding ((<$>), (<>))
19+
import Prettyprinter
1920

2021
import qualified Data.Attoparsec.ByteString.Char8 as ABC
2122
import qualified Data.ByteString as BS
@@ -34,35 +35,49 @@ data RawValue
3435
| RawError Text
3536
deriving (Eq, Show)
3637

38+
-- TODO use colors and styles
39+
40+
red :: Doc ann -> Doc ann
41+
red = id
42+
43+
dullwhite :: Doc ann -> Doc ann
44+
dullwhite = id
45+
46+
bold :: Doc ann -> Doc ann
47+
bold = id
48+
49+
dullgreen :: Doc ann -> Doc ann
50+
dullgreen = id
51+
3752
instance Pretty RawValue where
3853
pretty mjpv = case mjpv of
39-
RawText s -> ctext $ text (T.unpack s)
40-
RawAttrName s -> text (T.unpack s)
41-
RawAttrValue s -> (ctext . dquotes . text) (T.unpack s)
54+
RawText s -> ctext $ pretty (T.unpack s)
55+
RawAttrName s -> pretty (T.unpack s)
56+
RawAttrValue s -> (ctext . dquotes . pretty) (T.unpack s)
4257
RawAttrList ats -> formatAttrs ats
43-
RawComment s -> text $ "<!-- " <> show s <> "-->"
58+
RawComment s -> pretty $ "<!-- " <> show s <> "-->"
4459
RawElement s xs -> formatElem (T.unpack s) xs
4560
RawDocument xs -> formatMeta "?" "xml" xs
46-
RawError s -> red $ text "[error " <> text (T.unpack s) <> text "]"
47-
RawCData s -> cangle "<!" <> ctag (text "[CDATA[") <> text (T.unpack s) <> cangle (text "]]>")
61+
RawError s -> red $ "[error " <> pretty (T.unpack s) <> "]"
62+
RawCData s -> cangle "<!" <> ctag "[CDATA[" <> pretty (T.unpack s) <> cangle "]]>"
4863
RawMeta s xs -> formatMeta "!" (T.unpack s) xs
4964
where
5065
formatAttr at = case at of
51-
RawAttrName a -> text " " <> pretty (RawAttrName a)
52-
RawAttrValue a -> text "=" <> pretty (RawAttrValue a)
53-
RawAttrList _ -> red $ text "ATTRS"
54-
_ -> red $ text "booo"
66+
RawAttrName a -> " " <> pretty (RawAttrName a)
67+
RawAttrValue a -> "=" <> pretty (RawAttrValue a)
68+
RawAttrList _ -> red "ATTRS"
69+
_ -> red "booo"
5570
formatAttrs ats = hcat (formatAttr <$> ats)
5671
formatElem s xs =
5772
let (ats, es) = partition isAttrL xs
58-
in cangle langle <> ctag (text s)
73+
in cangle langle <> ctag (pretty s)
5974
<> hcat (pretty <$> ats)
6075
<> cangle rangle
6176
<> hcat (pretty <$> es)
62-
<> cangle (text "</") <> ctag (text s) <> cangle rangle
77+
<> cangle "</" <> ctag (pretty s) <> cangle rangle
6378
formatMeta b s xs =
6479
let (ats, es) = partition isAttr xs
65-
in cangle (langle <> text b) <> ctag (text s)
80+
in cangle (langle <> pretty @String b) <> ctag (pretty @String s)
6681
<> hcat (pretty <$> ats)
6782
<> cangle rangle
6883
<> hcat (pretty <$> es)
@@ -102,13 +117,13 @@ instance RawValueAt XmlIndex where
102117
ABC.Partial _ -> decodeErr "Unexpected end of attr name, expected" bs
103118
ABC.Done _ r -> Right r
104119

105-
cangle :: Doc -> Doc
120+
cangle :: Doc ann -> Doc ann
106121
cangle = dullwhite
107122

108-
ctag :: Doc -> Doc
123+
ctag :: Doc ann -> Doc ann
109124
ctag = bold
110125

111-
ctext :: Doc -> Doc
126+
ctext :: Doc ann -> Doc ann
112127
ctext = dullgreen
113128

114129
isAttrL :: RawValue -> Bool

0 commit comments

Comments
 (0)