Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build and tests with GHC-9.4.3 and 9.2.5 #3364

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ jobs:
strategy:
fail-fast: true
matrix:
ghc: [ "9.4.2"
, "9.4.1"
ghc: [ "9.4.3"
, "9.4.2"
, "9.2.4"
, "9.2.3"
, "9.0.2"
Expand All @@ -69,6 +69,9 @@ jobs:
]
include:
# only test supported ghc major versions
- os: ubuntu-latest
ghc: '9.4.3'
test: true
- os: ubuntu-latest
ghc: '9.4.2'
test: true
mouse07410 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -150,15 +153,15 @@ jobs:
HLS_WRAPPER_TEST_EXE: hls-wrapper
run: cabal test wrapper-test --test-options="$TEST_OPTS --rerun-log-file .tasty-rerun-log-wrapper"

- if: matrix.test && matrix.ghc != '9.2.4' && matrix.ghc != '9.4.2'
- if: matrix.test && matrix.ghc != '9.2.4' && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3'
mouse07410 marked this conversation as resolved.
Show resolved Hide resolved
name: Test hls-brittany-plugin
run: cabal test hls-brittany-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-brittany-plugin --test-options="$TEST_OPTS"

- if: matrix.test && matrix.ghc != '9.4.2'
- if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3'
name: Test hls-refactor-plugin
run: cabal test hls-refactor-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-refactor-plugin --test-options="$TEST_OPTS"

- if: matrix.test && matrix.ghc != '9.4.2'
- if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3'
name: Test hls-floskell-plugin
run: cabal test hls-floskell-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-floskell-plugin --test-options="$TEST_OPTS"

Expand All @@ -170,31 +173,31 @@ jobs:
name: Test hls-pragmas-plugin
run: cabal test hls-pragmas-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-pragmas-plugin --test-options="$TEST_OPTS"

- if: matrix.test && matrix.ghc != '9.4.2'
- if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3'
name: Test hls-eval-plugin
run: cabal test hls-eval-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-eval-plugin --test-options="$TEST_OPTS"

- if: matrix.test && matrix.ghc != '9.2.4' && matrix.ghc != '9.4.2'
- if: matrix.test && matrix.ghc != '9.2.4' && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3'
name: Test hls-haddock-comments-plugin
run: cabal test hls-haddock-comments-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-haddock-comments-plugin --test-options="$TEST_OPTS"

- if: matrix.test && matrix.ghc != '9.4.2'
- if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3'
name: Test hls-splice-plugin
run: cabal test hls-splice-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-splice-plugin --test-options="$TEST_OPTS"

- if: matrix.test && matrix.ghc != '9.4.2'
- if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3'
name: Test hls-stylish-haskell-plugin
run: cabal test hls-stylish-haskell-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-stylish-haskell-plugin --test-options="$TEST_OPTS"

- if: matrix.test && matrix.ghc != '9.4.2'
- if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3'
name: Test hls-ormolu-plugin
run: cabal test hls-ormolu-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-ormolu-plugin --test-options="$TEST_OPTS"

- if: matrix.test && matrix.ghc != '9.4.2'
- if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3'
name: Test hls-fourmolu-plugin
run: cabal test hls-fourmolu-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-fourmolu-plugin --test-options="$TEST_OPTS"

- if: matrix.test && matrix.ghc != '9.2.4' && matrix.ghc != '9.4.2'
- if: matrix.test && matrix.ghc != '9.2.4' && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3'
name: Test hls-tactics-plugin test suite
run: cabal test hls-tactics-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-tactics-plugin --test-options="$TEST_OPTS"

Expand All @@ -210,15 +213,15 @@ jobs:
name: Test hls-call-hierarchy-plugin test suite
run: cabal test hls-call-hierarchy-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-call-hierarchy-plugin --test-options="$TEST_OPTS"

- if: matrix.test && matrix.os != 'windows-latest' && matrix.ghc != '9.4.2'
- if: matrix.test && matrix.os != 'windows-latest' && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3'
name: Test hls-rename-plugin test suite
run: cabal test hls-rename-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-rename-plugin --test-options="$TEST_OPTS"

- if: matrix.test && matrix.ghc != '9.4.2'
- if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3'
name: Test hls-hlint-plugin test suite
run: cabal test hls-hlint-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-hlint-plugin --test-options="$TEST_OPTS"

- if: matrix.test && matrix.ghc != '9.0.1' && matrix.ghc != '9.0.2' && matrix.ghc != '9.2.4' && matrix.ghc != '9.4.2'
- if: matrix.test && matrix.ghc != '9.0.1' && matrix.ghc != '9.0.2' && matrix.ghc != '9.2.4' && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3'
name: Test hls-stan-plugin test suite
run: cabal test hls-stan-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-stan-plugin --test-options="$TEST_OPTS"

Expand All @@ -242,7 +245,7 @@ jobs:
name: Test hls-change-type-signature test suite
run: cabal test hls-change-type-signature-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-change-type-signature-plugin --test-options="$TEST_OPTS"

- if: matrix.test && matrix.ghc != '9.4.2'
- if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3'
name: Test hls-gadt-plugin test suit
run: cabal test hls-gadt-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-gadt-plugin --test-options="$TEST_OPTS"

Expand Down
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ package *

write-ghc-environment-files: never

index-state: 2022-10-07T12:19:15Z
index-state: 2022-11-20T20:19:15Z

constraints:
-- For GHC 9.4, older versions of entropy fail to build on Windows
Expand Down
1 change: 1 addition & 0 deletions ghcide/ghcide.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ library
hashable,
hie-compat ^>= 0.3.0.0,
hls-plugin-api ^>= 1.5,
implicit-hie >= 0.1.2.7 && < 0.1.3,
lens,
list-t,
hiedb == 0.4.2.*,
Expand Down
3 changes: 3 additions & 0 deletions haskell-language-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,9 @@ executable haskell-language-server

default-language: Haskell2010
default-extensions: DataKinds, TypeOperators

if impl(ghc >= 9.4)
build-depends: ghc-exactprint >= 1.6.1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this needed?

Copy link
Author

@mouse07410 mouse07410 Nov 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, a good question. Without this seemingly unnecessary constraint, Cabal somehow manages to pull ghc-exactprint-1.6.0 - presumably because there's a dependency of dependency that's asking for it. And CI tests kept failing.

With this addition, all the relevant tests passed (that is - at least, until I started applying changes to address suggestions ;).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really think this needs to go in the right place. It shouldn't be that hard to figure out. At the very least it needs a clear comment explaining this.

Copy link
Author

@mouse07410 mouse07410 Nov 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really think this needs to go in the right place

I attempted to find the right place - starting with attempts to put it in plugins/hls-refactor-plugin and ghcide. Failed miserably in both cases - tests kept failing. Please feel free to pitch a hand and locate that right place - I don't know nearly enough to dig deeper. I tried to search/grep for exactprint, and did not come up with anything helpful (besides the above, which did not help either).

If you do know that right place, please share. Or, perhaps, create a new PR - I'm already up to my ears in the bog of CI that I don't understand.

The current workaround was prompted by observation that

$ ghcup compile hls -g master --ghc 9.4.3 -- --index-state=@<current_date> --constraint="ghc-exactprint >= 1.6.1"

works.

How would you want me to explain it? Just copy-paste this post into the .cabal file?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not necessary, afaict, this worked for me out of the box:

> cabal update
> cabal build -w ghc-9.4.3 exe:haskell-language-server

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting - perhaps, index-state changed since...? Should I update index-state in this PR too?

Also, have you tried just cabal build -w ghc-9.4.3 (to build whatever's there)?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you updated the index-state in cabal.project, you locally need to make sure your global index-state is newer than the one in cabal.project (which you added). So just running cabal update in the project or outside of it should do the trick.

Yeah, works just the same. It'd be weird if cabal didn't choose the most recent version of 'ghc-exactprint'.


executable haskell-language-server-wrapper
import: common-deps
Expand Down