Try docker grid
Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
parent
9c7fab714c
commit
4b7f292beb
123
.laminar
123
.laminar
|
@ -1,5 +1,126 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
echo OKAY
|
||||
PYTHON_VERSIONS=(3.7 3.8 3.9 3.10)
|
||||
|
||||
# grid run
|
||||
if [ ${CONTEXT:-ERR} = "docker-single" ]
|
||||
then
|
||||
red "Laminar run in grid PYTHON=${PYTHON:-not_specified} commit=${commit:-not_specified}..."
|
||||
SERIAL=${SERIAL:-2000-00-00_$RANDOM}
|
||||
echo "Serial of run: $SERIAL"
|
||||
|
||||
invoker="\e[{${invoker:-}\e\\"
|
||||
[ -z "${invoker}" ] || echo -e "Invoked from $invoker"
|
||||
|
||||
# name
|
||||
nn=repo_checker_$PYTHON
|
||||
nn=$(echo $nn | sed 's/\./_/g')
|
||||
|
||||
if [ -f .env ]
|
||||
then
|
||||
sed '/^UNIONDIR/d' -i .env
|
||||
sed '/^ENVFILE/d' -i .env
|
||||
fi
|
||||
|
||||
#green "Dump of .env:"
|
||||
#cat .env
|
||||
|
||||
#green "Dump of docker-env:"
|
||||
#cat ../docker-env
|
||||
|
||||
|
||||
# TODO: fix later
|
||||
exit 0
|
||||
|
||||
cd ci
|
||||
|
||||
#green "Dump docker-compose config:"
|
||||
#docker-compose config
|
||||
|
||||
green "Building CI image..."
|
||||
docker-compose -p $nn build --pull
|
||||
|
||||
green "Running tests in docker..."
|
||||
docker-compose -p $nn up -d
|
||||
|
||||
green "Test logs:"
|
||||
green "====================================================="
|
||||
docker logs --follow ${nn}-sut-1
|
||||
|
||||
code=$(docker wait ${nn}-sut-1)
|
||||
green "Container exitcode: $code"
|
||||
|
||||
green "Stopping what has been left here"
|
||||
docker-compose -p $nn down
|
||||
|
||||
# go back
|
||||
cd ..
|
||||
|
||||
green "Archive coverage"
|
||||
if [ -d "htmlcov" ]
|
||||
then
|
||||
mv htmlcov/* $ARCHIVE/
|
||||
fi
|
||||
|
||||
exit $code
|
||||
fi
|
||||
|
||||
|
||||
# Grid starter...
|
||||
###############################
|
||||
|
||||
# create temporary files
|
||||
scratch=$(mktemp -d)
|
||||
|
||||
finish(){
|
||||
rm -Rf $scratch
|
||||
}
|
||||
trap finish EXIT
|
||||
|
||||
# executor output
|
||||
SERIAL=$(date +"%Y-%m-%d_%H-%M-%S")
|
||||
MAX_EXIT=0
|
||||
|
||||
green "Executing $JOB-grid with params:"
|
||||
echo "Serial of run is: $SERIAL"
|
||||
echo "JOB PYTHON TIME EXIT" > $scratch/sum
|
||||
|
||||
for python in ${PYTHON_VERSIONS[@]}
|
||||
do
|
||||
echo "PYTHON=$python commit=\"${commit:-}\""
|
||||
set +e # disable exit fail
|
||||
# execute command
|
||||
/usr/bin/time --format "%E" -o $scratch/time \
|
||||
env LAMINAR_REASON="$(git log --oneline -n 1 ${commit:-})" \
|
||||
laminarc run $JOB-grid \
|
||||
SERIAL=$SERIAL \
|
||||
invoker="${JOB}:${RUN}" \
|
||||
PYTHON=$python commit="${commit:-}" \
|
||||
> $scratch/output
|
||||
|
||||
rc=$?
|
||||
set -e # reenable exit fail
|
||||
|
||||
|
||||
if [ $rc -gt 0 ]
|
||||
then
|
||||
res=$(echo -e "\e[41m_FAIL_\e[49m")
|
||||
else
|
||||
res=$(echo -e "\e[42m__OK__\e[49m")
|
||||
fi
|
||||
|
||||
|
||||
echo "$(cat $scratch/output) $python $(tail -1 $scratch/time) $res" >> $scratch/sum
|
||||
|
||||
[ $rc -gt $MAX_EXIT ] && MAX_EXIT=$rc
|
||||
done
|
||||
|
||||
|
||||
green "Result summary:"
|
||||
cat $scratch/sum | column -t
|
||||
|
||||
|
||||
exit $MAX_EXIT
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user