Skip to content

Commit

Permalink
Merge pull request #584 from IntersectMBO/fix-hls
Browse files Browse the repository at this point in the history
Update HLS version and add GitHub action
  • Loading branch information
palas committed Jul 15, 2024
2 parents 754e9e0 + 5581676 commit 15a5b13
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

env:
FOURMOLU_VERSION: "0.16.2.0"
STYLISH_HASKELL_VERSION: "0.14.5.0"
STYLISH_HASKELL_VERSION: "0.14.6.0"

steps:
- name: Download Fourmolu
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/hls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: "Haskell Language Server works"
on:
merge_group:
pull_request:
push:
branches:
- main

permissions:
contents: read

jobs:

test-hls-works:
env:
# Modify this value to "invalidate" the cache.
HLS_CACHE_VERSION: "2024-07-24"


runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Install Nix with good defaults
uses: input-output-hk/install-nix-action@v20
with:
extra_nix_config: |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
substituters = https://cache.iog.io/ https://cache.nixos.org/
nix_path: nixpkgs=channel:nixos-unstable
- name: Open nix environment
uses: rrbutani/use-nix-shell-action@v1
- name: Update dependencies
run: cabal update; cabal freeze
- name: Obtain GHC version
run: |
echo "VERSION=$(ghc --numeric-version)" >> "$GITHUB_OUTPUT"
id: ghc
- name: HLS caching
uses: actions/cache@v4
with:
path: |
/home/runner/.cache/hie-bios
/home/runner/.cache/ghcide
/home/runner/.local/state/cabal
.ghc.environment.x86_64-linux-9.8.2
dist-newstyle
key: hls-cache-${{ env.HLS_CACHE_VERSION }}-${{ runner.os }}-${{ steps.ghc.outputs.VERSION }}-${{ hashFiles('**/cabal.project.freeze') }}-${{ hashFiles('**/*.cabal', '**/cabal.project') }}
restore-keys: |
hls-cache-${{ env.HLS_CACHE_VERSION }}-${{ runner.os }}-${{ steps.ghc.outputs.VERSION }}-${{ hashFiles('**/cabal.project.freeze') }}-
- name: Test HLS works
run: haskell-language-server
13 changes: 7 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
];

# see flake `variants` below for alternative compilers
defaultCompiler = "ghc965";
defaultCompiler = "ghc982";
haddockShellCompiler = defaultCompiler;
mingwCompiler = "ghc965";

cabalHeadOverlay = final: prev: {
cabal-head =
Expand Down Expand Up @@ -82,7 +83,7 @@

# we also want cross compilation to windows on linux (and only with default compiler).
crossPlatforms = p:
lib.optional (system == "x86_64-linux" && config.compiler-nix-name == defaultCompiler)
lib.optional (system == "x86_64-linux" && config.compiler-nix-name == mingwCompiler)
p.mingwW64;

# CHaP input map, so we can find CHaP packages (needs to be more
Expand Down Expand Up @@ -111,9 +112,9 @@
# tools that work or should be used only with default compiler
cabal-gild = "1.3.1.2";
fourmolu = "0.16.2.0";
haskell-language-server.src = nixpkgs.haskell-nix.sources."hls-2.6";
hlint = "3.6.1";
stylish-haskell = "0.14.5.0";
haskell-language-server.src = nixpkgs.haskell-nix.sources."hls-2.8";
hlint = "3.8";
stylish-haskell = "0.14.6.0";
};
# and from nixpkgs or other inputs
shell.nativeBuildInputs = with nixpkgs; [gh jq yq-go actionlint shellcheck cabal-head];
Expand Down Expand Up @@ -151,7 +152,7 @@
flake = cabalProject.flake (
lib.optionalAttrs (system == "x86_64-linux") {
# on linux, build/test other supported compilers
variants = lib.genAttrs ["ghc8107"] (compiler-nix-name: {
variants = lib.genAttrs ["ghc8107" mingwCompiler] (compiler-nix-name: {
inherit compiler-nix-name;
});
}
Expand Down

0 comments on commit 15a5b13

Please sign in to comment.