Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 2b97232

Browse files
authored
Merge branch 'master' into remove-ekg
2 parents 1c828b3 + 81c26ad commit 2b97232

19 files changed

+209
-124
lines changed

.circleci/config.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ defaults: &defaults
1818

1919
- run:
2020
name: Create a composite cabal file for changes detection
21-
command: find . -name "*.cabal" | grep -v "stack-work" | xargs cat > all-cabal.txt
21+
command: find . -name "*.cabal" | grep -v -e "stack-work" -e "dist-newstyle" -e "submodules" -e "testdata" | sort | xargs cat > all-cabal.txt
2222

2323
- restore_cache:
2424
keys:
@@ -52,7 +52,7 @@ defaults: &defaults
5252

5353
- run:
5454
name: Generate Hoogle database
55-
command: stack --stack-yaml=${STACK_FILE} exec hoogle generate
55+
command: if [ ! -d ~/.hoogle ]; then stack --stack-yaml=${STACK_FILE} exec hoogle generate; fi
5656

5757
- run:
5858
name: Clear cabal-helper cache
@@ -63,6 +63,7 @@ defaults: &defaults
6363
paths: &cache_paths
6464
- ~/.stack
6565
- ~/.cache
66+
- ~/.hoogle
6667
- ~/build/.stack-work
6768
- ~/build/hie-plugin-api/.stack-work
6869
- ~/build/submodules/HaRe/.stack-work
@@ -78,6 +79,9 @@ defaults: &defaults
7879
command: stack -j 1 --stack-yaml=${STACK_FILE} test --dump-logs
7980
no_output_timeout: 120m
8081

82+
- store_test_results:
83+
path: test-results
84+
8185
- store_artifacts:
8286
path: test-logs
8387

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ dist-newstyle/
6161
dist
6262
tags
6363
test-logs/
64+
test-results/
6465
.DS_Store
6566

6667
.hspec-failures

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ hie-%: submodules cabal
3737

3838
## Updates local git submodules
3939
submodules:
40-
git submodule sync
41-
git submodule update --init
40+
git submodule sync --recursive
41+
git submodule update --init --recursive
4242
.PHONY: submodules
4343

4444
# ------------------------------------------------------

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
[badge-license]: https://img.shields.io/badge/license-BSD3-green.svg?dummy
99
[license]: https://github.com/haskell/haskell-ide-engine/blob/master/LICENSE
10-
[badge-circleci]: https://img.shields.io/circleci/project/github/haskell/haskell-ide-engine.svg
10+
[badge-circleci]: https://img.shields.io/circleci/project/github/haskell/haskell-ide-engine/master.svg
1111
[circleci]: https://circleci.com/gh/haskell/haskell-ide-engine/
1212
[badge-appveyor]: https://ci.appveyor.com/api/projects/status/6hit7mxvgdrao3q0?svg=true
1313
[appveyor]: https://ci.appveyor.com/project/Bubba/haskell-ide-engine-74xec

Shakefile.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type GhcPath = String
2929
-- |Defines all different hie versions that are buildable.
3030
-- If they are edited,
3131
hieVersions :: [VersionNumber]
32-
hieVersions = ["8.2.2", "8.4.3", "8.4.4", "8.6.1", "8.6.2", "8.6.3"]
32+
hieVersions = ["8.2.1", "8.2.2", "8.4.2", "8.4.3", "8.4.4", "8.6.1", "8.6.2", "8.6.3"]
3333

3434
-- |Most recent version of hie.
3535
-- Important for `dist`, the `hie-wrapper` of the most recent hie
@@ -129,8 +129,8 @@ buildIcuMacosFix version = execStackWithYaml_
129129

130130
updateSubmodules :: Action ()
131131
updateSubmodules = do
132-
command_ [] "git" ["submodule", "sync"]
133-
command_ [] "git" ["submodule", "update", "--init"]
132+
command_ [] "git" ["submodule", "sync", "--recursive"]
133+
command_ [] "git" ["submodule", "update", "--init", "--recursive"]
134134

135135
installCabal :: GhcPath -> Action ()
136136
installCabal ghc = do

cabal.project

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ packages:
77
./submodules/cabal-helper/
88
./submodules/ghc-mod/
99
./submodules/ghc-mod/core/
10-

docs/CircleCI.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# CircleCI
2+
3+
## Jobs
4+
5+
For each version of GHC supported, CircleCI will kick off a build that will build and test HIE for that version.
6+
Whenever a new stack-x.y.z is added, be sure to also add it to both the `workflow` and `jobs` sections of `config.yml`.
7+
8+
In addition to the stack based jobs, there is also a job that builds HIE with `cabal new-build`.
9+
Currently tests are not run as there is an issue with cabal-helper-wrapper that prevents any ghc-mod tests from passing.
10+
11+
## Docker
12+
13+
Each job is carried out in a Docker container built from https://github.com/alanz/haskell-dockerfiles/blob/master/haskell-hie-ci/Dockerfile
14+
15+
## Caching
16+
17+
Since HIE takes a long time to build, CI caches things very liberally.
18+
Most importantly, the `~/.stack-work` directories for HIE as well as every submodule are cached before and after testing (This is so that if the build passes but the tests fail there is still something cached for the next build).
19+
20+
### Change detection
21+
22+
Before restoring any cache, the CircleCI job creates three files and uses their checksum to detect any changes:
23+
24+
1. `all-cabal.txt` detects any changes to `.cabal` files (not in submodules or test data)
25+
2. `stack-build.txt` detects any changes to the `stack-x.y.z` file
26+
3. `resolver.txt` detects any changes to the stack resolver
27+
28+
Each job will tries to restore the most specific cache avaialble for it, and fallback to a more general cache if not available:
29+
30+
31+
```yaml
32+
- restore_cache:
33+
keys:
34+
- stack-cache-{{ .Environment.HIE_CACHE }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "stack-build.txt" }}-{{ checksum "all-cabal.txt" }}
35+
- stack-cache-{{ .Environment.HIE_CACHE }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "stack-build.txt" }}
36+
- stack-cache-{{ .Environment.HIE_CACHE }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "resolver.txt" }}
37+
```
38+
39+
## Invalidating the cache
40+
41+
If you need to clear the cache on CircleCI, bump the `$HIE_CACHE` environment variable via the CircleCI web interface and rerun the workflow.

haskell-ide-engine.cabal

Lines changed: 33 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ executable hie
109109
, hie-plugin-api
110110
, hslogger
111111
, optparse-simple
112-
, stm
113112
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Wredundant-constraints
114113
-with-rtsopts=-T
115114
if flag(pedantic)
@@ -136,11 +135,35 @@ executable hie-wrapper
136135
ghc-options: -Werror
137136
default-language: Haskell2010
138137

138+
library hie-test-utils
139+
hs-source-dirs: test/utils
140+
exposed-modules: TestUtils
141+
build-depends: base
142+
, haskell-ide-engine
143+
, haskell-lsp
144+
, hie-plugin-api
145+
, aeson
146+
, blaze-markup
147+
, containers
148+
, data-default
149+
, directory
150+
, filepath
151+
, ghc-mod-core
152+
, hslogger
153+
, hspec
154+
, hspec-core
155+
, stm
156+
, text
157+
, unordered-containers
158+
, yaml
159+
ghc-options: -Wall -Wredundant-constraints
160+
if flag(pedantic)
161+
ghc-options: -Werror
162+
default-language: Haskell2010
139163

140164
test-suite unit-test
141165
type: exitcode-stdio-1.0
142166
hs-source-dirs: test/unit
143-
, test/utils
144167
main-is: Main.hs
145168
other-modules: ApplyRefactPluginSpec
146169
BrittanySpec
@@ -153,8 +176,6 @@ test-suite unit-test
153176
HooglePluginSpec
154177
JsonSpec
155178
Spec
156-
157-
TestUtils
158179
build-depends: QuickCheck
159180
, aeson
160181
, base
@@ -163,25 +184,16 @@ test-suite unit-test
163184
, directory
164185
, filepath
165186
, free
166-
, haskell-lsp
167187
, haskell-ide-engine
168-
-- , hie-test-utils
188+
, haskell-lsp-types >= 0.4
189+
, hie-test-utils
169190
, hie-plugin-api
170191
, hoogle > 5.0.11
171192
, hspec
172193
, quickcheck-instances
173-
, stm
174194
, text
175195
, unordered-containers
176196

177-
-- remove these once hie-test-utils is reinstated
178-
, data-default
179-
, hie-plugin-api
180-
, ghc-mod-core
181-
, hslogger
182-
, yaml
183-
-- don't multithread i.e. --with-rtsopts=-N
184-
-- otherwise ghc-mod operations become super slow on CircleCI
185197
ghc-options: -Wall -Wredundant-constraints
186198
if flag(pedantic)
187199
ghc-options: -Werror
@@ -191,31 +203,22 @@ test-suite unit-test
191203
test-suite dispatcher-test
192204
type: exitcode-stdio-1.0
193205
hs-source-dirs: test/dispatcher
194-
test/utils
195206
main-is: Main.hs
196-
other-modules: TestUtils
197207
build-depends: base
198208
, aeson
199-
, containers
200209
, data-default
201210
, directory
202211
, filepath
203212
, ghc
204-
, haskell-lsp
205213
, haskell-ide-engine
206-
-- , hie-test-utils
214+
, haskell-lsp-types
215+
, hie-test-utils
207216
, hie-plugin-api
208217
, hspec
209218
, stm
210219
, text
211220
, unordered-containers
212221

