Skip to content
dhall/yaml configurable concurrent process executor with streaming assertions
Branch: master
Clone or download
Valentin Reis
Latest commit d0ad286 May 21, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app readme/interface update May 16, 2019
examples Adds the exitcode specification feature. May 21, 2019
nix Adds vendored nix code. May 7, 2019
resources Adds the exitcode specification feature. May 21, 2019
src/Dhrun Exitcode checking bugfix and refactor. May 21, 2019
tests Adds the exitcode specification feature. May 21, 2019
.README.md Adds the exitcode specification feature. May 21, 2019
.envrc package name change and add lorri integration. Apr 4, 2019
.gitattributes refactor: goldentest/unittest Apr 30, 2019
.gitignore readme update. May 6, 2019
AUTHORS Initial commit Mar 28, 2019
ChangeLog.md readme changes. May 16, 2019
LICENSE Initial commit Mar 28, 2019
README.md Adds the exitcode specification feature. May 21, 2019
brittany.yaml adds per-command workdir May 2, 2019
cabal.dh Fixing the exception throwing delay. May 20, 2019
default.nix Adds vendored nix code. May 7, 2019
dhrun.cabal Adds the exitcode specification feature. May 21, 2019
notes.md readme update May 16, 2019
pre-commit.sh updates pre-commit hook May 7, 2019
quickstart.yml Adds the exitcode specification feature. May 21, 2019
shake
shake.hs updates pre-commit hook May 7, 2019
shell.nix Initial commit Mar 28, 2019

README.md

dhrun: Dhall/YAML configurable concurrent process executor with streaming assertions.

dhrun starts a list of (Unix) processes, monitors the standard streams for patterns that should be expected or avoided, kills the processes when criteria are met and exits accordingly. It is configured using either Dhall or YAML. Its goals are similar to venom. Compared to that tool, dhrun has only one execution capability(exec) and its assertions are poor(infix strings only). It supports concurrency and monitors streams, however. It was written to create a configuration layer to control single-node integration tests for a linux daemon. See the last section of this file for a list of similar tools to dhrun.

Use
dhrun run path/to/config.dhall 
dhrun run path/to/config.yaml

See file quickstart.yml for an overview of dhrun's capabilities. The resources directory contains the Dhall types for the configuration layer, and the examples directory contains more .yml and .dh configurations.

The originally intended workflow is to configure dhrun using a dhall codebase. In bash, this might involve a here-document:

dhrun run <<< "let codebase = /path/package.dhall in codebase.foo bar baz"

You can find an example project-specific dhall configuration layer here.

CLI Interface
dhrun --help
dhrun

Usage: dhrun COMMAND
  dhall-configured concurrent process execution with streaming assertion
  monitoring

Available options:
  -h,--help                Show this help text
  COMMAND                  Type of operation to run.

Available commands:
  run                      Run a dhrun specification.
  print                    Print a dhrun specification.
dhrun run --help
Usage: dhrun run [INPUT] [-y|--yaml] [-v|--verbose] [-e|--edit]
  Run a dhrun specification.

Available options:
  INPUT                    Input configuration with .yml/.yaml/.dh/.dhall
                           extension. Leave void for stdin (dhall) input.
  -y,--yaml                Assume stdin to be yaml instead of dhall.
  -v,--verbose             Enable verbose mode.
  -e,--edit                Edit yaml in $EDITOR before run.
  -h,--help                Show this help text
Installation
  • get Nix

  • install the 1.0.0 release: nix-env -f https://github.com/freuk/dhrun/archive/1.0.0.tar.gz -iA dhrun

This pins nixpkgs 18.09. Building should take a minute or two and will definitely succeed. You can also try installing the bleeding edge version: nix-env -f https://github.com/freuk/dhrun.git -iA dhrun

I have not tried building this code using stack or any other tool, but here are the hackage dependencies for dhrun and its tests:

base ansi-terminal time protolude mtl bytestring process conduit unliftio-core containers conduit-extra unix yaml aeson text directory dhall base protolude directory bytestring editor-open dhrun-lib filepath optparse-applicative dhall base protolude dhall yaml aeson filepath mtl bytestring text unliftio tasty tasty-hunit tasty-golden tasty-hspec tasty-quickcheck generic-random quickcheck-text hspec dhrun-lib Glob

Hacking
  • nix-shell provides a dev environment with cabal-build, ghcid, hlint, brittany, and other tools.

  • you need to procure dhall-to-cabal separately. It's necessary if you want to edit the cabal file, which is done through ./cabal.dh.

  • edit .README.md instead of README.md and run ./shake readme. ./shake also has other useful dev workflows.

  • direnv allow for lorri integration.

  • use the ./pre-commit.sh hook.

Structure
  • /nix vendored nix expressions.

  • /resources Dhall types and helper functions.

  • /app the main cli tool.

  • /examples example Dhall and YAML configuration files for dhrun. These also serve as golden tests.

  • /src dhrun types and logic.

  • /tests golden, unit, quickcheck tests.

See also
You can’t perform that action at this time.