diff --git a/action/steps/run_tests.sh b/action/steps/run_tests.sh index 90fc4a0..a21f3fe 100644 --- a/action/steps/run_tests.sh +++ b/action/steps/run_tests.sh @@ -20,17 +20,30 @@ if [ "$PACKAGE_MODE" = "true" ]; then echo "###########################" echo "" - cat UNITY_PROJECT_PATH + cat "$UNITY_PROJECT_PATH" - echo "Creating an empty Unity project to add the package to." + PACKAGE_JSON_PATH="$UNITY_PROJECT_PATH/package.json" + if [ ! -f "$PACKAGE_JSON_PATH" ]; then + echo "Unable to locate package.json from the given package path. Aborting..." + exit + fi + + PACKAGE_NAME=$(cat "$PACKAGE_JSON_PATH" | jq ".name") + + if [ -z $PACKAGE_NAME ]; then + echo "Unable to parse package name from package.json. Aborting..." + exit + fi + + echo "Package name found: ${PACKAGE_NAME}" + +# echo "Creating an empty Unity project to add the package to." # unity-editor \ # -batchMode \ # -createProject "./TempProject" \ # -quit - jq --version - # UNITY_PROJECT_PATH="./TempProject" fi diff --git a/unity-package-with-correct-tests/package.json b/unity-package-with-correct-tests/package.json new file mode 100644 index 0000000..c1c5d29 --- /dev/null +++ b/unity-package-with-correct-tests/package.json @@ -0,0 +1,14 @@ +{ + "name": "com.example.packageName", + "version": "1.0.0", + "displayName": "Example Unity Package", + "description": "A package made to test unity-test-runner", + "unity": "2019.2", + "unityRelease": "11f1", + "author": { + "name": "Aaron Trudeau", + "email": "trudeaua@mail.gvsu.edu", + "url": "https://github.com/trudeaua21" + }, + "type": "tool" +}