Skip to content

Commit

Permalink
Fix ci (#1836)
Browse files Browse the repository at this point in the history
* Switch back to GHC9.4 for now

* Fixed nix-shell in ihp-hsx

* Renabled support for GHC9.4 in ihp-hsx

* Delete hlint.nix

* Create hlint.nix

* Deleted unused nix configs

* Don't override the nix config on our M1 runner

* Jailbreak hls-hlint-plugin

* Jailbreak hlint

* Create hls-hlint-plugin.nix

* nixpkgs update

* simplified tests runner

* Run github actions less
  • Loading branch information
mpscholten authored Oct 3, 2023
1 parent 6f0f8da commit 4f1c9fb
Show file tree
Hide file tree
Showing 19 changed files with 80 additions and 135 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: Binary Build
on:
push:
branches: '*'
pull_request:
branches: [master] # This allows us to test PRs without always needing to build locally. It's secure as all first time contributors first need to be approved for running GitHub actions
branches:
- master
- 'v.+'
tags: ['**']
jobs:
build:
strategy:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/check_js.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: Check JavaScript
on:
push:
branches: '*'
pull_request:
branches: [master]
jobs:
Expand Down
23 changes: 0 additions & 23 deletions .github/workflows/pr_compile_check.yml

This file was deleted.

15 changes: 2 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
name: "Tests"
name: "Tests + Compile"
on:
pull_request:
branches: [master]
push:
branches: [master]

jobs:
tests:
runs-on: ARM64
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e.tar.gz
if: matrix.os != 'ARM64'
- uses: cachix/cachix-action@v12
with:
name: digitallyinduced
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
if: matrix.os != 'ARM64'
- run: nix develop --impure --command tests
- run: nix develop --impure --command fastbuild
2 changes: 1 addition & 1 deletion NixSupport/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ compiler ? "ghc96"
{ compiler ? "ghc94"
, additionalNixpkgsOptions ? {}
, pkgs ? import "${toString projectPath}/Config/nix/nixpkgs-config.nix" { ihp = ihp; additionalNixpkgsOptions = additionalNixpkgsOptions; }
, ghc ? pkgs.haskell.packages.${compiler}
Expand Down
4 changes: 2 additions & 2 deletions NixSupport/haskell-packages/hlint.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
}:
mkDerivation {
pname = "hlint";
version = "3.6.1";
sha256 = "1za1cykiajyfl8ks59jdj6228qnlg5s96slc9jm9zcy1ncmi701j";
version = "3.5";
sha256 = "0kxdrqybnma508g1z42s3rc3cay11m8nl5ziddyw31m020515gcq";
isLibrary = true;
isExecutable = true;
enableSeparateDataOutput = true;
Expand Down
25 changes: 25 additions & 0 deletions NixSupport/haskell-packages/hls-hlint-plugin.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{ mkDerivation, aeson, apply-refact, base, binary, bytestring
, containers, data-default, deepseq, Diff, directory, extra
, filepath, ghc-exactprint, ghc-lib-parser, ghc-lib-parser-ex
, ghcide, hashable, hlint, hls-plugin-api, hls-test-utils, lens
, lib, lsp, lsp-types, mtl, refact, regex-tdfa, row-types, stm
, temporary, text, transformers, unordered-containers
}:
mkDerivation {
pname = "hls-hlint-plugin";
version = "2.2.0.0";
sha256 = "0qrygjvgm5x88j7cjw9dhzli38by0gzmda8f8bkqi8v1qx09ny76";
libraryHaskellDepends = [
aeson apply-refact base binary bytestring containers data-default
deepseq Diff directory extra filepath ghc-exactprint ghc-lib-parser
ghc-lib-parser-ex ghcide hashable hlint hls-plugin-api lens lsp mtl
refact regex-tdfa stm temporary text transformers
unordered-containers
];
testHaskellDepends = [
aeson base containers filepath hls-plugin-api hls-test-utils lens
lsp-types row-types text
];
description = "Hlint integration plugin with Haskell Language Server";
license = lib.licenses.asl20;
}
29 changes: 0 additions & 29 deletions NixSupport/haskell-packages/xconnection.nix

This file was deleted.

23 changes: 0 additions & 23 deletions NixSupport/haskell-packages/xhttp-client-tls.nix

This file was deleted.

29 changes: 0 additions & 29 deletions NixSupport/haskell-packages/xtls.nix

This file was deleted.

8 changes: 7 additions & 1 deletion NixSupport/make-nixpkgs-from-options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
, dontHaddockPackages ? []
, nixPkgsRev ? "277bf961c323b6cde46932cc9308135d0687af95"
, nixPkgsSha256 ? "sha256-ciSZqliNLDattmjR/1yQ0mJHZSkXWZlnIR6TcdDGFMQ"
, compiler ? "ghc96"
, compiler ? "ghc94"
, manualOverrides ? haskellPackagesNew: haskellPackagesOld: { } # More exotic overrides go here
, additionalNixpkgsOptions ? {}
}:
Expand All @@ -25,6 +25,12 @@ let
inherit pkgs ihp dontCheckPackages doJailbreakPackages dontHaddockPackages manualOverrides haskellPackagesDir;

ghcCompiler = pkgs.haskell.packages."${compiler}";
filter = (import ((import <nixpkgs> {}).fetchFromGitHub {
owner = "numtide";
repo = "nix-filter";
rev = "d6381c442f79f2f1fdfde00521c3d15d6c21218e";
sha256 = "sha256-ciSZqliNLDattmjR/1yQ0mJHZSkXWZlnIR6TcdDGFMa";
}));
};
};
};
Expand Down
4 changes: 2 additions & 2 deletions NixSupport/mkGhcCompiler.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ let
in
builtins.listToAttrs (map toPackage names);

