Commit 08c61880 authored by Valentin Reis's avatar Valentin Reis

packaging fix.

parent 9a011e40
Pipeline #5024 canceled with stage
#### integration testing
#### `argotk`
Integration tests that validate the argo stack, leveraging the 'argopkgs'
repository. The intended usage is to override (some of) the source(s) with WIP
version(s), as part of development or continuous integration.
This is a stack executor for argo. It can be used standalone and drives CI tests.
It should be used via [argotest](
### Usage (tl;dr, I already have nix on my machine.)
nix-shell -E '
(import( builtins.fetchGit {
url =;
}) {
#nrm-src = /path/to/nrm
#libnrm-src = /path/to/nrm
#containers-src = /path/to/nrm
}).test' --run "argotk.hs TestHello"
### Usage (in three parts)
- [**1**] Get Nix: `curl | sh`
- [**2**] Use the `test` attribute of the argotest' nix attribute set to enter a
test environment. For example, we can run default tests on the
"argopkgs-pinned" version of argo components using:
nix-shell -E '
argotest-src =
builtins.fetchGit {
url =;
argotest = import argotest-src {};
This environment has all the necessary Argo components in its PATH. The
argotest function has various arguments, defined in the default.nix file at the
rooto of this repository. They all have default values. For a more involved
example, let's get a custom test environment.
Here, we'll use an environment that uses a local `nrm` source, the master
`libnrm` branch and a specific revision of the `containers` branch. We'l'l use
the master `argotest` branch for that:
nix-shell -E '{ argotest ? (builtins.fetchGit {
url =;
(import argotest {
nrm-src = /path/to/nrm;
libnrm-src = builtins.fetchGit {
url =;
ref="master"; };
containers-src = builtins.fetchGit {
url =;
}).test' --run 'argotk.hs TestHello'
- [**3**] The `test`environment contains the `argotk.hs` tool, which runs various
operations on the argo stack:
Commands list:
#### Usage
argotk.hs --help
argotk --help
```{.txt pipe="sh"}
root/argotk/argotk.hs --help
argotk --help
Detailed help:
argotk.hs TestHello --help
argotk TestHello --help
```{.txt pipe="sh"}
root/argotk/argotk.hs TestHello --help
#### Misc
Alternatively, one can use the `--run` option to run a test directly:
nix-shell -E '
(import( builtins.fetchGit {
url =;
}) {}).test' --run "argotk.hs TestHello"
argotk TestHello --help
There are a few things one has to be aware of using this workflow:
- Builds may fail if the local source repositories are dirty with old build files.
- Without using the `rev` argument, the `builtins.fetchGit` nix command
prefetches and buffers its output, with an expiration time that ranges ten
minutes by default. Use a local checkout if you need to modify some of these
sources on the fly.
### Hacking
- edit `` in place of
- see `default.nix`
- the ./shake.hs build file takes care of a few things for the development
workflow (readme and completion generation).
- edit `` in place of and run ./shake.hs as a pre-commit hook.
This diff is collapsed.
......@@ -11,10 +11,6 @@ let
devInputs = with hpkgs; with pkgs; [
devHPackages = with hpkgs; [
......@@ -27,11 +23,23 @@ let
in rec
inherit(hpkgs) argotk;
inherit (hpkgs) argotk;
hack = hpkgs.shellFor {
packages = p: with p; [ argotk ];
withHoogle = true;
buildInputs = devInputs ++ devHPackages;
buildInputs = devHPackages;
preCommit = pkgs.mkShell {
name = "shake";
MANIFESTS = "/tmp";
buildInputs = [
(pkgs.haskellPackages.ghcWithPackages (p: with p; [
(pkgs.haskell.lib.doJailbreak panpipe)
#! /usr/bin/env nix-shell
#! nix-shell -i runhaskell -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [shake])"
#! nix-shell -i runhaskell -A preCommit
import Development.Shake
import Development.Shake.FilePath
......@@ -13,18 +13,15 @@ main = shakeArgs shakeOptions $ do
want ["", "completion/"]
%> \out -> mkCompletionRule out "bash" $ takeFileName out -<.> "hs"
%> \out -> do
let cplA = cmd "argotk" ["--bash-completion-script", "argotk"]
(Stdout cplScript) <- cplA
liftIO $ writeFile out cplScript
"" %> \out -> do
let template = ""
need [template , "argotk/argotk.hs" , "argo/src/Argo/Stack.hs"]
need [template , "src/argotk.hs" , "src/Argo/Stack.hs"]
(Stdout panpipe) <- cmd "which panpipe"
cmd_ "pandoc --filter"
[take (length panpipe - 1) panpipe, template, "-o", out]
mkCompletionAction str sn =
(sn, cmd ("argotk/" ++ sn) ["--" ++ str ++ "-completion-script", sn])
mkCompletionRule out str fn = do
let (needed, cplA) = mkCompletionAction str fn
(Stdout cplScript) <- cplA
liftIO $ writeFile out cplScript
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment