game-ci / unity-test-runner

Run tests for any Unity project
https://github.com/marketplace/actions/unity-test-runner
MIT License
210 stars 135 forks source link

Add chownToUser #186

Closed skjalgsm-statespace closed 2 years ago

skjalgsm-statespace commented 2 years ago

Context

I am running game.ci using my own ubuntu runners and I am getting a problem on the second run where it wont do the checkout because of permission issues image

Suggested solution

I got around a similar problem when using unity-builder and its build artifacts by adding chownFilesTo in that workflow. But this option does not exist in unity-test-runner, so I suggest that its added for the test and code coverage artifacts.

You can find the code that is ran in build.sh in unity-builder (for both mac and ubuntu)

# Make a given user owner of all artifacts
if [[ -n "$CHOWN_FILES_TO" ]]; then
  chown -R "$CHOWN_FILES_TO" "$BUILD_PATH_FULL"
  chown -R "$CHOWN_FILES_TO" "$UNITY_PROJECT_PATH"
fi

Adapting this for unity-test-runner it would probably be something like (in run_tests.sh)

# Make a given user owner of all artifacts
if [[ -n "$CHOWN_FILES_TO" ]]; then
  chown -R "$CHOWN_FILES_TO" "$FULL_ARTIFACTS_PATH"
  chown -R "$CHOWN_FILES_TO" "$FULL_COVERAGE_RESULTS_PATH"
  chown -R "$CHOWN_FILES_TO" "$UNITY_PROJECT_PATH"
fi
webbertakken commented 2 years ago

Sounds good. Accepting PRs for this.

davidmfinol commented 2 years ago

Done by https://github.com/game-ci/unity-test-runner/pull/187 and available with v2.0.3

Thank you @skjalgsm-statespace !