From 2dbbd22bd1d63d74abc596df998e3d047bb96d51 Mon Sep 17 00:00:00 2001 From: Dror Tirosh Date: Sat, 18 Nov 2023 14:59:20 +0100 Subject: [PATCH] Test verbose (#37) * add verbose flag * add "test summary" task (passed/failed per bundler) * support older docker-compose (only single --envfile param) --- .github/workflows/build.yml | 20 ++++++++++++++++---- runall.sh | 5 ++++- runbundler/run2bundlers.sh | 3 +++ runbundler/runbundler.sh | 24 ++++++++++++++++++------ 4 files changed, 41 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0df00c1..bbe6a2c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -41,10 +50,10 @@ jobs: - run: pip install jq yq - run: which xq - - run: echo $PATH - - run: echo 'ab' | xq - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 + with: + show-progress: false # - uses: actions/checkout@v3 # with: @@ -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 diff --git a/runall.sh b/runall.sh index 6ad5030..c715bb7 100755 --- a/runall.sh +++ b/runall.sh @@ -1,4 +1,7 @@ -#!/bin/bash -x +#!/bin/bash + +test -n "$VERBOSE" && set -x + root=`realpath \`dirname $0\`` BUILD=$root/build diff --git a/runbundler/run2bundlers.sh b/runbundler/run2bundlers.sh index a6e8e6f..64531c4 100755 --- a/runbundler/run2bundlers.sh +++ b/runbundler/run2bundlers.sh @@ -1,4 +1,7 @@ #!/bin/bash -e + +test -n "$VERBOSE" && set -x + dir=`dirname $0` if [ -z "$2" ] ; then diff --git a/runbundler/runbundler.sh b/runbundler/runbundler.sh index 3a321e4..c7cdb3d 100755 --- a/runbundler/runbundler.sh +++ b/runbundler/runbundler.sh @@ -1,4 +1,7 @@ #!/bin/bash + +test -n "$VERBOSE" && set -x + dir=`dirname $0` root=`cd $dir/.. ; pwd` @@ -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 @@ -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 ;;