Commit 52cb3da3 authored by Valentin Reis's avatar Valentin Reis

Merge branch 'development-tooling' into 'master'

[feature] Added some minor dev workflow tools. See file ".Makefile".

See merge request argo/argotest!5
parents ade3773a 69a71525
Pipeline #4639 passed with stage
in 6 seconds
#This makefile only contains development workflow rules.
.PHONY: all
all: generate-completions README.md
.PHONY: generate-completions
generate-completions: completions/zsh/_argotk.hs completions/bash/argotk.sh
completions/zsh/_argotk.hs: argotk.hs default.nix
nix-shell -A dev-test --run "bash -c './argotk.hs --zsh-completion-script ./argotk.hs > completions/zsh/_argotk.hs'"
completions/bash/argotk.sh: argotk.hs default.nix
nix-shell -A dev-test --run "bash -c './argotk.hs --bash-completion-script ./argotk.hs > completions/bash/argotk.sh'"
README.md: .README.md argotk.hs default.nix
nix-shell -A dev-test --run "pandoc --filter `which panpipe` .README.md -o README.md"
README.html: README.md
nix-shell -A dev-test --run "pandoc README.md -o README.html"
.PHONY:clean
clean:
rm README.html
#### integration testing
This repository contains integration tests that validate the argo stack.
It leverages the argopkgs repo, but overrides some sources in it with
their master branch counterparts. see file `default.nix` for details.
The real intended usage is to override (some of) the source(s) with WIP
version(s), as part of development or continuous integration. This gitlab CI
snippets shows how to do this on a nix-enabled runner:
```{.yml}
integration.test:
stage: test
script:
- BUILD=$PWD
- git clone https://xgitlab.cels.anl.gov/argo/argotest.git
- cd argotest
- nix-shell -A test --run "./argotk.hs helloworld" --arg nrm-src ../.
artifacts:
paths:
- argotest/cmd_err.log
- argotest/cmd_out.log
- argotest/daemon_out.log
- argotest/daemon_out.log
- argotest/nrm.log
- argotest/time.log
expire_in: 1 week
except:
- /^wip\/.*/
- /^WIP\/.*/
tags:
- integration
```
Standalone usage: example with the nrm source in `../`.
```{.bash}
nix-shell -A test --arg nrm-src ../nrm
nix-shell $ ./argotk.hs --help
```
Output:
```{.txt pipe="sh"}
root/argotk.hs --help
```
......@@ -6,10 +6,10 @@ It leverages the argopkgs repo, but overrides some sources in it with
their master branch counterparts. see file `default.nix` for details.
The real intended usage is to override (some of) the source(s) with WIP
version(s), as part of development or continuous integration. This gitlab CI
snippets shows how to do this on a nix-enabled runner:
version(s), as part of development or continuous integration. This
gitlab CI snippets shows how to do this on a nix-enabled runner:
```{.yml}
``` {.yml}
integration.test:
stage: test
script:
......@@ -34,7 +34,23 @@ integration.test:
```
Standalone usage: example with the nrm source in `../`.
```
``` {.bash}
nix-shell -A test --arg nrm-src ../nrm
./integration.hs
nix-shell $ ./argotk.hs --help
```
Output:
``` {.txt}
Usage: argotk.hs COMMAND
Available options:
COMMAND Target for the greeting
-h,--help Show this help text
Available commands:
clean
daemon
helloworld
```
_argotk.hs()
{
local CMDLINE
local IFS=$'\n'
CMDLINE=(--bash-completion-index $COMP_CWORD)
for arg in ${COMP_WORDS[@]}; do
CMDLINE=(${CMDLINE[@]} --bash-completion-word $arg)
done
COMPREPLY=( $(./argotk.hs "${CMDLINE[@]}") )
}
complete -o filenames -F _argotk.hs argotk.hs
#compdef argotk.hs
local request
local completions
local word
local index=$((CURRENT - 1))
request=(--bash-completion-enriched --bash-completion-index $index)
for arg in ${words[@]}; do
request=(${request[@]} --bash-completion-word $arg)
done
IFS=$'\n' completions=($( ./argotk.hs "${request[@]}" ))
for word in $completions; do
local -a parts
# Split the line at a tab if there is one.
IFS=$'\t' parts=($( echo $word ))
if [[ -n $parts[2] ]]; then
if [[ $word[1] == "-" ]]; then
local desc=("$parts[1] ($parts[2])")
compadd -d desc -- $parts[1]
else
local desc=($(print -f "%-019s -- %s" $parts[1] $parts[2]))
compadd -l -d desc -- $parts[1]
fi
else
compadd -f -- $word
fi
done
......@@ -39,6 +39,7 @@ in rec
p.unix
p.system-filepath
p.async
(pkgs.haskell.lib.doJailbreak p.panpipe)
]))
containers
hpkgs.hdevtools
......@@ -50,6 +51,10 @@ in rec
};
test = pkgs.stdenv.mkDerivation rec {
shellHook = ''
source completions/bash/argotk.sh
echo "Installed bash completions."
'';
name = "env";
env = pkgs.buildEnv { name = name; paths = buildInputs; };
buildInputs = [
......
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