ihpDontCheckPackages = [ "mmark" "mmark-ext" "mutable-containers" "hiedb" "hls-fourmolu-plugin" "relude" "inflections" ];
ihpDoJailbreakPackages = [ "haskell-to-elm" "ip" "ghc-syntax-highlighter" "relude" "hs-brotli" "tuples" "singletons-th" "singletons-base" "inflections" "postgresql-simple" "with-utf8" "chell" "zigzag" "typerep-map" "relude" "bytebuild" "connection" "microlens" "microlens-th"];
ihpDontCheckPackages = [ "mmark" "mmark-ext" "mutable-containers" "hiedb" "hls-fourmolu-plugin" "relude" "inflections" "hls-hlint-plugin"];
ihpDoJailbreakPackages = [ "haskell-to-elm" "ip" "ghc-syntax-highlighter" "relude" "hs-brotli" "tuples" "singletons-th" "singletons-base" "inflections" "postgresql-simple" "with-utf8" "chell" "zigzag" "typerep-map" "relude" "bytebuild" "connection" "microlens" "microlens-th" "hls-hlint-plugin" "hlint"];
ihpDontHaddockPackages = [ ];
in ghcCompiler.override {
overrides = composeExtensionsList [
Expand Down
2 changes: 1 addition & 1 deletion devenv-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ that is defined in flake-module.nix
perSystem = { nix-filter, pkgs, lib, ... }: let
ghcCompiler = import ./NixSupport/mkGhcCompiler.nix {
inherit pkgs;
ghcCompiler = pkgs.haskell.packages.ghc96;
ghcCompiler = pkgs.haskell.packages.ghc94;
ihp = ./.;
filter = inputs.nix-filter.lib;
};
Expand Down
2 changes: 1 addition & 1 deletion flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ihpFlake:
description = ''
The GHC compiler to use for IHP.
'';
default = pkgs.haskell.packages.ghc96;
default = pkgs.haskell.packages.ghc94;
};

packages = lib.mkOption {
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

inputs = {
# TODO use nixpkgs-unstable and just .lock a version?
nixpkgs.url = "github:mpscholten/nixpkgs/fix-ghc-m1-issue";
nixpkgs.url = "github:NixOS/nixpkgs?rev=ea0284a3da391822909be5e98a60c1e62572a7dc";

# pre-defined set of default target systems
systems.url = "github:nix-systems/default";
Expand Down
5 changes: 5 additions & 0 deletions ihp-hsx/IHP/HSX/HaskellParser.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
module IHP.HSX.HaskellParser (parseHaskellExpression) where

import Prelude
Expand Down Expand Up @@ -29,7 +30,11 @@ parseHaskellExpression sourcePos extensions input =
error = renderWithContext defaultSDocContext
$ vcat
$ map (formatBulleted defaultSDocContext)
#if __GLASGOW_HASKELL__ >= 960
$ map (diagnosticMessage NoDiagnosticOpts)
#else
$ map diagnosticMessage
#endif
$ map errMsgDiagnostic
$ sortMsgBag Nothing
$ getMessages parserState.errors
Expand Down
29 changes: 27 additions & 2 deletions ihp-hsx/IHP/HSX/HsExpToTH.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE ViewPatterns, CPP #-}
{-|
Module: IHP.HSX.HsExpToTH
Copyright: (c) digitally induced GmbH, 2022
Expand Down Expand Up @@ -28,7 +28,9 @@ import qualified GHC.Unit.Module as Module
import GHC.Stack
import qualified Data.List.NonEmpty as NonEmpty
import Language.Haskell.Syntax.Type
#if __GLASGOW_HASKELL__ >= 960
import Language.Haskell.Syntax.Basic
#endif


fl_value = rationalFromFractionalLit
Expand Down Expand Up @@ -90,7 +92,11 @@ toExp (Expr.HsVar _ n) =
then TH.ConE (toName n')
else TH.VarE (toName n')

#if __GLASGOW_HASKELL__ >= 960
toExp (Expr.HsUnboundVar _ n) = TH.UnboundVarE (TH.mkName . occNameString $ occName n)
#else
toExp (Expr.HsUnboundVar _ n) = TH.UnboundVarE (TH.mkName . occNameString $ n)
#endif

toExp Expr.HsIPVar {}
= noTH "toExp" "HsIPVar"
Expand All @@ -104,7 +110,11 @@ toExp (Expr.HsOverLit _ OverLit {ol_val})
toExp (Expr.HsApp _ e1 e2)
= TH.AppE (toExp . unLoc $ e1) (toExp . unLoc $ e2)

#if __GLASGOW_HASKELL__ >= 960
toExp (Expr.HsAppType _ e _ HsWC {hswc_body}) = TH.AppTypeE (toExp . unLoc $ e) (toType . unLoc $ hswc_body)
#else
toExp (Expr.HsAppType _ e HsWC {hswc_body}) = TH.AppTypeE (toExp . unLoc $ e) (toType . unLoc $ hswc_body)
#endif
toExp (Expr.ExprWithTySig _ e HsWC{hswc_body=unLoc -> HsSig{sig_body}}) = TH.SigE (toExp . unLoc $ e) (toType . unLoc $ sig_body)

toExp (Expr.OpApp _ e1 o e2)
Expand All @@ -114,7 +124,11 @@ toExp (Expr.NegApp _ e _)
= TH.AppE (TH.VarE 'negate) (toExp . unLoc $ e)

-- NOTE: for lambda, there is only one match
#if __GLASGOW_HASKELL__ >= 960
toExp (Expr.HsLam _ (Expr.MG _ (unLoc -> (map unLoc -> [Expr.Match _ _ (map unLoc -> ps) (Expr.GRHSs _ [unLoc -> Expr.GRHS _ _ (unLoc -> e)] _)]))))
#else
toExp (Expr.HsLam _ (Expr.MG _ (unLoc -> (map unLoc -> [Expr.Match _ _ (map unLoc -> ps) (Expr.GRHSs _ [unLoc -> Expr.GRHS _ _ (unLoc -> e)] _)])) _))
#endif
= TH.LamE (fmap toPat ps) (toExp e)

-- toExp (Expr.Let _ bs e) = TH.LetE (toDecs bs) (toExp e)
Expand Down Expand Up @@ -185,17 +199,28 @@ toExp (Expr.HsProjection _ locatedFields) =
extractFieldLabel (DotFieldOcc _ locatedStr) = locatedStr
extractFieldLabel _ = error "Don't know how to handle XDotFieldOcc constructor..."
in
#if __GLASGOW_HASKELL__ >= 960
TH.ProjectionE (NonEmpty.map (unpackFS . (.field_label) . unLoc . extractFieldLabel . unLoc) locatedFields)
#else
TH.ProjectionE (NonEmpty.map (unpackFS . unLoc . extractFieldLabel . unLoc) locatedFields)
#endif

toExp (Expr.HsGetField _ expr locatedField) =
let
extractFieldLabel (DotFieldOcc _ locatedStr) = locatedStr
extractFieldLabel _ = error "Don't know how to handle XDotFieldOcc constructor..."
in
#if __GLASGOW_HASKELL__ >= 960
TH.GetFieldE (toExp (unLoc expr)) (unpackFS . (.field_label) . unLoc . extractFieldLabel . unLoc $ locatedField)
#else
TH.GetFieldE (toExp (unLoc expr)) (unpackFS . unLoc . extractFieldLabel . unLoc $ locatedField)
#endif


#if __GLASGOW_HASKELL__ >= 960
toExp (Expr.HsOverLabel _ _ fastString) = TH.LabelE (unpackFS fastString)
#else
toExp (Expr.HsOverLabel _ fastString) = TH.LabelE (unpackFS fastString)
#endif

toExp e = todo "toExp" e

Expand Down
2 changes: 1 addition & 1 deletion ihp-hsx/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ let
ihp = ./../.;
haskellPackagesDir = ./../NixSupport/haskell-packages;
};
ghc = pkgs.haskell.packages.ghc96;
ghc = pkgs.haskell.packages.ghc94;
haskellDeps = ghc.ghcWithPackages (p: with p; [
classy-prelude
string-conversions
Expand Down
2 changes: 1 addition & 1 deletion ihp-openai/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ let
ihp = ./../.;
haskellPackagesDir = ./../NixSupport/haskell-packages;
};
ghc = pkgs.haskell.packages.ghc96;
ghc = pkgs.haskell.packages.ghc94;
haskellDeps = ghc.ghcWithPackages (p: with p; [
text
bytestring
Expand Down

0 comments on commit 4f1c9fb

Please sign in to comment.