213-
-- remove these once hie-test-utils is reinstated
214-
, hie-plugin-api
215-
, ghc-mod-core
216-
, hslogger
217-
, unordered-containers
218-
, yaml
219222
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Wredundant-constraints
220223
if flag(pedantic)
221224
ghc-options: -Werror
@@ -225,63 +228,25 @@ test-suite dispatcher-test
225228
test-suite plugin-dispatcher-test
226229
type: exitcode-stdio-1.0
227230
hs-source-dirs: test/plugin-dispatcher
228-
test/utils
229231
main-is: Main.hs
230-
other-modules: TestUtils
231232
build-depends: base
232-
, aeson
233-
, containers
234233
, data-default
235-
, directory
236-
, filepath
237-
, ghc
238-
, haskell-lsp
239234
, haskell-ide-engine
240-
-- , hie-test-utils
235+
, haskell-lsp-types
241236
, hie-plugin-api
237+
, hie-test-utils
242238
, hspec
243239
, stm
244240
, text
245-
, unordered-containers
246241

247-
-- remove these once hie-test-utils is reinstated
248-
, hie-plugin-api
249-
, ghc-mod-core
250-
, hslogger
251-
, unordered-containers
252-
, yaml
253242
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Wredundant-constraints
254243
if flag(pedantic)
255244
ghc-options: -Werror
256245
default-language: Haskell2010
257246

258-
-- library hie-test-utils
259-
-- hs-source-dirs: test/utils
260-
-- exposed-modules: TestUtils
261-
-- build-depends: base
262-
-- , haskell-ide-engine
263-
-- , haskell-lsp
264-
-- , hie-plugin-api
265-
-- , aeson
266-
-- , containers
267-
-- , data-default
268-
-- , directory
269-
-- , filepath
270-
-- , ghc-mod-core
271-
-- , hslogger
272-
-- , hspec
273-
-- , text
274-
-- , unordered-containers
275-
-- , yaml
276-
-- ghc-options: -Wall -Wredundant-constraints
277-
-- if flag(pedantic)
278-
-- ghc-options: -Werror
279-
-- default-language: Haskell2010
280-
281247
test-suite func-test
282248
type: exitcode-stdio-1.0
283249
hs-source-dirs: test/functional
284-
, test/utils
285250
main-is: Main.hs
286251
other-modules: CompletionSpec
287252
, CommandSpec
@@ -300,33 +265,22 @@ test-suite func-test
300265
, RenameSpec
301266
, SymbolsSpec
302267
, Utils
303-
304-
, TestUtils
305268
-- This cannot currently be handled by hie (cabal-helper)
306269
-- build-tool-depends: haskell-ide-engine:hie
307270
build-depends: aeson
308271
, base
309-
, containers
310272
, data-default
311273
, directory
312274
, filepath
313275
, lsp-test == 0.5.*
314276
, haskell-ide-engine
315-
-- , hie-test-utils
277+
, haskell-lsp-types >= 0.4
278+
, hie-test-utils
316279
, hie-plugin-api
317280
, hspec
318281
, lens
319-
, stm
320282
, text
321283
, unordered-containers
322-
323-
-- remove these once hie-test-utils is reinstated
324-
, hie-plugin-api
325-
, ghc-mod-core
326-
, hslogger
327-
, unordered-containers
328-
, yaml
329-
, haskell-lsp
330284
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Wredundant-constraints
331285
if flag(pedantic)
332286
ghc-options: -Werror

stack-8.6.1.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ extra-deps:
3131
- temporary-1.2.1.1
3232
- yaml-0.8.32
3333

34-
3534
flags:
3635
haskell-ide-engine:
3736
pedantic: true

stack-8.6.3.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ extra-deps:
2121
- temporary-1.2.1.1
2222
- yaml-0.8.32
2323

24-
2524
flags:
2625
haskell-ide-engine:
2726
pedantic: true

test/dispatcher/Main.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import System.Directory
2323
import System.FilePath
2424

2525
import Test.Hspec
26+
import Test.Hspec.Runner
2627

2728
-- ---------------------------------------------------------------------
2829
-- plugins
@@ -40,8 +41,9 @@ import Haskell.Ide.Engine.Plugin.HieExtras
4041
main :: IO ()
4142
main = do
4243
setupStackFiles
44+
config <- getHspecFormattedConfig "dispatcher"
4345
withFileLogging "main-dispatcher.log" $ do
44-
hspec funcSpec
46+
hspecWith config funcSpec
4547

4648
-- main :: IO ()
4749
-- main = do

0 commit comments

Comments
 (0)