Skip to content

Commit

Permalink
Add CI checks for Haskell code
Browse files Browse the repository at this point in the history
  • Loading branch information
sashasashasasha151 committed Feb 24, 2021
1 parent 20d387f commit 5585fc3
Show file tree
Hide file tree
Showing 6 changed files with 235 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
steps:
- label: check trailing whitespace
commands:
- .buildkite/check-trailing-whitespace.sh
- .buildkite/check-trailing-whitespace.sh
- label: backend server
commands:
- nix-build -A packages.x86_64-linux.backend-server
- label: backend lib
commands:
- nix-build -A packages.x86_64-linux.backend-lib
- label: backend test
commands:
- nix-build -A checks.x86_64-linux.backend-test
- label: backend hlint
commands:
- nix-shell --run 'hlint backend -j'
15 changes: 15 additions & 0 deletions backend/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{ haskell-nix }:
let
project = haskell-nix.stackProject {
src = haskell-nix.haskellLib.cleanGit {
src = haskell-nix.cleanSourceHaskell { src = ./.; };
};
};

library = project.edna.components.library;
server = project.edna.components.exes.edna-server;
test = project.edna.checks.edna-test;

in {
inherit server library test;
}
4 changes: 4 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(import (fetchTarball
"https://github.com/edolstra/flake-compat/archive/master.tar.gz") {
src = builtins.fetchGit ./.;
}).defaultNix
162 changes: 162 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
inputs = {
nixpkgs.url = "github:serokell/nixpkgs";
haskell-nix.url = "github:input-output-hk/haskell.nix";
flake-utils.url = "github:numtide/flake-utils";

hackage = {
url = "github:input-output-hk/hackage.nix";
flake = false;
};

stackage = {
url = "github:input-output-hk/stackage.nix";
flake = false;
};
};

outputs = { self, nixpkgs, haskell-nix, hackage, stackage, flake-utils }:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
pkgs = nixpkgs.legacyPackages.${system}.extend haskell-nix.overlay;
backend = pkgs.callPackage ./backend { };
in {
defaultPackage = self.packages.${system}.backend-server;
packages = {
backend-lib = backend.library;
backend-server = backend.server;
};

checks.backend-test = backend.test;

devShell = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.backend-lib ];
buildInputs = with pkgs.haskellPackages; [ cabal-install hpack hlint ];
};
});
}
4 changes: 4 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(import (fetchTarball
"https://github.com/edolstra/flake-compat/archive/master.tar.gz") {
src = builtins.fetchGit ./.;
}).shellNix

0 comments on commit 5585fc3

Please sign in to comment.