Skip to content

Commit

Permalink
Test verbose (#37)
Browse files Browse the repository at this point in the history
* add verbose flag
* add "test summary" task (passed/failed per bundler)
* support older docker-compose (only single --envfile param)
  • Loading branch information
drortirosh committed Nov 18, 2023
1 parent c87c24f commit 2dbbd22
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 11 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ on:
description: 'dump logs'
required: false
type: boolean

verbose:
description: 'verbose script logging'
type: choice
required: false
options:
-
- true

skip_test:
description: 'skip test - check github update'
required: false
Expand Down Expand Up @@ -41,10 +50,10 @@ jobs:

- run: pip install jq yq
- run: which xq
- run: echo $PATH
- run: echo '<hello>a<world tag="123"/>b</hello>' | xq

- uses: actions/checkout@v1
- uses: actions/checkout@v4
with:
show-progress: false

# - uses: actions/checkout@v3
# with:
Expand Down Expand Up @@ -73,10 +82,13 @@ jobs:
- run: "cd bundler-spec-tests && pdm install && pdm update-deps"
name: update submodules of bundler-spec-tests

- run: ./runall.sh ${{ inputs.runall_params }}
- run: VERBOSE=${{ inputs.verbose }} ./runall.sh ${{ inputs.runall_params }}
if: ${{ ! inputs.skip_test }}
name: Run all tests ${{ inputs.runall_params }}

- name: "Test summary"
run: "grep -r '===.* in ' `find . -path '*build/out*txt'`| sed -e 's/===*//g' "

- name: dump logs
if: ${{ inputs.dump_logs }}
run: for d in build/*/*.log; do echo === $d:; cat $d | perl -pe 's/(?:runbundler-)?(\S+?)(?:-1)?[\s|]+(\S+)/$2 $1 /' | sort ; done
Expand Down
5 changes: 4 additions & 1 deletion runall.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/bash -x
#!/bin/bash

test -n "$VERBOSE" && set -x

root=`realpath \`dirname $0\``

BUILD=$root/build
Expand Down
3 changes: 3 additions & 0 deletions runbundler/run2bundlers.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/bash -e

test -n "$VERBOSE" && set -x

dir=`dirname $0`

if [ -z "$2" ] ; then
Expand Down
24 changes: 18 additions & 6 deletions runbundler/runbundler.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/bash

test -n "$VERBOSE" && set -x

dir=`dirname $0`
root=`cd $dir/.. ; pwd`

Expand All @@ -20,6 +23,13 @@ exit 1

}

#collect envfiles into TMPENV (docker-compose v1.x can get only a single env file..)
TMPENV=/tmp/tmp.env

function docker-compose1 {
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v $root:$root -v $TMPENV:$TMPENV -w="$PWD" docker:24-cli compose "$@"
}

file=`realpath $1`
cmd=$2
shift
Expand All @@ -30,19 +40,21 @@ test -z "$cmd" && usage
case "$file" in
*.yml)
export DCFILE="$dir/runbundler.yml"
export DCPARAMS="--env-file $dir/runbundler.env"
cat $dir/runbundler.env > $TMPENV
export DCPARAMS="--env-file $TMPENV"
echo BUNDLER_YML=$file >> $TMPENV
envfile1=`dirname $file`/.env
ENVFILE=`cd $root; realpath $envfile1 2> /dev/null`
test -r "$ENVFILE" && DCPARAMS="$DCPARAMS --env-file $ENVFILE"
export BUNDLER_YML=$file
test -r "$ENVFILE" && cat $ENVFILE >> $TMPENV
;;

*.env)
export DCFILE="$dir/run2bundlers.yml"
export DCPARAMS="--env-file $dir/run2bundlers.env"
cat $dir/run2bundlers.env > $TMPENV
export DCPARAMS="--env-file $TMPENV"
source $file
test -n "$ENVFILE" && test -r "$root/$ENVFILE" && DCPARAMS="$DCPARAMS --env-file $root/$ENVFILE"
test -n "$ENVFILE2" && test -r "$root/$ENVFILE2" && DCPARAMS="$DCPARAMS --env-file $root/$ENVFILE2"
test -n "$ENVFILE" && test -r "$root/$ENVFILE" && cat $root/$ENVFILE >> $TMPENV
test -n "$ENVFILE2" && test -r "$root/$ENVFILE2" && cat $root/$ENVFILE >> $TMPENV
;;
*) usage ;;

Expand Down

0 comments on commit 2dbbd22

Please sign in to comment.