-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add missing mainPackage attr in the config for the ghci runner
- Loading branch information
Showing
16 changed files
with
171 additions
and
67 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
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
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
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 @@ | ||
packages: . |
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 @@ | ||
{ | ||
description = "hix test project"; | ||
|
||
inputs.hix.url = "path:HIX"; | ||
|
||
outputs = { hix, ... }: hix.lib.flake ({config, ...}: { | ||
packages.root = { | ||
src = ./pkg; | ||
library.enable = true; | ||
library.dependencies = ["http-client" "bytestring" "path" "path-io"]; | ||
library.default-extensions = ["OverloadedStrings"]; | ||
executable.enable = true; | ||
test.enable = true; | ||
test.env = "hix-ghci-test"; | ||
}; | ||
envs.hix-ghci-test.services.test.enable = true; | ||
services.test = { | ||
nixos.services.nginx = { | ||
enable = true; | ||
virtualHosts.localhost.locations."/test".return = "200 test-endpoint"; | ||
}; | ||
ports.nginx = { host = 2; guest = 80; }; | ||
}; | ||
internal.hixCli.dev = true; | ||
}); | ||
} |
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,7 @@ | ||
module Main where | ||
|
||
import Root.Lib (string) | ||
|
||
main :: IO () | ||
main = | ||
putStrLn string |
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,25 @@ | ||
module Root.Lib where | ||
|
||
import Control.Exception | ||
import Control.Concurrent | ||
import qualified Data.ByteString.Lazy.Char8 as ByteString | ||
import Network.HTTP.Client | ||
|
||
tryRequest :: Manager -> IO (Response ByteString.ByteString) | ||
tryRequest man = | ||
spin 10 | ||
where | ||
spin 0 = req | ||
spin n = catch req (err n) | ||
err :: Int -> SomeException -> IO (Response ByteString.ByteString) | ||
err n _ = do | ||
threadDelay 1000000 | ||
spin (n - 1) | ||
req = | ||
httpLbs "http://localhost:20002/test" man | ||
|
||
test :: IO () | ||
test = do | ||
man <- newManager defaultManagerSettings | ||
res <- tryRequest man | ||
ByteString.putStrLn (responseBody res) |
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,6 @@ | ||
module Main where | ||
|
||
import Root.Lib (test) | ||
|
||
main :: IO () | ||
main = test |
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,12 @@ | ||
{ pkgs }: | ||
{ | ||
test = builtins.toFile "ghci-vm-test" '' | ||
cd ./root | ||
nix flake update | ||
nix run .#gen-cabal | ||
ghci_match '.#ghci -- -p root -t main' 'test-endpoint' "ghci service output with component env does not contain 'test-endpoint'" | ||
ghci_match '.#env.hix-ghci-test.ghci -- -t main' 'test-endpoint' "ghci service output with explicit env does not contain 'test-endpoint'" | ||
''; | ||
} |
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 Root.Lib where | ||
|
||
test :: IO () | ||
test = putStrLn "core-lib-test" |
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 |
---|---|---|
@@ -1,7 +1,4 @@ | ||
module Main where | ||
|
||
import Root.Lib (string) | ||
|
||
main :: IO () | ||
main = | ||
putStrLn string | ||
main = putStrLn "app-main" |
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 |
---|---|---|
@@ -1,25 +1,4 @@ | ||
module Root.Lib where | ||
|
||
import Control.Exception | ||
import Control.Concurrent | ||
import qualified Data.ByteString.Lazy.Char8 as ByteString | ||
import Network.HTTP.Client | ||
|
||
tryRequest :: Manager -> IO (Response ByteString.ByteString) | ||
tryRequest man = | ||
spin 10 | ||
where | ||
spin 0 = req | ||
spin n = catch req (err n) | ||
err :: Int -> SomeException -> IO (Response ByteString.ByteString) | ||
err n _ = do | ||
threadDelay 1000000 | ||
spin (n - 1) | ||
req = | ||
httpLbs "http://localhost:20002/test" man | ||
|
||
test :: IO () | ||
test = do | ||
man <- newManager defaultManagerSettings | ||
res <- tryRequest man | ||
ByteString.putStrLn (responseBody res) | ||
test = putStrLn "lib-test" |
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