Skip to content

Commit ec6790e

Browse files
authored
Fixup packaging, stack-nightly, CI setup
* Configure fourmolu * Re-organize package configuration * Update GHA setup * Behavior-neutral formatting changes * hspec-core-2.10/11 compatibility - The closed imports allow compatibility with <=2.9 and >2.10 - And a touch of CPP for a new constructor in 2.11 * Use hspec-golden
1 parent 5217b8f commit ec6790e

35 files changed

+477
-355
lines changed

.github/workflows/ci.yml

+9-22
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,27 @@ jobs:
1212
strategy:
1313
matrix:
1414
stack-yaml:
15-
- stack.yaml # ghc-9.0
15+
- stack-nightly.yaml # ghc-9.6
16+
- stack.yaml # ghc-9.4
17+
- stack-lts-20.26.yaml # ghc-9.2
18+
- stack-lts-19.33.yaml # ghc-9.0
1619
- stack-lts-18.28.yaml # ghc-8.10
1720
- stack-lts-16.31.yaml # ghc-8.8
1821
- stack-lts-14.27.yaml # ghc-8.6
1922
- stack-lts-12.26.yaml # ghc-8.4
2023
fail-fast: false
2124

2225
steps:
23-
- uses: actions/checkout@v2
24-
- uses: freckle/stack-cache-action@v2
26+
- uses: actions/checkout@v4
27+
- uses: freckle/stack-action@v4
2528
with:
2629
stack-yaml: ${{ matrix.stack-yaml }}
27-
- uses: freckle/stack-action@v3
28-
with:
29-
stack-yaml: ${{ matrix.stack-yaml }}
30-
31-
nightly:
32-
runs-on: ubuntu-latest
33-
34-
steps:
35-
- uses: actions/checkout@v2
36-
- uses: freckle/stack-cache-action@v2
37-
with:
38-
stack-yaml: stack-nightly.yaml
39-
- uses: freckle/stack-action@v3
40-
with:
41-
stack-yaml: stack-nightly.yaml
42-
stack-arguments: --resolver nightly
4330

4431
lint:
4532
runs-on: ubuntu-latest
4633
steps:
47-
- uses: actions/checkout@v2
48-
- uses: rwe/actions-hlint-setup@v1
49-
- uses: rwe/actions-hlint-run@v2
34+
- uses: actions/checkout@v4
35+
- uses: haskell/actions/hlint-setup@v2
36+
- uses: haskell/actions/hlint-run@v2
5037
with:
5138
fail-on: warning

.restyled.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
exclude:
2-
- "tests/golden.xml"
2+
- "tests/golden/**/*.xml"
3+
4+
restylers:
5+
- fourmolu
6+
- "!stylish-haskell"
7+
- "*"

README.lhs

+15
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,21 @@ spec = describe "Addition" $ do
3737
2 + 2 `shouldBe` (4 :: Int)
3838
```
3939
40+
## Golden Testing
41+
42+
This project's test suite uses [hspec-golden][] to generate an XML report for
43+
[`ExampleSpec.hs`](./tests/ExampleSpec.hs) and then compare that with golden XML
44+
files checked into the repository. If your work changes things in a
45+
functionally-correct way, but that diverges from the golden XML files, you need
46+
to regenerate them.
47+
48+
1. Run `rm tests/golden*.xml`
49+
2. Run the specs again
50+
51+
We maintain specific golden XML files for GHC 8.x vs 9.x, so you will need to
52+
re-run the test suite with at least one of each series to regenerate all the
53+
necessary files.
54+
4055
---
4156
4257
[LICENSE](./LICENSE)

fourmolu.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
indentation: 2
2+
column-limit: 80 # ignored until v12 / ghc-9.6
3+
function-arrows: leading
4+
comma-style: leading # default
5+
import-export-style: leading
6+
indent-wheres: false # default
7+
record-brace-space: true
8+
newlines-between-decls: 1 # default
9+
haddock-style: single-line
10+
let-style: mixed
11+
in-style: left-align
12+
single-constraint-parens: never # ignored until v12 / ghc-9.6
13+
unicode: never # default
14+
respectful: true # default
15+
fixities: [] # default

hspec-junit-formatter.cabal

+29-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
cabal-version: 1.12
1+
cabal-version: 1.18
22

33
-- This file has been generated from package.yaml by hpack version 0.35.2.
44
--
55
-- see: https://github.com/sol/hpack
6-
--
7-
-- hash: 9b45343fdd935eeda31250fd2c6d69dfeb98841cb8ea89c23841ff7612e35b74
86

97
name: hspec-junit-formatter
108
version: 1.1.0.2
@@ -20,12 +18,13 @@ license: MIT
2018
license-file: LICENSE
2119
build-type: Simple
2220
extra-source-files:
21+
tests/golden/default-ghc-8.xml
22+
tests/golden/default-ghc-9.xml
23+
tests/golden/prefixed-ghc-8.xml
24+
tests/golden/prefixed-ghc-9.xml
25+
extra-doc-files:
2326
README.md
2427
CHANGELOG.md
25-
tests/golden-ghc-9.xml
26-
tests/golden-prefixed-ghc-9.xml
27-
tests/golden-prefixed.xml
28-
tests/golden.xml
2928

3029
source-repository head
3130
type: git
@@ -67,6 +66,7 @@ library
6766
StandaloneDeriving
6867
TypeApplications
6968
TypeFamilies
69+
ghc-options: -fignore-optim-changes -Weverything -Wno-all-missed-specialisations -Wno-missed-specialisations -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-safe -Wno-unsafe
7070
build-depends:
7171
array
7272
, base <5
@@ -78,12 +78,18 @@ library
7878
, hspec-core >=2.8.1
7979
, iso8601-time
8080
, regex-base
81-
, regex-tdfa >= 1.3.1
81+
, regex-tdfa
8282
, text
8383
, time
8484
, xml-conduit
8585
, xml-types
8686
default-language: Haskell2010
87+
if impl(ghc >= 9.2)
88+
ghc-options: -Wno-missing-kind-signatures
89+
if impl(ghc >= 8.10)
90+
ghc-options: -Wno-missing-safe-haskell-mode -Wno-prepositive-qualified-module
91+
if impl(ghc >= 8.8)
92+
ghc-options: -fwrite-ide-info
8793

8894
test-suite readme
8995
type: exitcode-stdio-1.0
@@ -114,13 +120,19 @@ test-suite readme
114120
StandaloneDeriving
115121
TypeApplications
116122
TypeFamilies
117-
ghc-options: -pgmL markdown-unlit
123+
ghc-options: -fignore-optim-changes -Weverything -Wno-all-missed-specialisations -Wno-missed-specialisations -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-safe -Wno-unsafe -pgmL markdown-unlit
118124
build-depends:
119125
base <5
120126
, hspec
121127
, hspec-junit-formatter
122128
, markdown-unlit
123129
default-language: Haskell2010
130+
if impl(ghc >= 9.2)
131+
ghc-options: -Wno-missing-kind-signatures
132+
if impl(ghc >= 8.10)
133+
ghc-options: -Wno-missing-safe-haskell-mode -Wno-prepositive-qualified-module
134+
if impl(ghc >= 8.8)
135+
ghc-options: -fwrite-ide-info
124136

125137
test-suite spec
126138
type: exitcode-stdio-1.0
@@ -154,14 +166,21 @@ test-suite spec
154166
StandaloneDeriving
155167
TypeApplications
156168
TypeFamilies
157-
ghc-options: -threaded -rtsopts -O0 "-with-rtsopts=-N"
169+
ghc-options: -fignore-optim-changes -Weverything -Wno-all-missed-specialisations -Wno-missed-specialisations -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-safe -Wno-unsafe -threaded -rtsopts -O0 "-with-rtsopts=-N"
158170
build-depends:
159171
base <5
160172
, containers
161173
, filepath
162174
, hspec
175+
, hspec-golden
163176
, hspec-junit-formatter
164177
, temporary
165178
, text
166179
, xml-conduit
167180
default-language: Haskell2010
181+
if impl(ghc >= 9.2)
182+
ghc-options: -Wno-missing-kind-signatures
183+
if impl(ghc >= 8.10)
184+
ghc-options: -Wno-missing-safe-haskell-mode -Wno-prepositive-qualified-module
185+
if impl(ghc >= 8.8)
186+
ghc-options: -fwrite-ide-info

library/Test/Hspec/Core/Runner/Ext.hs

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55
-- This feature is only available in hspec >= 2.9. Note that this module doesn't
66
-- do anything to backport the feature; it just supplies a function that will
77
-- use it when possible and safely no-op when not.
8-
--
98
module Test.Hspec.Core.Runner.Ext
109
( configAddAvailableFormatter
1110
) where
1211

1312
import Prelude
1413

1514
import Test.Hspec.Core.Format (Format, FormatConfig)
16-
import Test.Hspec.Core.Runner (Config(..))
15+
import Test.Hspec.Core.Runner (Config (..))
1716

1817
configAddAvailableFormatter
1918
:: String -> (FormatConfig -> IO Format) -> Config -> Config

0 commit comments

Comments
 (0)