-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add flake template & test in Github Actions (#54)
- Loading branch information
Showing
6 changed files
with
86 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: "CI" | ||
on: | ||
push: | ||
branches: | ||
- '*' | ||
pull_request: | ||
jobs: | ||
checks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: cachix/install-nix-action@v18 | ||
with: | ||
extra_nix_config: | | ||
experimental-features = nix-command flakes | ||
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | ||
- name: Test template | ||
id: template | ||
run: | | ||
FLAKE=$(pwd) | ||
TEMP_DIR=$(mktemp -d) | ||
cd $TEMP_DIR | ||
nix flake init -t $FLAKE | ||
# Build haskell executable | ||
nix build --override-input haskell-flake path:${FLAKE} | ||
# Test haskell devshell (via HLS check) | ||
nix develop --override-input haskell-flake path:${FLAKE} -c haskell-language-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
cabal-version: 3.0 | ||
name: example | ||
version: 0.1.0.0 | ||
license: NONE | ||
author: Joe | ||
maintainer: joe@example.com | ||
build-type: Simple | ||
|
||
common warnings | ||
ghc-options: -Wall | ||
|
||
executable example | ||
import: warnings | ||
main-is: Main.hs | ||
build-depends: base | ||
hs-source-dirs: src | ||
default-language: Haskell2010 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; | ||
flake-parts.url = "github:hercules-ci/flake-parts"; | ||
haskell-flake.url = "github:srid/haskell-flake"; | ||
}; | ||
outputs = inputs@{ self, nixpkgs, flake-parts, ... }: | ||
flake-parts.lib.mkFlake { inherit inputs; } { | ||
systems = nixpkgs.lib.systems.flakeExposed; | ||
imports = [ inputs.haskell-flake.flakeModule ]; | ||
perSystem = { self', pkgs, ... }: { | ||
haskellProjects.default = { | ||
packages = { | ||
# You can add more than one local package here. | ||
example.root = ./.; # Assumes ./example.cabal | ||
}; | ||
# buildTools = hp: { fourmolu = hp.fourmolu; ghcid = null; }; | ||
# overrides = self: super: { }; | ||
# hlintCheck.enable = true; | ||
# hlsCheck.enable = true; | ||
}; | ||
# haskell-flake doesn't set the default package, but you can do it here. | ||
packages.default = self'.packages.example; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Main where | ||
|
||
main :: IO () | ||
main = putStrLn "Hello, Haskell!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters