Skip to content

Commit a565e3e

Browse files
authored
GitHub test action (haskell/ghcide#903)
* Add github test action * Disable unreliable test Does not work reliably on all platforms. Reenable when haskell/ghcide#861 lands * Add hlint and -Werror * Explicit timeout 6h is the default and also the maximum: https://docs.github.com/en/free-pro-team@latest/actions/reference/usage-limits-billing-and-administration * Experiment tests to use Cabal instead of Stack * Fix an unreliable test * Trim down matrix * Add ghc-lib to the test matrix * Address broken hie-compat ghc-lib build * Drop stack descriptor family We keep two stack descriptors: - One for Nightly - One for Windows (stuck in GHC 8.10.1) To ensure that `stack test` doesn't break, we keep running the stack tests in CI * Update README to point end users to HLS * Drop support for `stack test`
1 parent da7e721 commit a565e3e

File tree

12 files changed

+141
-217
lines changed

12 files changed

+141
-217
lines changed

.azure/linux-stack.yml

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,19 @@ jobs:
33
timeoutInMinutes: 60
44
pool:
55
vmImage: 'ubuntu-latest'
6-
strategy:
7-
matrix:
8-
stack_810:
9-
STACK_YAML: "stack810.yaml"
10-
stack_88:
11-
STACK_YAML: "stack88.yaml"
12-
stack_86:
13-
STACK_YAML: "stack.yaml"
14-
stack_ghc_lib_88:
15-
STACK_YAML: "stack-ghc-lib.yaml"
166
variables:
177
STACK_ROOT: $(Pipeline.Workspace)/.stack
188
steps:
199
- checkout: self
2010
- task: Cache@2
2111
inputs:
22-
key: stack-root-cache | $(Agent.OS) | $(Build.SourcesDirectory)/$(STACK_YAML) | $(Build.SourcesDirectory)/ghcide.cabal
12+
key: stack-root-cache | $(Agent.OS) | $(Build.SourcesDirectory)/stack.yaml | $(Build.SourcesDirectory)/ghcide.cabal
2313
path: $(STACK_ROOT)
2414
cacheHitVar: STACK_ROOT_CACHE_RESTORED
2515
displayName: "Cache stack root"
2616
- task: Cache@2
2717
inputs:
28-
key: stack-work-cache | $(Agent.OS) | $(Build.SourcesDirectory)/$(STACK_YAML) | $(Build.SourcesDirectory)/ghcide.cabal
18+
key: stack-work-cache | $(Agent.OS) | $(Build.SourcesDirectory)/stack.yaml | $(Build.SourcesDirectory)/ghcide.cabal
2919
path: .stack-work
3020
cacheHitVar: STACK_WORK_CACHE_RESTORED
3121
displayName: "Cache stack work"
@@ -41,14 +31,9 @@ jobs:
4131
fi
4232
mkdir -p $STACK_ROOT
4333
displayName: 'Install Stack'
44-
- bash: stack setup --stack-yaml=$STACK_YAML
34+
- bash: stack setup
4535
displayName: 'stack setup'
4636
- bash: cabal update # some tests use Cabal cradles
4737
displayName: 'cabal update'
48-
- bash: stack build --test --only-dependencies --stack-yaml=$STACK_YAML
49-
displayName: 'stack build --test --only-dependencies'
50-
- bash: |
51-
export PATH=/opt/cabal/bin:$PATH
52-
stack test --ghc-options=-Werror --stack-yaml=$STACK_YAML --ta "--rerun-update" || stack test --ghc-options=-Werror --stack-yaml=$STACK_YAML --ta "--rerun" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true stack test --ghc-options=-Werror --stack-yaml=$STACK_YAML --ta "--rerun"
53-
# ghcide stack tests are flaky, see https://github.com/digital-asset/daml/issues/2606.
54-
displayName: 'stack test --ghc-options=-Werror'
38+
- bash: stack build --test --no-run-tests
39+
displayName: 'stack build --test --no-run-tests'

.azure/windows-stack.yml

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,19 @@ jobs:
33
timeoutInMinutes: 120
44
pool:
55
vmImage: 'windows-2019'
6-
strategy:
7-
matrix:
8-
stack_810:
9-
STACK_YAML: "stack8101.yaml"
10-
stack_88:
11-
STACK_YAML: "stack88.yaml"
12-
stack_86:
13-
STACK_YAML: "stack.yaml"
14-
stack_ghc_lib_88:
15-
STACK_YAML: "stack-ghc-lib.yaml"
166
variables:
177
STACK_ROOT: "C:\\sr"
188
steps:
199
- checkout: self
2010
- task: Cache@2
2111
inputs:
22-
key: stack-root-cache | $(Agent.OS) | $(Build.SourcesDirectory)/$(STACK_YAML) | $(Build.SourcesDirectory)/ghcide.cabal
12+
key: stack-root-cache | $(Agent.OS) | $(Build.SourcesDirectory)/stack-windows.yaml | $(Build.SourcesDirectory)/ghcide.cabal
2313
path: $(STACK_ROOT)
2414
cacheHitVar: STACK_ROOT_CACHE_RESTORED
2515
displayName: "Cache stack root"
2616
- task: Cache@2
2717
inputs:
28-
key: stack-work-cache | $(Agent.OS) | $(Build.SourcesDirectory)/$(STACK_YAML) | $(Build.SourcesDirectory)/ghcide.cabal
18+
key: stack-work-cache | $(Agent.OS) | $(Build.SourcesDirectory)/stack-windows.yaml | $(Build.SourcesDirectory)/ghcide.cabal
2919
path: .stack-work
3020
cacheHitVar: STACK_WORK_CACHE_RESTORED
3121
displayName: "Cache stack work"
@@ -37,22 +27,15 @@ jobs:
3727
unzip -o /usr/bin/stack.zip -d /usr/bin/
3828
mkdir -p "$STACK_ROOT"
3929
displayName: 'Install Stack'
40-
- bash: stack setup --stack-yaml $STACK_YAML
30+
- bash: stack setup --stack-yaml stack-windows.yaml
4131
displayName: 'stack setup'
4232
- bash: |
4333
# Installing happy and alex standalone to avoid error "strip.exe: unable to rename ../*.exe; reason: File exists"
44-
stack install happy --stack-yaml $STACK_YAML
45-
stack install alex --stack-yaml $STACK_YAML
34+
stack install happy --stack-yaml stack-windows.yaml
35+
stack install alex --stack-yaml stack-windows.yaml
4636
choco install -y cabal --version=$CABAL_VERSION
4737
$(cygpath $ProgramData)/chocolatey/bin/RefreshEnv.cmd
4838
# GHC 8.10.1 fails with ghc segfaults, using -fexternal-interpreter seems to make it working
4939
# There are other transient errors like timeouts downloading from stackage so we retry 3 times
50-
if [ "$STACK_YAML" = "stack8101.yaml" ]; then
51-
stack build --only-dependencies --stack-yaml $STACK_YAML --ghc-options="-fexternal-interpreter" || stack build --only-dependencies --stack-yaml $STACK_YAML --ghc-options="-fexternal-interpreter" || stack build --only-dependencies --stack-yaml $STACK_YAML --ghc-options="-fexternal-interpreter"
52-
else
53-
stack build --only-dependencies --stack-yaml $STACK_YAML || stack build --only-dependencies --stack-yaml $STACK_YAML || stack build --only-dependencies --stack-yaml $STACK_YAML
54-
fi
55-
displayName: 'stack build --only-dependencies'
56-
- bash: |
57-
stack test --ghc-options=-Werror --stack-yaml $STACK_YAML --ta "--rerun-update" || stack test --ghc-options=-Werror --stack-yaml=$STACK_YAML --ta "--rerun" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true stack test --ghc-options=-Werror --stack-yaml=$STACK_YAML --ta "--rerun"
58-
displayName: 'stack test --ghc-options=-Werror'
40+
stack build --test --no-run-tests --stack-yaml stack-windows.yaml --ghc-options="-fexternal-interpreter" || stack build --test --no-run-tests --stack-yaml stack-windows.yaml --ghc-options="-fexternal-interpreter" || stack build --test --no-run-tests --stack-yaml stack-windows.yaml --ghc-options="-fexternal-interpreter"
41+
displayName: 'stack build --test'

.github/workflows/bench.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,11 @@ jobs:
2222

2323
- name: Cache Cabal
2424
uses: actions/cache@v2
25-
env:
26-
cache-name: cache-cabal
2725
with:
28-
path: ~/.cabal/
29-
key: ${{ runner.os }}-${{ matrix.ghc }}-build-${{ env.cache-name }}-${{ hashFiles('ghcide.cabal', 'cabal.project') }}
30-
restore-keys: |
31-
${{ runner.os }}-${{ matrix.ghc }}-build-${{ env.cache-name }}-
32-
${{ runner.os }}-${{ matrix.ghc }}-build-
33-
${{ runner.os }}-${{ matrix.ghc }}
26+
path: |
27+
~/.cabal/packages
28+
~/.cabal/store
29+
key: ${{ runner.os }}-${{ matrix.ghc }}-cabal-bench
3430

3531
- run: cabal update
3632

.github/workflows/test.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Testing
2+
3+
on: [push, pull_request]
4+
jobs:
5+
test:
6+
timeout-minutes: 360
7+
runs-on: ${{ matrix.os }}
8+
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
os: [macOS-latest, ubuntu-latest, windows-latest]
13+
ghc: ['8.10.2', '8.8.4', '8.6.5']
14+
ghc-lib: [false]
15+
exclude:
16+
- os: windows-latest
17+
ghc: '8.10.2' # broken due to https://gitlab.haskell.org/ghc/ghc/-/issues/18550
18+
- os: windows-latest
19+
ghc: '8.8.4' # also fails due to segfault :(
20+
include:
21+
- os: windows-latest
22+
ghc: '8.10.1'
23+
- os: ubuntu-latest
24+
ghc: '8.10.1'
25+
ghc-lib: true
26+
27+
steps:
28+
- uses: actions/checkout@v2
29+
- uses: actions/[email protected]
30+
with:
31+
ghc-version: ${{ matrix.ghc }}
32+
cabal-version: '3.2'
33+
34+
- run: ./fmt.sh
35+
name: "HLint via ./fmt.sh"
36+
37+
- name: Cache Cabal
38+
uses: actions/cache@v2
39+
with:
40+
path: |
41+
~/.cabal/packages
42+
~/.cabal/store
43+
key: ${{ runner.os }}-${{ matrix.ghc }}-{{matrix.ghc-lib}}-cabal-test
44+
45+
- run: cabal update
46+
47+
- name: cabal.project.local
48+
run: |
49+
echo "tests: True" > cabal.project.local
50+
echo "package ghcide" >> cabal.project.local
51+
echo " ghc-options: -Werror" >> cabal.project.local
52+
53+
- name: ghc-lib
54+
if: ${{ matrix.ghc-lib }}
55+
run: |
56+
echo " flags: ghc-lib" >> cabal.project.local
57+
echo "package hie-compat" >> cabal.project.local
58+
echo " flags: ghc-lib" >> cabal.project.local
59+
60+
- name: Build
61+
shell: bash
62+
# Retry it three times to workaround compiler segfaults in windows
63+
run: cabal build || cabal build || cabal build
64+
65+
- name: Test
66+
shell: bash
67+
# run the tests without parallelism to avoid running out of memory
68+
run: cabal test --test-options="-j1 --rerun-update" || cabal test --test-options="-j1 --rerun" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test --test-options="-j1 --rerun"
69+
if: ${{ !matrix.ghc-lib}}

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ a simple reproduction of the bug.
4646

4747
### Install `ghcide`
4848

49+
[We recommend](https://neilmitchell.blogspot.com/2020/09/dont-use-ghcide-anymore-directly.html) installing and using the Haskell extension in VS Code, or the prebuilt binaries provided by https://github.com/haskell/haskell-language-server
50+
51+
If you still wish to install `ghcide` direcly, the instructions below might prove useful *but you are on your own*.
52+
4953
#### With Nix
5054

5155
Note that you need to compile `ghcide` with the same `ghc` as the project you are working on.
@@ -317,13 +321,15 @@ args = ["--lsp"]
317321

318322
## Hacking on ghcide
319323

320-
To build and work on `ghcide` itself, you can use Stack or cabal, e.g.,
321-
running `stack test` will execute the test suite.
324+
To build and work on `ghcide` itself, you should use cabal, e.g.,
325+
running `cabal test` will execute the test suite. You can use `stack test` too, but
326+
note that some tests will fail, and none of the maintainers are currently using `stack`.
327+
322328
If you are using Windows, you should disable the `auto.crlf` setting and configure your editor to use LF line endings, directly or making it use the existing `.editor-config`.
323329

324330
If you are chasing down test failures, you can use the tasty-rerun feature by running tests as
325331

326-
stack --stack-yaml=stack84.yaml test --test-arguments "--rerun"
332+
cabal test --test-options"--rerun"
327333

328334
This writes a log file called `.tasty-rerun-log` of the failures, and only runs those.
329335
See the [tasty-rerun](https://hackage.haskell.org/package/tasty-rerun-1.1.17/docs/Test-Tasty-Ingredients-Rerun.html) documentation for other options.
@@ -332,12 +338,9 @@ If you are touching performance sensitive code, take the time to run a different
332338
benchmark between HEAD and master using the benchHist script. This assumes that
333339
"master" points to the upstream master.
334340

335-
Run the benchmarks with `stack`:
336-
337-
export STACK_YAML=...
338-
stack bench
341+
Run the benchmarks with `cabal bench`.
339342

340-
It should take around 15 minutes and the results will be stored in the `bench-hist` folder. To interpret the results, see the comments in the `bench/hist/Main.hs` module.
343+
It should take around 15 minutes and the results will be stored in the `bench-results` folder. To interpret the results, see the comments in the `bench/hist/Main.hs` module.
341344

342345
More details in [bench/README](bench/README.md)
343346

hie-compat/hie-compat.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ library
3838

3939
if (impl(ghc > 8.5) && impl(ghc < 8.7) && !flag(ghc-lib))
4040
hs-source-dirs: src-ghc86
41-
if ((impl(ghc > 8.7) && impl(ghc < 8.10)) || flag(ghc-lib))
41+
if (impl(ghc > 8.7) && impl(ghc < 8.10))
4242
hs-source-dirs: src-ghc88 src-reexport
43-
if (impl(ghc > 8.9) && impl(ghc < 8.11))
43+
if (impl(ghc > 8.9) && impl(ghc < 8.11) || flag(ghc-lib))
4444
hs-source-dirs: src-ghc810 src-reexport
4545

stack-ghc-lib.yaml

Lines changed: 0 additions & 30 deletions
This file was deleted.

stack8101.yaml renamed to stack-windows.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,3 @@ extra-deps:
3030

3131
nix:
3232
packages: [zlib]
33-
34-
ghc-options:
35-
ghcide: -DSTACK

stack.yaml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
1-
resolver: nightly-2019-09-21
1+
resolver: nightly-2020-09-02
2+
allow-newer: true
23
packages:
34
- .
45
- ./hie-compat/
56
extra-deps:
6-
- aeson-1.4.6.0
77
- haskell-lsp-0.22.0.0
88
- haskell-lsp-types-0.22.0.0
99
- lsp-test-0.11.0.6
10-
- hie-bios-0.7.1@rev:2
10+
- ghc-check-0.5.0.1
11+
- hie-bios-0.7.1
12+
13+
# not yet in stackage
14+
- Chart-diagrams-1.9.3
15+
- SVGFonts-1.7.0.1
16+
- diagrams-1.4
17+
- diagrams-svg-1.4.3
18+
- diagrams-contrib-1.4.4
19+
- diagrams-core-1.4.2
20+
- diagrams-lib-1.4.3
21+
- diagrams-postscript-1.5
22+
- monoid-extras-0.5.1
23+
- svg-builder-0.1.1
24+
- active-0.2.0.14
25+
- dual-tree-0.2.2.1
26+
- force-layout-0.4.0.6
27+
- statestack-0.3
1128
- implicit-hie-0.1.2.3
1229
- implicit-hie-cradle-0.3.0.0
13-
- fuzzy-0.1.0.0
14-
- regex-pcre-builtin-0.95.1.1.8.43
15-
- regex-base-0.94.0.0
16-
- regex-tdfa-1.3.1.0
17-
- shake-0.18.5
18-
- parser-combinators-1.2.1
19-
- haddock-library-1.8.0
20-
- tasty-rerun-1.1.17
21-
- ghc-check-0.5.0.1
22-
- extra-1.7.2
2330

2431
nix:
2532
packages: [zlib]
26-
27-
ghc-options:
28-
ghcide: -DSTACK

stack810.yaml

Lines changed: 0 additions & 35 deletions
This file was deleted.

stack88.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)