diff --git a/.yamato/csharp-tests.yml b/.yamato/csharp-tests.yml index e3e5d5b618..c34d3b7c00 100644 --- a/.yamato/csharp-tests.yml +++ b/.yamato/csharp-tests.yml @@ -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 %} diff --git a/.yamato/standalone-build-test.yml b/.yamato/standalone-build-test.yml index d2da77da9c..e2a9147eb2 100644 --- a/.yamato/standalone-build-test.yml +++ b/.yamato/standalone-build-test.yml @@ -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 %} \ No newline at end of file diff --git a/run-standalone-build-osx.sh b/run-standalone-build-osx.sh index f780281570..988ba571ec 100755 --- a/run-standalone-build-osx.sh +++ b/run-standalone-build-osx.sh @@ -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 diff --git a/run-tests-editmode-osx-editor.sh b/run-tests-editmode-osx-editor.sh index bdaaf04102..6d6c1ae42d 100755 --- a/run-tests-editmode-osx-editor.sh +++ b/run-tests-editmode-osx-editor.sh @@ -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 \ No newline at end of file