Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions .yamato/csharp-tests.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
name: Mac Edit Mode Tests
triggers:
test_editors:
- version: 2017.4
- version: 2018.4
- version: 2019.3
---
{% for editor in test_editors %}
test_mac_editmode_{{ editor.version }}:
name: Test Mac EditMode {{ editor.version }}
agent:
type: Unity::VM::osx
image: ml-agents/ml-agents-bokken-mac:release
flavor: i1.small
variables:
UNITY_VERSION: {{ editor.version }}
commands:
- ./run-tests-editmode-osx-editor.sh
triggers:
branches:
only:
- "/develop-.*/"
- "/develop-.*/"
targets:
only:
- "develop"
- "develop"
pull_requests:
- targets:
only:
- "master"
- "/release-.*/"
- "/hotfix-.*/"

agent:
type: Unity::VM::osx
image: ml-agents/ml-agents-bokken-mac:stable
flavor: i1.small

variables:
LC_ALL: "en_US.UTF-8"
commands:
- ./run-tests-editmode-osx-editor.sh
{% endfor %}
54 changes: 30 additions & 24 deletions .yamato/standalone-build-test.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
name: Mac Standalone Build Test
triggers:
branches:
only:
- "/develop-.*/"
targets:
only:
- "develop"
pull_requests:
- targets:
only:
- "master"
- "/release-.*/"
- "/hotfix-.*/"

agent:
type: Unity::VM::osx
image: ml-agents/ml-agents-bokken-mac:stable
flavor: i1.small

variables:
LC_ALL: "en_US.UTF-8"
commands:
- ./run-standalone-build-osx.sh
test_editors:
- version: 2017.4
- version: 2018.4
- version: 2019.3
---
{% for editor in test_editors %}
test_mac_standalone_{{ editor.version }}:
name: Test Mac Standalone {{ editor.version }}
agent:
type: Unity::VM::osx
image: ml-agents/ml-agents-bokken-mac:release
flavor: i1.small
variables:
UNITY_VERSION: {{ editor.version }}
commands:
- ./run-standalone-build-osx.sh
triggers:
branches:
only:
- "/develop-.*/"
targets:
only:
- "develop"
pull_requests:
- targets:
only:
- "master"
- "/release-.*/"
- "/hotfix-.*/"
{% endfor %}
55 changes: 31 additions & 24 deletions run-standalone-build-osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,44 @@

set -eo pipefail

EDITOR_VERSION="2017.4.33f1"
BOKKEN_UNITY="/Users/bokken/${EDITOR_VERSION}/Unity.app/Contents/MacOS/Unity"
HUB_UNITY="/Applications/Unity/Hub/Editor/${EDITOR_VERSION}/Unity.app/Contents/MacOS/Unity"
if [[ -z "${UNITY_VERSION}" ]]; then

echo "Environment Variable UNITY_VERSION was not set"
exit 1

if [[ -f ${BOKKEN_UNITY} ]]; then
UNITY=${BOKKEN_UNITY}
else
UNITY=${HUB_UNITY}
fi
BOKKEN_UNITY="/Users/bokken/${UNITY_VERSION}/Unity.app/Contents/MacOS/Unity"
HUB_UNITY="/Applications/Unity/Hub/Editor/${UNITY_VERSION}/Unity.app/Contents/MacOS/Unity"

pushd $(dirname "${0}") > /dev/null
BASETPATH=$(pwd -L)
popd > /dev/null
if [[ -f ${BOKKEN_UNITY} ]]; then
UNITY=${BOKKEN_UNITY}
else
UNITY=${HUB_UNITY}
fi

echo "Cleaning previous results"
pushd $(dirname "${0}") > /dev/null
BASETPATH=$(pwd -L)
popd > /dev/null

echo "Starting tests via $UNITY"
echo "Cleaning previous results"

CMD_LINE="$UNITY -projectPath $BASETPATH/UnitySDK -batchmode -executeMethod MLAgents.StandaloneBuildTest.BuildStandalonePlayerOSX"
echo "Starting tests via $UNITY"

echo "$CMD_LINE ..."
CMD_LINE="$UNITY -projectPath $BASETPATH/UnitySDK -logfile - -batchmode -executeMethod MLAgents.StandaloneBuildTest.BuildStandalonePlayerOSX"

${CMD_LINE}
RES=$?
echo "$CMD_LINE ..."

if [[ "${RES}" -eq "0" ]]; then
echo "Standalone build completed successfully.";
exit 0;
else
echo "Standalone build failed."
exit 1;
fi
${CMD_LINE}
RES=$?

