Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore the test runner exit code #3

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
346 changes: 340 additions & 6 deletions .github/workflows/main.yml

Large diffs are not rendered by default.

Empty file modified .husky/pre-commit
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

GitHub Action to
[run tests](https://github.com/marketplace/actions/unity-test-runner)
for any Unity project.
for any Unity project and _some_ Unity packages.

Part of the <a href="https://game.ci">GameCI</a> open source project.
<br />
Expand Down
12 changes: 8 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ inputs:
unityVersion:
required: false
default: 'auto'
description: 'Version of unity to use for testing the project. Use "auto" to get from your ProjectSettings/ProjectVersion.txt'
description: 'Version of unity to use for testing the project. Use "auto" to get from your ProjectSettings/ProjectVersion.txt. ⚠️ If testing a Unity Package, this field is required and cannot be set to "auto".'
customImage:
required: false
default: ''
description: 'Specific docker image that should be used for testing the project'
description: 'Specific docker image that should be used for testing the project. If packageMode is true, this image must have jq installed.'
projectPath:
required: false
description: 'Path to the Unity project to be tested.'
description: 'Path to the Unity project or package to be tested.'
customParameters:
required: false
description: 'Extra parameters to configure the Unity editor run.'
Expand All @@ -23,7 +23,7 @@ inputs:
coverageOptions:
required: false
default: 'generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;dontClear'
description: 'Optional coverage parameters for the -coverageOptions argument.'
description: 'Optional coverage parameters for the -coverageOptions argument. To get coverage in Package Mode, pass assemblies from the package you want covered to the assemblyFilters option.'
artifactsPath:
required: false
default: 'artifacts'
Expand All @@ -48,6 +48,10 @@ inputs:
required: false
default: 'Test Results'
description: 'Name for the check run that is created when a github token is provided.'
packageMode:
required: false
default: false
description: 'Whether the tests are being run for a Unity package instead of a Unity project. If true, the action can only be run on Linux runners, and any custom docker image passed to this action must have `jq` installed. NOTE: may not work properly for packages with dependencies outside of the Unity Registry.'
chownFilesTo:
required: false
default: ''
Expand Down
46 changes: 29 additions & 17 deletions dist/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,38 @@ source /steps/return_license.sh
rm -r "$ACTIVATE_LICENSE_PATH"

#
# Instructions for debugging
# Configure ssh
#

if [[ $TEST_RUNNER_EXIT_CODE -gt 0 ]]; then
echo ""
echo "###########################"
echo "# Failure #"
echo "###########################"
echo ""
echo "Please note that the exit code is not very descriptive."
echo "Most likely it will not help you solve the issue."
echo ""
echo "To find the reason for failure: please search for errors in the log above."
echo ""
fi;
mkdir -m 700 -p ~/.ssh && echo "Host *" > ~/.ssh/config && echo " StrictHostKeyChecking no" >> ~/.ssh/config

#
# Exit with code from the build step.
# Instructions for debugging
#

if [[ $USE_EXIT_CODE == true || $TEST_RUNNER_EXIT_CODE -ne 2 ]]; then
exit $TEST_RUNNER_EXIT_CODE
fi;
# TODO we get some strange "crashes" where everything ran correctly but still exited non-zero,
# so for now ignore the test runner exit code. see https://github.com/game-ci/unity-test-runner/issues/216
IGNORE_TEST_RUNNER_EXIT_CODE=true

if [[ $IGNORE_TEST_RUNNER_EXIT_CODE != true ]]; then
if [[ $TEST_RUNNER_EXIT_CODE -gt 0 ]]; then
echo ""
echo "###########################"
echo "# Failure #"
echo "###########################"
echo ""
echo "Please note that the exit code is not very descriptive."
echo "Most likely it will not help you solve the issue."
echo ""
echo "To find the reason for failure: please search for errors in the log above."
echo ""
fi;

#
# Exit with code from the build step.
#

if [[ $USE_EXIT_CODE == true || $TEST_RUNNER_EXIT_CODE -ne 2 ]]; then
exit $TEST_RUNNER_EXIT_CODE
fi;
fi
Loading