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

Split Unity launching attempts (doesn't work in loop) #43

Merged
merged 4 commits into from
Dec 18, 2023
Merged
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
77 changes: 58 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,43 @@ jobs:
shell: bash
run: sudo /Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -nographics -manualLicenseFile "$(ls | grep ".ulf$")" -quit
continue-on-error: true #Unity return exit code 1 even if successfully activating with license file

- name: Launch Unity to test license
id: launch_unity_to_test_license
shell: bash
run: |
sudo /Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -nographics -projectPath "$GITHUB_WORKSPACE" -quit
continue-on-error: true

#if launching Unity failed -> try activating the license again
- name: Activate Unity with .ULF license file 2
if: steps.launch_unity_to_test_license.outcome == 'failure'
shell: bash
run: sudo /Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -nographics -manualLicenseFile "$(ls | grep ".ulf$")" -quit
continue-on-error: true #Unity return exit code 1 even if successfully activating with license file

- name: Launch Unity to test license 2
id: launch_unity_to_test_license2
if: steps.launch_unity_to_test_license.outcome == 'failure'
shell: bash
run: |
sudo /Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -nographics -projectPath "$GITHUB_WORKSPACE" -quit
continue-on-error: true

#if launching Unity failed -> try activating the license again
- name: Activate Unity with .ULF license file
if: steps.launch_unity_to_test_license2.outcome == 'failure'
shell: bash
run: sudo /Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -nographics -manualLicenseFile "$(ls | grep ".ulf$")" -quit
continue-on-error: true #Unity return exit code 1 even if successfully activating with license file

- name: Launch Unity to test license
id: launch_unity_to_test_license3
if: steps.launch_unity_to_test_license2.outcome == 'failure'
shell: bash
run: |
sudo /Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -nographics -projectPath "$GITHUB_WORKSPACE" -quit
continue-on-error: true

- name: LS Unity Logs dir
shell: bash
Expand All @@ -210,32 +247,36 @@ jobs:
run: cat ~/Library/Logs/Unity/Editor.log
continue-on-error: true

- name: Enable Stream Tests in Unity
- name: Enable Stream Tests in Unity (Attempt 1)
id: enable_stream_tests_in_unity
shell: bash
run: |
success=false
for i in {1..3}; do
output=$(sudo /Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -nographics -projectPath "$GITHUB_WORKSPACE" -executeMethod StreamVideo.EditorTools.StreamEditorTools.EnableStreamTestsEnabledCompilerFlag -quit 2>&1)
echo "$output"
if [[ ! "$output" == *"License is not active"* ]]; then
success=true
break
fi
echo "Attempt $i failed due to inactive license, retrying..."
done
if [ "$success" = false ]; then
echo "All attempts failed."
exit 1
fi
sudo /Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -nographics -projectPath "$GITHUB_WORKSPACE" -executeMethod StreamVideo.EditorTools.StreamEditorTools.EnableStreamTestsEnabledCompilerFlag -quit
continue-on-error: true

- name: Enable Stream Tests in Unity (Attempt 2)
id: enable_stream_tests_in_unity2
if: steps.enable_stream_tests_in_unity.outcome == 'failure'
shell: bash
run: |
sudo /Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -nographics -projectPath "$GITHUB_WORKSPACE" -executeMethod StreamVideo.EditorTools.StreamEditorTools.EnableStreamTestsEnabledCompilerFlag -quit
continue-on-error: true

- name: Enable Stream Tests in Unity (Attempt 3)
id: enable_stream_tests_in_unity3
if: steps.enable_stream_tests_in_unity2.outcome == 'failure'
shell: bash
run: |
sudo /Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -nographics -projectPath "$GITHUB_WORKSPACE" -executeMethod StreamVideo.EditorTools.StreamEditorTools.EnableStreamTestsEnabledCompilerFlag -quit

#skip -quit due to not working with async tests
#skip -quit due to not working with async tests
- name: Run Unity Tests
id: run_unity_tests
shell: bash
run: sudo /Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -nographics -projectPath "$GITHUB_WORKSPACE" -runTests -testResults ~/test_results/results.xml -streamBase64TestDataSet ${{ secrets.STREAM_AUTH_TEST_DATA_BASE64 }}
continue-on-error: true

#due to skipped -quit
#due to skipped -quit
- name: Force Close Unity
shell: bash
run: sudo pkill -x Unity
Expand Down Expand Up @@ -310,5 +351,3 @@ jobs:
with:
name: ${{ matrix.os }}_${{ matrix.unity_version }}_${{ matrix.compiler }}_${{ matrix.dotnet_version }}_${{ matrix.target_platform }}_sample_app
path: ~/SampleAppBuild/App/


Loading