2019-08-15 10:33:20 +03:00
|
|
|
#!/bin/sh -eu
|
|
|
|
{ set +x; } 2>/dev/null
|
|
|
|
SOURCE="${BASH_SOURCE[0]}"
|
|
|
|
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
|
|
|
|
|
|
|
|
YAMATO=0
|
|
|
|
PARAMS=""
|
|
|
|
|
2019-12-20 14:44:56 +03:00
|
|
|
TESTDIR="$DIR/build/tests"
|
2019-08-15 10:33:20 +03:00
|
|
|
REPORTDIR="$DIR/test-results"
|
|
|
|
PACKAGESDIR="$DIR/packages"
|
|
|
|
NUNIT="$PACKAGESDIR/NUnit.ConsoleRunner.3.10.0/tools/nunit3-console.exe"
|
|
|
|
NURE="$PACKAGESDIR/Nure.1.2.0/tools/nure.exe"
|
|
|
|
|
2019-12-20 14:44:56 +03:00
|
|
|
CONFIGURATION=Release
|
|
|
|
PUBLIC=""
|
|
|
|
BUILD=0
|
|
|
|
UPM=0
|
|
|
|
UNITYVERSION=2019.2
|
|
|
|
YAMATO=0
|
|
|
|
|
2019-08-15 10:33:20 +03:00
|
|
|
while (( "$#" )); do
|
|
|
|
case "$1" in
|
|
|
|
--yamato)
|
|
|
|
YAMATO=1
|
|
|
|
shift 1
|
|
|
|
;;
|
|
|
|
-o|--out)
|
|
|
|
REPORTDIR="$2"
|
|
|
|
shift 2
|
|
|
|
;;
|
2019-12-20 14:44:56 +03:00
|
|
|
-d|--debug)
|
|
|
|
CONFIGURATION="Debug"
|
|
|
|
;;
|
|
|
|
-r|--release)
|
|
|
|
CONFIGURATION="Release"
|
|
|
|
;;
|
|
|
|
-p|--public)
|
|
|
|
PUBLIC="-p:PublicRelease=true"
|
|
|
|
;;
|
|
|
|
-b|--build)
|
|
|
|
BUILD=1
|
|
|
|
;;
|
|
|
|
-u|--upm)
|
|
|
|
UPM=1
|
|
|
|
;;
|
|
|
|
-c)
|
2019-08-15 10:33:20 +03:00
|
|
|
shift
|
2019-12-20 14:44:56 +03:00
|
|
|
CONFIGURATION=$1
|
|
|
|
;;
|
2019-08-15 10:33:20 +03:00
|
|
|
-*|--*=) # unsupported flags
|
|
|
|
echo "Error: Unsupported flag $1" >&2
|
|
|
|
exit 1
|
2019-12-20 14:44:56 +03:00
|
|
|
;;
|
2019-08-15 10:33:20 +03:00
|
|
|
esac
|
2019-12-20 14:44:56 +03:00
|
|
|
shift
|
2019-08-15 10:33:20 +03:00
|
|
|
done
|
|
|
|
|
|
|
|
# set positional arguments in their proper place
|
|
|
|
eval set -- "$PARAMS"
|
|
|
|
|
|
|
|
if [[ x"$YAMATO" == x"1" ]] && [[ x"$REPORTDIR" == x"" ]]; then
|
|
|
|
echo "-o|--out cannot be empty"
|
|
|
|
fi
|
|
|
|
|
2019-12-20 14:44:56 +03:00
|
|
|
pushd $DIR >/dev/null 2>&1
|
2019-08-15 10:33:20 +03:00
|
|
|
{
|
|
|
|
|
2019-12-20 14:44:56 +03:00
|
|
|
if [[ x"$BUILD" == x"1" ]]; then
|
|
|
|
|
|
|
|
if [[ x"${APPVEYOR:-}" == x"" ]]; then
|
|
|
|
dotnet restore
|
|
|
|
fi
|
|
|
|
|
|
|
|
dotnet build --no-restore -c $CONFIGURATION $PUBLIC
|
|
|
|
fi
|
|
|
|
|
|
|
|
} || {
|
|
|
|
popd
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pushd "$TESTDIR"
|
|
|
|
{
|
|
|
|
echo "\"$NUNIT\" *Tests.dll --where \"cat != DoNotRunOnAppVeyor\""
|
|
|
|
"$NUNIT" *Tests.dll --where "cat != DoNotRunOnAppVeyor"
|
2019-08-15 10:33:20 +03:00
|
|
|
|
|
|
|
if [[ x"$YAMATO" == x"1" ]]; then
|
|
|
|
"$NURE" TestResult.xml --html -o "$REPORTDIR"
|
|
|
|
fi
|
|
|
|
|
|
|
|
} || {
|
|
|
|
popd
|
|
|
|
}
|