Change DTOs to not have any fields strictly required #193
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI - Run Tests + Build Sample App | |
on: | |
pull_request: | |
branches: [ main, develop ] | |
pull_request_target: | |
types: [edited, synchronized] #Triggers CI when the PR target was changed | |
push: | |
branches: [ main, develop ] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
jobs: | |
testRunner: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest] | |
unity_version: [2021.3.27, 2022.3.4] | |
dotnet_version: [NET_4_x, STANDARD_2_x] | |
compiler: [il2cpp] | |
target_platform: [standalone, mobile] | |
name: Run tests + Build Sample APp | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 600 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Print chipset | |
shell: bash | |
run: uname -m | |
continue-on-error: true | |
- name: Set up Node.js 16 | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Print python version | |
shell: bash | |
run: python --version | |
continue-on-error: true | |
- name: Install node package, `unity-license-activate` | |
run: npm install --global https://github.com/sierpinskid/unity-license-activate | |
- name: Install node package, `unity-verify-code` | |
run: npm install --global https://github.com/sierpinskid/unity-verify-code | |
- name: Download Unity & Modules | |
if: ${{ matrix.os }} == 'macos-latest' | |
shell: bash | |
run: | | |
if [[ ${{ matrix.unity_version }} == '2021.3.27' ]] | |
then | |
curl -L -o ~/Unity.pkg https://download.unity3d.com/download_unity/ca3ffb99bcc6/MacEditorInstaller/Unity.pkg | |
if [[ ${{ matrix.compiler }} == 'il2cpp' ]] | |
then | |
curl -L -o ~/UnityIL2CPPModule.pkg https://download.unity3d.com/download_unity/ca3ffb99bcc6/MacEditorTargetInstaller/UnitySetup-Mac-IL2CPP-Support-for-Editor-2021.3.27f1.pkg | |
fi | |
if [[ ${{ matrix.target_platform }} == 'mobile' ]] | |
then | |
curl -L -o ~/UnityIosModule.pkg https://download.unity3d.com/download_unity/ca3ffb99bcc6/MacEditorTargetInstaller/UnitySetup-iOS-Support-for-Editor-2021.3.27f1.pkg | |
fi | |
elif [[ ${{ matrix.unity_version }} == '2022.3.4' ]] | |
then | |
curl -L -o ~/Unity.pkg https://download.unity3d.com/download_unity/35713cd46cd7/MacEditorInstaller/Unity.pkg | |
if [[ ${{ matrix.compiler }} == 'il2cpp' ]] | |
then | |
curl -L -o ~/UnityIL2CPPModule.pkg https://download.unity3d.com/download_unity/35713cd46cd7/MacEditorTargetInstaller/UnitySetup-Mac-IL2CPP-Support-for-Editor-2022.3.4f1.pkg | |
fi | |
if [[ ${{ matrix.target_platform }} == 'mobile' ]] | |
then | |
curl -L -o ~/UnityIosModule.pkg https://download.unity3d.com/download_unity/35713cd46cd7/MacEditorTargetInstaller/UnitySetup-iOS-Support-for-Editor-2022.3.4f1.pkg | |
fi | |
fi | |
- name: Install Unity | |
uses: nick-fields/retry@v2 | |
with: | |
timeout_minutes: 15 | |
max_attempts: 3 | |
shell: bash | |
command: sudo installer -package ~/Unity.pkg -target / | |
- name: Instal IL2CPP Module | |
if: matrix.compiler == 'il2cpp' | |
uses: nick-fields/retry@v2 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 3 | |
shell: bash | |
command: sudo installer -package ~/UnityIL2CPPModule.pkg -target / | |
- name: Instal Mobile Module | |
if: matrix.target_platform == 'mobile' | |
uses: nick-fields/retry@v2 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 3 | |
shell: bash | |
command: sudo installer -package ~/UnityIosModule.pkg -target / | |
- name: Create Test Results dir | |
shell: bash | |
run: mkdir test_results | |
- name: Generate .ALF license file | |
shell: bash | |
run: sudo /Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -nographics -createManualActivationFile -quit | |
continue-on-error: true #Unity return exit code 1 even if successfully creating license file | |
- name: List dir | |
shell: bash | |
run: | | |
ls | |
grep ".alf$" | |
ULF_FILE_PATH=$(ls | grep ".alf$") | |
echo $ULF_FILE_PATH | |
continue-on-error: true | |
- name: Ensure code file exists | |
shell: bash | |
run: touch ./code.txt | |
continue-on-error: true | |
- name: Activate .ALF License - Get .ULF file | |
id: generate_ulf_license_attempt_1 | |
shell: bash | |
run: sudo unity-license-activate "${{ secrets.UNITY_ACCOUNT_USER }}" "${{ secrets.UNITY_ACCOUNT_PASS }}" "$(ls | grep ".alf$")" --password "${{ secrets.EMAIL_PASS }}" --host "imap.gmail.com" | |
timeout-minutes: 25 | |
continue-on-error: true | |
- name: Activate .ALF License - Get .ULF file - Attempt 2 | |
if: steps.generate_ulf_license_attempt_1.outcome == 'failure' | |
id: generate_ulf_license_attempt_2 | |
shell: bash | |
run: sudo unity-license-activate "${{ secrets.UNITY_ACCOUNT_USER }}" "${{ secrets.UNITY_ACCOUNT_PASS }}" "$(ls | grep ".alf$")" --password "${{ secrets.EMAIL_PASS }}" --host "imap.gmail.com" | |
timeout-minutes: 25 | |
continue-on-error: true | |
- name: Activate .ALF License - Get .ULF file - Attempt 3 | |
if: steps.generate_ulf_license_attempt_2.outcome == 'failure' | |
id: generate_ulf_license_attempt_3 | |
shell: bash | |
run: sudo unity-license-activate "${{ secrets.UNITY_ACCOUNT_USER }}" "${{ secrets.UNITY_ACCOUNT_PASS }}" "$(ls | grep ".alf$")" --password "${{ secrets.EMAIL_PASS }}" --host "imap.gmail.com" | |
timeout-minutes: 25 | |
continue-on-error: true | |
- name: 🩺 Upload error screenshot | |
if: steps.generate_ulf_license_attempt_1.outcome == 'failure' | |
uses: actions/upload-artifact@v1 | |
continue-on-error: true | |
with: | |
name: screenshot_error_1 | |
path: error.png | |
- name: 🩺 Upload error screenshot 2 | |
if: steps.generate_ulf_license_attempt_2.outcome == 'failure' | |
uses: actions/upload-artifact@v1 | |
continue-on-error: true | |
with: | |
name: screenshot_error_2 | |
path: error.png | |
- name: 🩺 Upload error screenshot 3 | |
if: steps.generate_ulf_license_attempt_3.outcome == 'failure' | |
uses: actions/upload-artifact@v1 | |
continue-on-error: true | |
with: | |
name: screenshot_error_3 | |
path: error.png | |
- name: Activate Unity with .ULF license file | |
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 | |
run: ls ~/Library/Logs/Unity/ | |
continue-on-error: true | |
- name: Print Audit Unity Logs | |
shell: bash | |
run: cat ~/Library/Logs/Unity/Unity.Entitlements.Audit.log | |
continue-on-error: true | |
- name: Print Client Unity Logs | |
shell: bash | |
run: cat ~/Library/Logs/Unity/Unity.Licensing.Client.log | |
continue-on-error: true | |
- name: Print Unity Editor Logs | |
shell: bash | |
run: cat ~/Library/Logs/Unity/Editor.log | |
continue-on-error: true | |
- name: Enable Stream Tests in Unity (Attempt 1) | |
id: enable_stream_tests_in_unity | |
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 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 | |
- 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 | |
- name: Force Close Unity | |
shell: bash | |
run: sudo pkill -x Unity | |
continue-on-error: true | |
- name: Print Test Results | |
if: always() | |
shell: bash | |
run: cat ~/test_results/results.xml | |
- name: Print Unity Logs | |
shell: bash | |
run: cat ~/Library/Logs/Unity/Editor.log | |
continue-on-error: true | |
- name: Generate HTML test report | |
uses: rempelj/[email protected] | |
if: always() | |
with: | |
inputXmlPath: ~/test_results/results.xml | |
outputHtmlPath: ~/test_results/results.html | |
- name: Upload tests results XML Artifact | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: ${{ matrix.os }}_${{ matrix.unity_version }}_${{ matrix.compiler }}_${{ matrix.dotnet_version }}_${{ matrix.target_platform }}_test_results.xml | |
path: ~/test_results/results.xml | |
- name: Upload tests results Html Artifact | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: ${{ matrix.os }}_${{ matrix.unity_version }}_${{ matrix.compiler }}_${{ matrix.dotnet_version }}_${{ matrix.target_platform }}_test_results.html | |
path: ~/test_results/results.html | |
- name: Validate All Tests Passed | |
if: steps.run_unity_tests.outcome == 'failure' | |
run: exit 1 | |
- name: Generate GH Summary Comment | |
uses: sierpinskid/nunit-github-comment@v1 | |
if: github.event_name == 'pull_request' | |
with: | |
inputXmlPath: ~/test_results/results.xml | |
outputFilePath: ~/test_results/gh_comment.txt | |
- name: Set GH Comment as variable | |
if: github.event_name == 'pull_request' | |
id: generate_gh_comment | |
run: echo "::set-output name=gh_comment::$(cat ~/test_results/gh_comment.txt)" | |
- name: Build Sample App | |
shell: bash | |
run: sudo /Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -nographics -projectPath "$GITHUB_WORKSPACE" -executeMethod "StreamVideo.EditorTools.StreamEditorTools.BuildSampleApp" -apiCompatibility ${{ matrix.dotnet_version }} -scriptingBackend ${{ matrix.compiler }} -buildTargetPlatform ${{ matrix.target_platform }} -buildTargetPath "~/SampleAppBuild/App" -quit | |
- name: LS | |
shell: bash | |
run: | | |
ls | |
echo '----' | |
ls ~ | |
echo '----' | |
ls "~/SampleAppBuild/" | |
echo '----' | |
ls "~/SampleAppBuild/App/" | |
echo '----' | |
continue-on-error: true | |
- name: Upload Sample App | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.os }}_${{ matrix.unity_version }}_${{ matrix.compiler }}_${{ matrix.dotnet_version }}_${{ matrix.target_platform }}_sample_app | |
path: ~/SampleAppBuild/App/ |