exit ${RES}
if [[ "${RES}" -eq "0" ]]; then
echo "Standalone build completed successfully.";
exit 0;
else
echo "Standalone build failed."
exit 1;
fi

exit ${RES}

fi
71 changes: 39 additions & 32 deletions run-tests-editmode-osx-editor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,56 @@

set -eo pipefail

EDITOR_VERSION="2017.4.33f1"
BOKKEN_UNITY="/Users/bokken/${EDITOR_VERSION}/Unity.app/Contents/MacOS/Unity"
HUB_UNITY="/Applications/Unity/Hub/Editor/${EDITOR_VERSION}/Unity.app/Contents/MacOS/Unity"
if [[ -z "${UNITY_VERSION}" ]]; then

echo "Environment Variable UNITY_VERSION was not set"
exit 1

if [[ -f ${BOKKEN_UNITY} ]]; then
UNITY=${BOKKEN_UNITY}
else
UNITY=${HUB_UNITY}
fi
BOKKEN_UNITY="/Users/bokken/${UNITY_VERSION}/Unity.app/Contents/MacOS/Unity"
HUB_UNITY="/Applications/Unity/Hub/Editor/${UNITY_VERSION}/Unity.app/Contents/MacOS/Unity"

pushd $(dirname "${0}") > /dev/null
BASETPATH=$(pwd -L)
popd > /dev/null
if [[ -f ${BOKKEN_UNITY} ]]; then
UNITY=${BOKKEN_UNITY}
else
UNITY=${HUB_UNITY}
fi

echo "Cleaning previous results"
pushd $(dirname "${0}") > /dev/null
BASETPATH=$(pwd -L)
popd > /dev/null

if [[ -e ${BASETPATH}/results.xml ]]
then
rm ${BASETPATH}/results.xml
fi
echo "Cleaning previous results"

echo "Starting tests via $UNITY"
if [[ -e ${BASETPATH}/results.xml ]]
then
rm ${BASETPATH}/results.xml
fi

CMD_LINE="$UNITY -runTests -projectPath $BASETPATH/UnitySDK -testResults $BASETPATH/results.xml -testPlatform editmode"
echo "Starting tests via $UNITY"

echo "$CMD_LINE ..."
CMD_LINE="$UNITY -runTests -logfile - -projectPath $BASETPATH/UnitySDK -testResults $BASETPATH/results.xml -testPlatform editmode"

$CMD_LINE
RES=$?
echo "$CMD_LINE ..."

TOTAL=$(echo 'cat /test-run/test-suite/@total' | xmllint --shell results.xml | awk -F'[="]' '!/>/{print $(NF-1)}')
PASSED=$(echo 'cat /test-run/test-suite/@passed' | xmllint --shell results.xml | awk -F'[="]' '!/>/{print $(NF-1)}')
FAILED=$(echo 'cat /test-run/test-suite/@failed' | xmllint --shell results.xml | awk -F'[="]' '!/>/{print $(NF-1)}')
DURATION=$(echo 'cat /test-run/test-suite/@duration' | xmllint --shell results.xml | awk -F'[="]' '!/>/{print $(NF-1)}')
$CMD_LINE
RES=$?

echo "$TOTAL tests executed in ${DURATION}s: $PASSED passed, $FAILED failed. More details in results.xml"
TOTAL=$(echo 'cat /test-run/test-suite/@total' | xmllint --shell results.xml | awk -F'[="]' '!/>/{print $(NF-1)}')
PASSED=$(echo 'cat /test-run/test-suite/@passed' | xmllint --shell results.xml | awk -F'[="]' '!/>/{print $(NF-1)}')
FAILED=$(echo 'cat /test-run/test-suite/@failed' | xmllint --shell results.xml | awk -F'[="]' '!/>/{print $(NF-1)}')
DURATION=$(echo 'cat /test-run/test-suite/@duration' | xmllint --shell results.xml | awk -F'[="]' '!/>/{print $(NF-1)}')

if [[ ${RES} -eq 0 ]] && [[ -e ${BASETPATH}/results.xml ]]; then
echo "Test run SUCCEEDED!"
else
echo "Test run FAILED!"
fi
echo "$TOTAL tests executed in ${DURATION}s: $PASSED passed, $FAILED failed. More details in results.xml"

if [[ ${RES} -eq 0 ]] && [[ -e ${BASETPATH}/results.xml ]]; then
echo "Test run SUCCEEDED!"
else
echo "Test run FAILED!"
fi

rm "${BASETPATH}/results.xml"

rm "${BASETPATH}/results.xml"
exit ${RES}

exit ${RES}
fi