From 9eea81655807b0214b43069981639dff9785cb78 Mon Sep 17 00:00:00 2001 From: Pablo Lamela Date: Fri, 12 Jul 2024 20:44:46 +0200 Subject: [PATCH 1/2] Update HLS version and add GitHub action --- .github/workflows/check-formatting.yml | 2 +- .github/workflows/hls.yml | 53 ++++++++++++++++++++++++++ flake.nix | 13 ++++--- 3 files changed, 61 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/hls.yml diff --git a/.github/workflows/check-formatting.yml b/.github/workflows/check-formatting.yml index 142c592966..1bffb6f3cd 100644 --- a/.github/workflows/check-formatting.yml +++ b/.github/workflows/check-formatting.yml @@ -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 diff --git a/.github/workflows/hls.yml b/.github/workflows/hls.yml new file mode 100644 index 0000000000..17f405f27d --- /dev/null +++ b/.github/workflows/hls.yml @@ -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 diff --git a/flake.nix b/flake.nix index 215a3236e8..ff7a9998ad 100644 --- a/flake.nix +++ b/flake.nix @@ -27,8 +27,9 @@ ]; # see flake `variants` below for alternative compilers - defaultCompiler = "ghc965"; + defaultCompiler = "ghc982"; haddockShellCompiler = defaultCompiler; + mingwVersion = "ghc965"; cabalHeadOverlay = final: prev: { cabal-head = @@ -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 == mingwVersion) p.mingwW64; # CHaP input map, so we can find CHaP packages (needs to be more @@ -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]; @@ -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" mingwVersion] (compiler-nix-name: { inherit compiler-nix-name; }); } From 55816760a1a6a318dfea11061b55d0949c1e4d68 Mon Sep 17 00:00:00 2001 From: Pablo Lamela Date: Mon, 15 Jul 2024 19:17:58 +0200 Subject: [PATCH 2/2] Fix variable name Co-authored-by: Mateusz Galazyn <228866+carbolymer@users.noreply.github.com> --- flake.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index ff7a9998ad..c2a21b39a5 100644 --- a/flake.nix +++ b/flake.nix @@ -29,7 +29,7 @@ # see flake `variants` below for alternative compilers defaultCompiler = "ghc982"; haddockShellCompiler = defaultCompiler; - mingwVersion = "ghc965"; + mingwCompiler = "ghc965"; cabalHeadOverlay = final: prev: { cabal-head = @@ -83,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 == mingwVersion) + 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 @@ -152,7 +152,7 @@ flake = cabalProject.flake ( lib.optionalAttrs (system == "x86_64-linux") { # on linux, build/test other supported compilers - variants = lib.genAttrs ["ghc8107" mingwVersion] (compiler-nix-name: { + variants = lib.genAttrs ["ghc8107" mingwCompiler] (compiler-nix-name: { inherit compiler-nix-name; }); }