48 lines
1.1 KiB
Bash
Executable File
48 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
######
|
|
# This script runs unit tests and fails if unit tests don't succeed
|
|
# It expects docker to be logged in to ECR (see aws-login)
|
|
|
|
set -e
|
|
|
|
VERBOSE=0
|
|
|
|
DIR=`dirname $(realpath "${BASH_SOURCE[0]}")`
|
|
OLDDIR=`pwd`
|
|
cd "$DIR"
|
|
|
|
source "$DIR/../config"
|
|
source "$DIR/libs.sh"
|
|
|
|
usage() {
|
|
echo "Usage: $0 [-h] [-v] [-t: version] [image type, see below] " 1>&2;
|
|
echo "This script runs unit test for docker images, the image must exist:" 1>&2;
|
|
echo " -h: This message" 1>&2;
|
|
echo " -t: Framework version, this will be used as base for the docker image tag (default: local)" 1>&2;
|
|
echo " -v: Verbose" 1>&2;
|
|
exit 1;
|
|
}
|
|
|
|
TAG="local"
|
|
|
|
while getopts "t:hvaAjJmub" o; do
|
|
case "${o}" in
|
|
t)
|
|
TAG=${OPTARG}
|
|
;;
|
|
v)
|
|
VERBOSE=1
|
|
;;
|
|
h)
|
|
usage
|
|
;;
|
|
*)
|
|
printerr "Unsupported option ${o}"
|
|
usage
|
|
;;
|
|
esac
|
|
done
|
|
|
|
msg "Checking unit tests for version $TAG"
|
|
docker run $PROJECT_REPOSITORY/$PROJECT_GROUP/$PROJECT_BUILDNAME:$TAG-unit -c /test-phpframework/phpunit.xml
|