From 6ec817decb46ed4986d691be8bae0c7c41dde8e1 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 23 Jan 2025 11:59:53 +0100 Subject: [PATCH 01/29] extracted 'build' --- .github/workflows/build.yml | 138 ++++++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 132 +--------------------------------- 2 files changed, 141 insertions(+), 129 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..d3b0036a6 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,138 @@ +name: Build + +on: + workflow_call: + inputs: + unity-version: + required: true + type: string + +env: + LOWEST_SUPPORTED_UNITY_VERSION: 2019 + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + DOTNET_NOLOGO: 1 + +jobs: + build: + name: Build - ${{ inputs.unity-version }} + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Checkout submodules + run: git submodule update --init --recursive src/sentry-dotnet + + - name: Load env + id: env + run: echo "unityVersion=$(./scripts/ci-env.ps1 "unity${{ inputs.unity-version }}")" >> $env:GITHUB_OUTPUT + + - run: echo "::add-mask::${{ secrets.LICENSE_SERVER_URL }}" + + - name: Restore Unity Packages + uses: actions/cache@v3 + with: + path: | + samples/unity-of-bugs/Library/Packages + temp/unity-packages/Library/ScriptAssemblies/*.TestRunner.* + key: samples/unity-of-bugs|${{ steps.env.outputs.unityVersion }}-${{ hashFiles('samples/unity-of-bugs/Packages/packages-lock.json') }} + + - name: Docker Login + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # pinned v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Start the Unity docker container + run: ./scripts/ci-docker.sh '${{ inputs.unity-version }}' 'ios' '${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}' + shell: bash + + - name: Install .NET SDK + if: runner.os != 'Windows' + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 9.0.100 + + - name: Install Android dotnet workflow + run: dotnet workload install android --temp-dir "${{ runner.temp }}" + + - name: Download CLI + run: ./scripts/download-sentry-cli.ps1 + + - name: Download Android SDK + uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848 + with: + name: Android-sdk + path: package-dev/Plugins/Android + wait-timeout: 3600 + + - name: Download Android Libraries + uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848 + with: + name: Android-libraries + path: modules/sentry-java/sentry-android-ndk/build/intermediates/merged_native_libs/release/out/lib + wait-timeout: 3600 + + - name: Download Linux SDK + uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848 + with: + name: Linux-sdk + path: package-dev/Plugins/Linux + wait-timeout: 3600 + + - name: Download Windows SDK + uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848 + with: + name: Windows-sdk + path: package-dev/Plugins/Windows + wait-timeout: 3600 + + - name: Build Sentry.Unity Solution + run: docker exec unity dotnet build -c Release + + - name: Install assemblyalias + run: docker exec unity dotnet tool install --global Alias --version 0.4.3 + + - name: Alias editor assemblies + run: docker exec unity /home/gh/.dotnet/tools/assemblyalias --target-directory "package-dev/Editor" --internalize --prefix "Sentry." --assemblies-to-alias "Microsoft*;Mono.Cecil*" + + - name: Alias runtime assemblies + run: docker exec unity /home/gh/.dotnet/tools/assemblyalias --target-directory "package-dev/Runtime" --internalize --prefix "Sentry." --assemblies-to-alias "Microsoft*;System*" + + - name: Package for release + if: ${{ inputs.unity-version == env.LOWEST_SUPPORTED_UNITY_VERSION }} + run: | + docker exec unity dotnet msbuild /t:UnityConfigureSentryOptions /p:Configuration=Release /p:OutDir=other src/Sentry.Unity + ./scripts/pack.ps1 + + - name: Upload release artifacts + uses: actions/upload-artifact@v4 + if: ${{ inputs.unity-version == env.LOWEST_SUPPORTED_UNITY_VERSION }} + with: + name: ${{ github.sha }} + if-no-files-found: error + path: | + package-release.zip + modules/sentry-java/sentry-android-ndk/build/intermediates/merged_native_libs/release/out/lib/* + + - name: Run Unity tests (playmode) + run: | + docker exec unity dotnet msbuild /t:UnityConfigureSentryOptions /p:TestDsn= /p:Configuration=Release /p:OutDir=other src/Sentry.Unity + docker exec unity dotnet msbuild /t:UnityPlayModeTest /p:Configuration=Release /p:OutDir=other test/Sentry.Unity.Tests + + - name: Upload test artifacts (playmode) + uses: actions/upload-artifact@v4 + with: + name: Test results (playmode) - ${{inputs.unity-version}} + path: artifacts/test/playmode + + - name: Run Unity tests (editmode) + run: docker exec unity dotnet msbuild /t:UnityEditModeTest /p:Configuration=Release /p:OutDir=other test/Sentry.Unity.Editor.Tests + + - name: Upload test artifacts (editmode) + uses: actions/upload-artifact@v4 + with: + name: Test results (editmode) - ${{inputs.unity-version}} + path: artifacts/test/editmode diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8cc25ee14..78d3c8413 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,140 +43,14 @@ jobs: runsOn: ${{ matrix.host }} build: - name: Build - ${{ matrix.unity-version }} - # Pinning ubuntu version to resolve permission issues with setup-dotnet: https://github.com/actions/setup-dotnet/issues/565 - runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: # Building the SDK with Unity 2022 and newer requires ns2.1 - skipping for now unity-version: ["2019", "2020", "2021"] - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Checkout submodules - run: git submodule update --init --recursive src/sentry-dotnet - - - name: Load env - id: env - run: echo "unityVersion=$(./scripts/ci-env.ps1 "unity${{ matrix.unity-version }}")" >> $env:GITHUB_OUTPUT - - - run: echo "::add-mask::${{ secrets.LICENSE_SERVER_URL }}" - - - name: Restore Unity Packages - uses: actions/cache@v3 - with: - path: | - samples/unity-of-bugs/Library/Packages - temp/unity-packages/Library/ScriptAssemblies/*.TestRunner.* - key: samples/unity-of-bugs|${{ steps.env.outputs.unityVersion }}-${{ hashFiles('samples/unity-of-bugs/Packages/packages-lock.json') }} - - - name: Docker Login - uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # pinned v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Start the Unity docker container - # We must use the iOS version of the image instead of 'base' - Sentry.Unity.Editor.iOS.csproj requires some libraries. - # Maybe we could just cache the needed file instead of pulling the 1 GB larger image on every build... - run: ./scripts/ci-docker.sh '${{ matrix.unity-version }}' 'ios' '${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}' - shell: bash - - - name: Install .NET SDK - if: runner.os != 'Windows' - uses: actions/setup-dotnet@v4 - with: - dotnet-version: | - 9.0.100 - - # Required by sentry-dotnet since 3.19.0 - - name: Install Android dotnet workflow - run: dotnet workload install android --temp-dir "${{ runner.temp }}" - - - name: Download CLI - run: ./scripts/download-sentry-cli.ps1 - - - name: Download Android SDK - uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848 - with: - name: Android-sdk - path: package-dev/Plugins/Android - wait-timeout: 3600 - - - name: Download Android Libraries - uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848 - with: - name: Android-libraries - path: modules/sentry-java/sentry-android-ndk/build/intermediates/merged_native_libs/release/out/lib - wait-timeout: 3600 - - - name: Download Linux SDK - uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848 - with: - name: Linux-sdk - path: package-dev/Plugins/Linux - wait-timeout: 3600 - - - name: Download Windows SDK - uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848 - with: - name: Windows-sdk - path: package-dev/Plugins/Windows - wait-timeout: 3600 - - - name: Build Sentry.Unity Solution - run: docker exec unity dotnet build -c Release - - - name: Install assemblyalias - run: docker exec unity dotnet tool install --global Alias --version 0.4.3 - - - name: Alias editor assemblies - run: docker exec unity /home/gh/.dotnet/tools/assemblyalias --target-directory "package-dev/Editor" --internalize --prefix "Sentry." --assemblies-to-alias "Microsoft*;Mono.Cecil*" - - - name: Alias runtime assemblies - run: docker exec unity /home/gh/.dotnet/tools/assemblyalias --target-directory "package-dev/Runtime" --internalize --prefix "Sentry." --assemblies-to-alias "Microsoft*;System*" - - - name: Package for release - if: ${{ matrix.unity-version == env.LOWEST_SUPPORTED_UNITY_VERSION }} - run: | - # Before packaging, we need to open & close Unity on the sample project to update .meta files in package-dev. - # We could add a new custom target but reusing UnityConfigureSentryOptions is good enough. - docker exec unity dotnet msbuild /t:UnityConfigureSentryOptions /p:Configuration=Release /p:OutDir=other src/Sentry.Unity - ./scripts/pack.ps1 - - - name: Upload release artifacts - uses: actions/upload-artifact@v4 - if: ${{ matrix.unity-version == env.LOWEST_SUPPORTED_UNITY_VERSION }} - with: - name: ${{ github.sha }} - if-no-files-found: error - # Adding the native libraries so the symbol collector craft target can find/upload them - path: | - package-release.zip - modules/sentry-java/sentry-android-ndk/build/intermediates/merged_native_libs/release/out/lib/* - - - name: Run Unity tests (playmode) - run: | - docker exec unity dotnet msbuild /t:UnityConfigureSentryOptions /p:TestDsn= /p:Configuration=Release /p:OutDir=other src/Sentry.Unity - docker exec unity dotnet msbuild /t:UnityPlayModeTest /p:Configuration=Release /p:OutDir=other test/Sentry.Unity.Tests - - - name: Upload test artifacts (playmode) - uses: actions/upload-artifact@v4 - with: - name: Test results (playmode) - ${{matrix.unity-version}} - path: artifacts/test/playmode - - - name: Run Unity tests (editmode) - run: docker exec unity dotnet msbuild /t:UnityEditModeTest /p:Configuration=Release /p:OutDir=other test/Sentry.Unity.Editor.Tests - - - name: Upload test artifacts (editmode) - uses: actions/upload-artifact@v4 - with: - name: Test results (editmode) - ${{matrix.unity-version}} - path: artifacts/test/editmode + uses: ./.github/workflows/build.yml + with: + unity-version: ${{ matrix.unity-version }} package-validation: name: UPM Package validation From 18b762391ff45e0ce441ac47041b6dfb11096364 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 23 Jan 2025 12:45:27 +0100 Subject: [PATCH 02/29] pwsh as default --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d3b0036a6..ae4369f10 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,6 +12,10 @@ env: DOTNET_CLI_TELEMETRY_OPTOUT: 1 DOTNET_NOLOGO: 1 +defaults: + run: + shell: pwsh + jobs: build: name: Build - ${{ inputs.unity-version }} From 88835c8b43e5ff8b64176efb1fa85c61d44a136f Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 23 Jan 2025 13:04:57 +0100 Subject: [PATCH 03/29] secrets: inherit --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78d3c8413..c152efcb0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,6 +51,7 @@ jobs: uses: ./.github/workflows/build.yml with: unity-version: ${{ matrix.unity-version }} + secrets: inherit package-validation: name: UPM Package validation From b6d716506fb12a66bd69ca981f80626d67591555 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 23 Jan 2025 13:12:59 +0100 Subject: [PATCH 04/29] set name --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ae4369f10..c06c876df 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build +name: Build Unity SDK on: workflow_call: From d4fc1727eb38d621bbdd679196166c0e49a1a7ab Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 23 Jan 2025 14:24:57 +0100 Subject: [PATCH 05/29] extracted smoke test project creation --- .github/workflows/ci.yml | 48 +++++------------------- .github/workflows/smoke-test-create.yml | 50 +++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/smoke-test-create.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c152efcb0..254870509 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,7 @@ jobs: runsOn: ${{ matrix.host }} build: + secrets: inherit strategy: fail-fast: false matrix: @@ -51,7 +52,7 @@ jobs: uses: ./.github/workflows/build.yml with: unity-version: ${{ matrix.unity-version }} - secrets: inherit + package-validation: name: UPM Package validation @@ -75,49 +76,17 @@ jobs: # This produces the `samples/IntegrationTest` as `smoke-test-${{ matrix.unity-version }}`. smoke-test-create: + secrets: inherit if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} name: ${{ matrix.unity-version }} Prepare Smoke Test - runs-on: ubuntu-latest - needs: [package-validation] strategy: fail-fast: false matrix: unity-version: ["2019", "2022", "6000"] - env: - UNITY_PATH: docker exec unity unity-editor - steps: - - name: Checkout - uses: actions/checkout@v3 - - - run: echo "::add-mask::${{ secrets.LICENSE_SERVER_URL }}" - - - name: Docker Login - uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # pinned v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Start the Unity docker container - run: ./scripts/ci-docker.sh '${{ matrix.unity-version }}' 'base' '${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}' - shell: bash - - - name: Create new Project - run: ./test/Scripts.Integration.Test/create-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" - - # We create tar explicitly because upload-artifact is slow for many files. - - name: Create archive - run: tar -cvzf test-project.tar.gz samples/IntegrationTest - - - name: Upload project - uses: actions/upload-artifact@v4 - with: - name: smoke-test-${{ matrix.unity-version }} - if-no-files-found: error - path: test-project.tar.gz - # Lower retention period - we only need this to retry CI. - retention-days: 14 - + uses: ./.github/workflows/smoke-test-create.yml + with: + unity-version: ${{ matrix.unity-version }} + # A Linux, docker-based build to prepare a game ("player") for some platforms. The tests run in `smoke-test-run`. smoke-test-build: if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} @@ -192,9 +161,10 @@ jobs: run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform "${{ matrix.platform }}" - name: Download UPM package - uses: actions/download-artifact@v4 + uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848 with: name: ${{ github.sha }} + wait-timeout: 3600 - name: Extract UPM package run: ./test/Scripts.Integration.Test/extract-package.ps1 diff --git a/.github/workflows/smoke-test-create.yml b/.github/workflows/smoke-test-create.yml new file mode 100644 index 000000000..25ca08491 --- /dev/null +++ b/.github/workflows/smoke-test-create.yml @@ -0,0 +1,50 @@ +name: Create Smoke Test Project + +on: + workflow_call: + inputs: + unity-version: + required: true + type: string + +defaults: + run: + shell: pwsh + +jobs: + create: + name: Create Smoke Test - ${{ inputs.unity-version }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - run: echo "::add-mask::${{ secrets.LICENSE_SERVER_URL }}" + + - name: Docker Login + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # pinned v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Start the Unity docker container + run: ./scripts/ci-docker.sh '${{ inputs.unity-version }}' 'base' '${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}' + shell: bash + + - name: Create new Project + run: ./test/Scripts.Integration.Test/create-project.ps1 -UnityPath "docker exec unity unity-editor" + + # We create tar explicitly because upload-artifact is slow for many files. + - name: Create archive + run: tar -cvzf test-project.tar.gz samples/IntegrationTest + + - name: Upload project + uses: actions/upload-artifact@v4 + with: + name: smoke-test-${{ inputs.unity-version }} + if-no-files-found: error + path: test-project.tar.gz + # Lower retention period - we only need this to retry CI. + retention-days: 14 + \ No newline at end of file From 038bb0595cd064f9d51582c4e12249c045fa8b5c Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 23 Jan 2025 18:31:44 +0100 Subject: [PATCH 06/29] split out android --- .../workflows/android-smoke-test-build.yml | 144 +++++++++++++++ .../workflows/android-smoke-test-compile.yml | 103 +++++++++++ .github/workflows/ci.yml | 172 ++++++++++-------- 3 files changed, 346 insertions(+), 73 deletions(-) create mode 100644 .github/workflows/android-smoke-test-build.yml create mode 100644 .github/workflows/android-smoke-test-compile.yml diff --git a/.github/workflows/android-smoke-test-build.yml b/.github/workflows/android-smoke-test-build.yml new file mode 100644 index 000000000..41440b0f6 --- /dev/null +++ b/.github/workflows/android-smoke-test-build.yml @@ -0,0 +1,144 @@ +name: Android Create Smoke Test Project + +on: + workflow_call: + inputs: + unity-version: + required: true + type: string + +defaults: + run: + shell: pwsh + +jobs: + android-build-smoke-test: + if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} + name: ${{ inputs.unity-version }} Android Smoke Test Build + # needs: [smoke-test-create] + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - platform: Android + check_symbols: false + build_platform: Android-Export + env: + UNITY_PATH: docker exec unity unity-editor + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@f68fdb76e2ea636224182cfb7377ff9a1708f9b8 + with: + android: true + dotnet: false + haskell: true + large-packages: false + docker-images: false + swap-storage: true + + - run: echo "::add-mask::${{ secrets.LICENSE_SERVER_URL }}" + + - name: Docker Login + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # pinned v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Start the Unity docker container + run: ./scripts/ci-docker.sh '${{ inputs.unity-version }}' '${{ matrix.platform }}' '${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}' + shell: bash + + # Workaround for missing libMonoPosixHelper.so + # See https://github.com/getsentry/sentry-unity/pull/1295 + - name: Install mono-devel + if: ${{ inputs.unity-version == '2019' }} + run: | + docker exec --user root unity apt-get update + docker exec --user root unity apt-get -y -q install mono-devel + + - name: Download IntegrationTest project + uses: actions/download-artifact@v4 + with: + name: smoke-test-${{ inputs.unity-version }} + + - name: Extract project archive + run: tar -xvzf test-project.tar.gz + + # - name: Build without Sentry SDK + # run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform "${{ matrix.platform }}" + + - name: Download UPM package + uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848 + with: + name: ${{ github.sha }} + wait-timeout: 3600 + + - name: Extract UPM package + run: ./test/Scripts.Integration.Test/extract-package.ps1 + + - name: Add Sentry to the project + run: ./test/Scripts.Integration.Test/add-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" + + - name: Configure Sentry + run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols + + - name: Build Project + run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols:$false -UnityVersion "${{ inputs.unity-version }}" + + # We create tar explicitly because upload-artifact is slow for many files. + - name: Create archive + shell: bash + run: | + # Note: remove local.properties file that contains Android SDK & NDK paths in the Unity installation. + rm -rf samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame + tar -cvzf test-app-runtime.tar.gz samples/IntegrationTest/Build + + # Upload runtime initialization build + - name: Upload test app + uses: actions/upload-artifact@v4 + with: + name: testapp-${{ matrix.platform }}-${{ inputs.unity-version }}-runtime + if-no-files-found: error + path: test-app-runtime.tar.gz + retention-days: 14 + + - name: Configure Sentry for mobile platforms (build-time initialization) + run: | + $optionsPath = "samples/IntegrationTest/Assets/Scripts/OptionsConfiguration.cs" + $content = Get-Content $optionsPath -Raw + $content = $content -replace 'AndroidNativeInitializationType = NativeInitializationType.Runtime', 'AndroidNativeInitializationType = NativeInitializationType.BuildTime' + Set-Content $optionsPath $content + + - name: Build Project for mobile platforms (build-time initialization) + run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols:$false -UnityVersion "${{ inputs.unity-version }}" + + - name: Create archive (build-time initialization) + shell: bash + run: | + rm -rf samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame + tar -cvzf test-app-buildtime.tar.gz samples/IntegrationTest/Build + + # Upload build-time initialization build + - name: Upload test app (build-time initialization) + uses: actions/upload-artifact@v4 + with: + name: testapp-${{ matrix.platform }}-${{ inputs.unity-version }}-buildtime + if-no-files-found: error + path: test-app-buildtime.tar.gz + retention-days: 14 + + - name: Upload IntegrationTest project on failure + if: ${{ failure() }} + uses: actions/upload-artifact@v4 + with: + name: failed-project-${{ matrix.platform }}-${{ inputs.unity-version }} + path: | + samples/IntegrationTest + !samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame + # Lower retention period - we only need this to retry CI. + retention-days: 14 \ No newline at end of file diff --git a/.github/workflows/android-smoke-test-compile.yml b/.github/workflows/android-smoke-test-compile.yml new file mode 100644 index 000000000..f3be6dbc0 --- /dev/null +++ b/.github/workflows/android-smoke-test-compile.yml @@ -0,0 +1,103 @@ +name: Android Compile Smoke Test Project + +on: + workflow_call: + inputs: + unity-version: + required: true + type: string + init-type: + required: true + type: string + +defaults: + run: + shell: pwsh + +jobs: + android-compile-smoke-test: + if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} + name: ${{ inputs.unity-version }} ${{ inputs.init-type }} Compile Smoke Test + runs-on: 'ubuntu-latest-4-cores' + strategy: + fail-fast: false + matrix: + include: + # See supported version in https://docs.unity3d.com/6000.0/Documentation/Manual/android-sdksetup.html + - unity-version: "2019" + ndk: "r19" + - unity-version: "2022" + ndk: "r23b" + - unity-version: "6000" + ndk: "r23b" + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Download app project + uses: actions/download-artifact@v4 + with: + name: testapp-android-${{ inputs.unity-version }}-${{ inputs.init-type }} + + - name: Extract app project + run: tar -xvzf test-app-${{ inputs.init-type }}.tar.gz + + - name: Setup Android + uses: android-actions/setup-android@7c5672355aaa8fde5f97a91aa9a99616d1ace6bc # pin@v2 + + - name: Setup NDK + uses: nttld/setup-ndk@8c3b609ff4d54576ea420551943fd34b4d03b0dc # pin@v1 + id: setup-ndk + with: + ndk-version: ${{ matrix.ndk }} + add-to-path: false + + - name: Setup Java for Unity + run: ./scripts/ci-setup-java.ps1 -UnityVersion "${{ inputs.unity-version }}" + + # We modify the exported gradle project to deal with the different build-environment + # I.e. we're fixing the paths for SDK & NDK that have been hardcoded to point at the Unity installation + - name: Modify gradle project + run: | + ./test/Scripts.Integration.Test/modify-gradle-project.ps1 ` + -AndroidSdkRoot $env:ANDROID_SDK_ROOT ` + -NdkPath ${{ steps.setup-ndk.outputs.ndk-path }} ` + -UnityVersion ${{ inputs.unity-version }} + + - name: Android smoke test + # Skipping Android on Unity 2022 for now + run: | + if ("${{ inputs.unity-version }}" -ne "2022") + { + ./scripts/smoke-test-android.ps1 Build -IsIntegrationTest -UnityVersion "${{ inputs.unity-version }}" + } + timeout-minutes: 10 + env: + JAVA_HOME: ${{ env.JAVA_HOME }} + + - name: Upload integration-test project on failure + if: ${{ failure() }} + uses: actions/upload-artifact@v4 + with: + name: failed-project-android-${{ inputs.unity-version }}-${{ inputs.init-type }}-but-compiled + path: | + samples/IntegrationTest + !samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame + # Lower retention period - we only need this to retry CI. + retention-days: 14 + + - name: Upload app + uses: actions/upload-artifact@v4 + # Skipping Android on Unity 2022 for now + if: ${{ inputs.unity-version != '2022' }} + with: + name: testapp-android-compiled-${{ inputs.unity-version }}-${{ inputs.init-type }} + # Collect app but ignore the files that are not required for the test. + path: | + samples/IntegrationTest/Build/*.apk + samples/IntegrationTest/Build/archive/Unity-iPhone/Build/Products/Release-iphonesimulator/ + !**/Release-iphonesimulator/*.dSYM + !**/Release-iphonesimulator/UnityFramework.framework/* + # Lower retention period - we only need this to retry CI. + retention-days: 14 \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f50fbf0a..13f44e151 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: target: ${{ matrix.target }} runsOn: ${{ matrix.host }} - build: + build-unity-sdk: secrets: inherit strategy: fail-fast: false @@ -97,14 +97,11 @@ jobs: fail-fast: false matrix: unity-version: ["2019", "2022", "6000"] - platform: ["Android", "WebGL", "Linux", "iOS"] + platform: ["WebGL", "Linux", "iOS"] include: - platform: iOS check_symbols: false build_platform: iOS - - platform: Android - check_symbols: false - build_platform: Android-Export - platform: WebGL check_symbols: true build_platform: WebGL @@ -234,82 +231,38 @@ jobs: # Lower retention period - we only need this to retry CI. retention-days: 14 - desktop-smoke-test: - if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} - name: ${{ matrix.unity-version }} ${{ matrix.os }} Run Smoke Test + android-smoke-test-build: needs: [smoke-test-create] - runs-on: ${{ matrix.os }}-latest + secrets: inherit + if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} + name: ${{ matrix.unity-version }} Build Android Smoke Test strategy: fail-fast: false matrix: unity-version: ["2019", "2022", "6000"] - # os: ["windows", "macos"] - os: ["windows"] - include: - - os: windows - unity-modules: windows-il2cpp - unity-config-path: C:/ProgramData/Unity/config/ - # - os: macos - # unity-modules: mac-il2cpp - # unity-config-path: /Library/Application Support/Unity/config/ - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Load env - id: env - run: echo "unityVersion=$(./scripts/ci-env.ps1 "unity${{ matrix.unity-version }}")" >> $env:GITHUB_OUTPUT - - - name: Setup Unity - uses: getsentry/setup-unity@d84ad1d1fb3020e48883c3ac8e87d64baf1135c7 - with: - unity-version: ${{ steps.env.outputs.unityVersion }} - unity-modules: ${{ matrix.unity-modules }} - - - run: echo "::add-mask::${{ secrets.LICENSE_SERVER_URL }}" - - - name: Create Unity license config - run: | - New-Item -Path '${{ matrix.unity-config-path }}' -ItemType Directory - Set-Content -Path '${{ matrix.unity-config-path }}services-config.json' -Value '${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}' - - - name: Download IntegrationTest project - uses: actions/download-artifact@v4 - with: - name: smoke-test-${{ matrix.unity-version }} - - - name: Extract project archive - run: tar -xvzf test-project.tar.gz - - - name: Build without Sentry SDK - run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" - - - name: Download UPM package - uses: actions/download-artifact@v4 - with: - name: ${{ github.sha }} - - - name: Extract UPM package - run: ./test/Scripts.Integration.Test/extract-package.ps1 - - - name: Add Sentry to the project - run: ./test/Scripts.Integration.Test/add-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" - - - name: Configure Sentry - run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" -CheckSymbols - - - name: Build with Sentry SDK - run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -CheckSymbols -UnityVersion "${{ matrix.unity-version }}" - - - name: Run Smoke Test - run: ./test/Scripts.Integration.Test/run-smoke-test.ps1 -Smoke + uses: ./.github/workflows/android-smoke-test-build.yml + with: + unity-version: ${{ matrix.unity-version }} - - name: Run Crash Test - run: ./test/Scripts.Integration.Test/run-smoke-test.ps1 -Crash + android-smoke-test-compile: + needs: [android-smoke-test-build] + secrets: inherit + if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} + name: ${{ matrix.unity-version }} ${{ matrix.init-type }} Compile Android Smoke Test + strategy: + fail-fast: false + matrix: + # unity-version: ["2019", "2022", "6000"] + unity-version: ["2019", "6000"] + init-type: ["runtime", "buildtime"] + uses: ./.github/workflows/android-smoke-test-compile.yml + with: + unity-version: ${{ matrix.unity-version }} + init-type: ${{ matrix.init-type }} android-smoke-test-run: if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} - needs: [mobile-smoke-test-compile] + needs: [android-smoke-test-build] name: ${{ matrix.unity-version }} Android ${{ matrix.api-level }} ${{ matrix.init-type }} Run Smoke Test uses: ./.github/workflows/android-smoke-test.yml with: @@ -332,7 +285,7 @@ jobs: fail-fast: false matrix: unity-version: ["2019", "2022", "6000"] - platform: ["Android", "iOS"] + platform: ["iOS"] init-type: ["runtime", "buildtime"] include: # See supported version in https://docs.unity3d.com/6000.0/Documentation/Manual/android-sdksetup.html @@ -510,3 +463,76 @@ jobs: - name: Run Crash Test (Linux) if: ${{ matrix.platform == 'Linux' }} run: ./test/Scripts.Integration.Test/run-smoke-test.ps1 -Crash + + desktop-smoke-test: + if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} + name: ${{ matrix.unity-version }} ${{ matrix.os }} Run Smoke Test + needs: [smoke-test-create] + runs-on: ${{ matrix.os }}-latest + strategy: + fail-fast: false + matrix: + unity-version: ["2019", "2022", "6000"] + # os: ["windows", "macos"] + os: ["windows"] + include: + - os: windows + unity-modules: windows-il2cpp + unity-config-path: C:/ProgramData/Unity/config/ + # - os: macos + # unity-modules: mac-il2cpp + # unity-config-path: /Library/Application Support/Unity/config/ + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Load env + id: env + run: echo "unityVersion=$(./scripts/ci-env.ps1 "unity${{ matrix.unity-version }}")" >> $env:GITHUB_OUTPUT + + - name: Setup Unity + uses: getsentry/setup-unity@d84ad1d1fb3020e48883c3ac8e87d64baf1135c7 + with: + unity-version: ${{ steps.env.outputs.unityVersion }} + unity-modules: ${{ matrix.unity-modules }} + + - run: echo "::add-mask::${{ secrets.LICENSE_SERVER_URL }}" + + - name: Create Unity license config + run: | + New-Item -Path '${{ matrix.unity-config-path }}' -ItemType Directory + Set-Content -Path '${{ matrix.unity-config-path }}services-config.json' -Value '${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}' + + - name: Download IntegrationTest project + uses: actions/download-artifact@v4 + with: + name: smoke-test-${{ matrix.unity-version }} + + - name: Extract project archive + run: tar -xvzf test-project.tar.gz + + - name: Build without Sentry SDK + run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" + + - name: Download UPM package + uses: actions/download-artifact@v4 + with: + name: ${{ github.sha }} + + - name: Extract UPM package + run: ./test/Scripts.Integration.Test/extract-package.ps1 + + - name: Add Sentry to the project + run: ./test/Scripts.Integration.Test/add-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" + + - name: Configure Sentry + run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" -CheckSymbols + + - name: Build with Sentry SDK + run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -CheckSymbols -UnityVersion "${{ matrix.unity-version }}" + + - name: Run Smoke Test + run: ./test/Scripts.Integration.Test/run-smoke-test.ps1 -Smoke + + - name: Run Crash Test + run: ./test/Scripts.Integration.Test/run-smoke-test.ps1 -Crash \ No newline at end of file From 3e50a423d9e5fa4742c3feb0324765c6196cacce Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 23 Jan 2025 18:50:18 +0100 Subject: [PATCH 07/29] ordering or steps --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 13f44e151..6702bb342 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -262,7 +262,7 @@ jobs: android-smoke-test-run: if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} - needs: [android-smoke-test-build] + needs: [android-smoke-test-compile] name: ${{ matrix.unity-version }} Android ${{ matrix.api-level }} ${{ matrix.init-type }} Run Smoke Test uses: ./.github/workflows/android-smoke-test.yml with: From e25aaff0d09cbfc62063ac5d91476c82287c0a85 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 23 Jan 2025 18:53:50 +0100 Subject: [PATCH 08/29] fixed artifact name --- .github/workflows/android-smoke-test-build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/android-smoke-test-build.yml b/.github/workflows/android-smoke-test-build.yml index 41440b0f6..89349bfac 100644 --- a/.github/workflows/android-smoke-test-build.yml +++ b/.github/workflows/android-smoke-test-build.yml @@ -102,7 +102,7 @@ jobs: - name: Upload test app uses: actions/upload-artifact@v4 with: - name: testapp-${{ matrix.platform }}-${{ inputs.unity-version }}-runtime + name: testapp-android-${{ inputs.unity-version }}-runtime if-no-files-found: error path: test-app-runtime.tar.gz retention-days: 14 @@ -127,7 +127,7 @@ jobs: - name: Upload test app (build-time initialization) uses: actions/upload-artifact@v4 with: - name: testapp-${{ matrix.platform }}-${{ inputs.unity-version }}-buildtime + name: testapp-android-${{ inputs.unity-version }}-buildtime if-no-files-found: error path: test-app-buildtime.tar.gz retention-days: 14 @@ -136,7 +136,7 @@ jobs: if: ${{ failure() }} uses: actions/upload-artifact@v4 with: - name: failed-project-${{ matrix.platform }}-${{ inputs.unity-version }} + name: failed-project-android-${{ inputs.unity-version }} path: | samples/IntegrationTest !samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame From c07b92a3b1f3b6da2c8b42689771726aff7b03eb Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Fri, 24 Jan 2025 11:54:12 +0100 Subject: [PATCH 09/29] fixed naming and matrix --- .../workflows/android-smoke-test-build.yml | 6 ++--- .../workflows/android-smoke-test-compile.yml | 22 +++++-------------- ...ke-test.yml => android-smoke-test-run.yml} | 9 ++++---- .github/workflows/ci.yml | 5 +---- 4 files changed, 14 insertions(+), 28 deletions(-) rename .github/workflows/{android-smoke-test.yml => android-smoke-test-run.yml} (96%) diff --git a/.github/workflows/android-smoke-test-build.yml b/.github/workflows/android-smoke-test-build.yml index 89349bfac..d71b366c9 100644 --- a/.github/workflows/android-smoke-test-build.yml +++ b/.github/workflows/android-smoke-test-build.yml @@ -1,5 +1,3 @@ -name: Android Create Smoke Test Project - on: workflow_call: inputs: @@ -12,9 +10,9 @@ defaults: shell: pwsh jobs: - android-build-smoke-test: + build: if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} - name: ${{ inputs.unity-version }} Android Smoke Test Build + name: ${{ inputs.unity-version }} # needs: [smoke-test-create] runs-on: ubuntu-latest strategy: diff --git a/.github/workflows/android-smoke-test-compile.yml b/.github/workflows/android-smoke-test-compile.yml index f3be6dbc0..edcdf7a48 100644 --- a/.github/workflows/android-smoke-test-compile.yml +++ b/.github/workflows/android-smoke-test-compile.yml @@ -1,5 +1,3 @@ -name: Android Compile Smoke Test Project - on: workflow_call: inputs: @@ -7,29 +5,20 @@ on: required: true type: string init-type: - required: true - type: string + required: true + type: string defaults: run: shell: pwsh jobs: - android-compile-smoke-test: + compile: if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} - name: ${{ inputs.unity-version }} ${{ inputs.init-type }} Compile Smoke Test + name: ${{ inputs.unity-version }} ${{ inputs.init-type }} runs-on: 'ubuntu-latest-4-cores' strategy: fail-fast: false - matrix: - include: - # See supported version in https://docs.unity3d.com/6000.0/Documentation/Manual/android-sdksetup.html - - unity-version: "2019" - ndk: "r19" - - unity-version: "2022" - ndk: "r23b" - - unity-version: "6000" - ndk: "r23b" steps: - name: Checkout @@ -50,7 +39,8 @@ jobs: uses: nttld/setup-ndk@8c3b609ff4d54576ea420551943fd34b4d03b0dc # pin@v1 id: setup-ndk with: - ndk-version: ${{ matrix.ndk }} + # See supported version in https://docs.unity3d.com/6000.0/Documentation/Manual/android-sdksetup.html + ndk-version: ${{ inputs.unity-version == '2019' && 'r19' || 'r23b' }} add-to-path: false - name: Setup Java for Unity diff --git a/.github/workflows/android-smoke-test.yml b/.github/workflows/android-smoke-test-run.yml similarity index 96% rename from .github/workflows/android-smoke-test.yml rename to .github/workflows/android-smoke-test-run.yml index 013f16856..52d8ea278 100644 --- a/.github/workflows/android-smoke-test.yml +++ b/.github/workflows/android-smoke-test-run.yml @@ -16,16 +16,17 @@ on: description: "Smoke test status" value: ${{ jobs.run.outputs.status }} +defaults: + run: + shell: pwsh + jobs: run: - name: Android Smoke Test + name: ${{ inputs.unity-version }} ${{ inputs.init-type }} runs-on: ubuntu-latest env: ARTIFACTS_PATH: samples/IntegrationTest/test-artifacts/ HOMEBREW_NO_INSTALL_CLEANUP: 1 - defaults: - run: - shell: pwsh # Map the job outputs to step outputs outputs: status: ${{ steps.smoke-test.outputs.status }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6702bb342..11f30ddd5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -235,7 +235,6 @@ jobs: needs: [smoke-test-create] secrets: inherit if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} - name: ${{ matrix.unity-version }} Build Android Smoke Test strategy: fail-fast: false matrix: @@ -248,7 +247,6 @@ jobs: needs: [android-smoke-test-build] secrets: inherit if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} - name: ${{ matrix.unity-version }} ${{ matrix.init-type }} Compile Android Smoke Test strategy: fail-fast: false matrix: @@ -263,8 +261,7 @@ jobs: android-smoke-test-run: if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} needs: [android-smoke-test-compile] - name: ${{ matrix.unity-version }} Android ${{ matrix.api-level }} ${{ matrix.init-type }} Run Smoke Test - uses: ./.github/workflows/android-smoke-test.yml + uses: ./.github/workflows/android-smoke-test-run.yml with: unity-version: ${{ matrix.unity-version }} api-level: ${{ matrix.api-level }} From 677b630427973a4e976f9ecf6061e4f7feb0e194 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Fri, 24 Jan 2025 12:56:07 +0100 Subject: [PATCH 10/29] fixed artifact name in android run --- .github/workflows/android-smoke-test-run.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/android-smoke-test-run.yml b/.github/workflows/android-smoke-test-run.yml index 52d8ea278..42d8d1a34 100644 --- a/.github/workflows/android-smoke-test-run.yml +++ b/.github/workflows/android-smoke-test-run.yml @@ -37,7 +37,7 @@ jobs: - name: Download test app artifact uses: actions/download-artifact@v4 with: - name: testapp-Android-compiled-${{ inputs.unity-version }}-${{ inputs.init-type }} + name: testapp-android-compiled-${{ inputs.unity-version }}-${{ inputs.init-type }} path: samples/IntegrationTest/Build # See https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/ From e3d21e66fe2342e1ab1cd5e214793387c67fdc0b Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Fri, 24 Jan 2025 13:36:47 +0100 Subject: [PATCH 11/29] separated ios --- .../workflows/android-smoke-test-build.yml | 6 +- .../workflows/android-smoke-test-compile.yml | 8 +- .github/workflows/android-smoke-test-run.yml | 1 + .github/workflows/ci.yml | 177 +++--------------- .github/workflows/ios-smoke-test-build.yml | 130 +++++++++++++ .github/workflows/ios-smoke-test-compile.yml | 57 ++++++ .github/workflows/ios-smoke-test-run.yml | 56 ++++++ 7 files changed, 274 insertions(+), 161 deletions(-) create mode 100644 .github/workflows/ios-smoke-test-build.yml create mode 100644 .github/workflows/ios-smoke-test-compile.yml create mode 100644 .github/workflows/ios-smoke-test-run.yml diff --git a/.github/workflows/android-smoke-test-build.yml b/.github/workflows/android-smoke-test-build.yml index d71b366c9..8485794c0 100644 --- a/.github/workflows/android-smoke-test-build.yml +++ b/.github/workflows/android-smoke-test-build.yml @@ -11,12 +11,9 @@ defaults: jobs: build: - if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} name: ${{ inputs.unity-version }} - # needs: [smoke-test-create] runs-on: ubuntu-latest strategy: - fail-fast: false matrix: include: - platform: Android @@ -24,6 +21,7 @@ jobs: build_platform: Android-Export env: UNITY_PATH: docker exec unity unity-editor + steps: - name: Checkout uses: actions/checkout@v3 @@ -48,7 +46,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Start the Unity docker container - run: ./scripts/ci-docker.sh '${{ inputs.unity-version }}' '${{ matrix.platform }}' '${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}' + run: ./scripts/ci-docker.sh '${{ inputs.unity-version }}' 'android' '${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}' shell: bash # Workaround for missing libMonoPosixHelper.so diff --git a/.github/workflows/android-smoke-test-compile.yml b/.github/workflows/android-smoke-test-compile.yml index edcdf7a48..cbd823928 100644 --- a/.github/workflows/android-smoke-test-compile.yml +++ b/.github/workflows/android-smoke-test-compile.yml @@ -14,11 +14,8 @@ defaults: jobs: compile: - if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} name: ${{ inputs.unity-version }} ${{ inputs.init-type }} runs-on: 'ubuntu-latest-4-cores' - strategy: - fail-fast: false steps: - name: Checkout @@ -70,7 +67,7 @@ jobs: if: ${{ failure() }} uses: actions/upload-artifact@v4 with: - name: failed-project-android-${{ inputs.unity-version }}-${{ inputs.init-type }}-but-compiled + name: failed-project-android-${{ inputs.unity-version }}-${{ inputs.init-type }}-compiled path: | samples/IntegrationTest !samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame @@ -86,8 +83,5 @@ jobs: # Collect app but ignore the files that are not required for the test. path: | samples/IntegrationTest/Build/*.apk - samples/IntegrationTest/Build/archive/Unity-iPhone/Build/Products/Release-iphonesimulator/ - !**/Release-iphonesimulator/*.dSYM - !**/Release-iphonesimulator/UnityFramework.framework/* # Lower retention period - we only need this to retry CI. retention-days: 14 \ No newline at end of file diff --git a/.github/workflows/android-smoke-test-run.yml b/.github/workflows/android-smoke-test-run.yml index 42d8d1a34..e90b03dcd 100644 --- a/.github/workflows/android-smoke-test-run.yml +++ b/.github/workflows/android-smoke-test-run.yml @@ -30,6 +30,7 @@ jobs: # Map the job outputs to step outputs outputs: status: ${{ steps.smoke-test.outputs.status }} + steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11f30ddd5..66adc6c7d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,11 +97,8 @@ jobs: fail-fast: false matrix: unity-version: ["2019", "2022", "6000"] - platform: ["WebGL", "Linux", "iOS"] + platform: ["WebGL", "Linux"] include: - - platform: iOS - check_symbols: false - build_platform: iOS - platform: WebGL check_symbols: true build_platform: WebGL @@ -192,25 +189,6 @@ jobs: path: test-app-runtime.tar.gz retention-days: 14 - - name: Configure Sentry for mobile platforms (build-time initialization) - if: ${{ matrix.platform == 'iOS' || matrix.platform == 'Android' }} - run: | - $optionsPath = "samples/IntegrationTest/Assets/Scripts/OptionsConfiguration.cs" - $content = Get-Content $optionsPath -Raw - $content = $content -replace 'AndroidNativeInitializationType = NativeInitializationType.Runtime', 'AndroidNativeInitializationType = NativeInitializationType.BuildTime' - $content = $content -replace 'IosNativeInitializationType = NativeInitializationType.Runtime', 'IosNativeInitializationType = NativeInitializationType.BuildTime' - Set-Content $optionsPath $content - - - name: Build Project for mobile platforms (build-time initialization) - if: ${{ matrix.platform == 'iOS' || matrix.platform == 'Android' }} - run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols:$${{ matrix.check_symbols }} -UnityVersion "${{ matrix.unity-version }}" - - - name: Create archive (build-time initialization) - shell: bash - run: | - rm -rf samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame - tar -cvzf test-app-buildtime.tar.gz samples/IntegrationTest/Build - # Upload build-time initialization build - name: Upload test app (build-time initialization) uses: actions/upload-artifact@v4 @@ -250,7 +228,6 @@ jobs: strategy: fail-fast: false matrix: - # unity-version: ["2019", "2022", "6000"] unity-version: ["2019", "6000"] init-type: ["runtime", "buildtime"] uses: ./.github/workflows/android-smoke-test-compile.yml @@ -273,113 +250,40 @@ jobs: init-type: ["runtime", "buildtime"] unity-version: ["2019", "6000"] - mobile-smoke-test-compile: + ios-smoke-test-build: + needs: [smoke-test-create] + secrets: inherit if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} - needs: [smoke-test-build] - name: ${{ matrix.unity-version }} ${{ matrix.platform }} ${{ matrix.init-type }} Compile Smoke Test - runs-on: ${{ matrix.platform == 'iOS' && 'macos-latest' || 'ubuntu-latest-4-cores' }} strategy: fail-fast: false matrix: unity-version: ["2019", "2022", "6000"] - platform: ["iOS"] - init-type: ["runtime", "buildtime"] - include: - # See supported version in https://docs.unity3d.com/6000.0/Documentation/Manual/android-sdksetup.html - - unity-version: "2019" - ndk: "r19" - - unity-version: "2022" - ndk: "r23b" - - unity-version: "6000" - ndk: "r23b" - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Download app project - uses: actions/download-artifact@v4 - with: - name: testapp-${{ matrix.platform }}-${{ matrix.unity-version }}-${{ matrix.init-type }} - - - name: Extract app project - run: tar -xvzf test-app-${{ matrix.init-type }}.tar.gz - - - name: Setup Android - uses: android-actions/setup-android@7c5672355aaa8fde5f97a91aa9a99616d1ace6bc # pin@v2 - if: ${{ matrix.platform == 'Android' }} - - - name: Setup NDK - uses: nttld/setup-ndk@8c3b609ff4d54576ea420551943fd34b4d03b0dc # pin@v1 - if: ${{ matrix.platform == 'Android' }} - id: setup-ndk - with: - ndk-version: ${{ matrix.ndk }} - add-to-path: false - - - name: Setup Java for Unity - if: ${{ matrix.platform == 'Android' }} - run: ./scripts/ci-setup-java.ps1 -UnityVersion "${{ matrix.unity-version }}" - - # We modify the exported gradle project to deal with the different build-environment - # I.e. we're fixing the paths for SDK & NDK that have been hardcoded to point at the Unity installation - - name: Modify gradle project - if: ${{ matrix.platform == 'Android' }} - run: | - ./test/Scripts.Integration.Test/modify-gradle-project.ps1 ` - -AndroidSdkRoot $env:ANDROID_SDK_ROOT ` - -NdkPath ${{ steps.setup-ndk.outputs.ndk-path }} ` - -UnityVersion ${{ matrix.unity-version }} - - - name: Android smoke test - if: ${{ matrix.platform == 'Android' }} - # Skipping Android on Unity 2022 for now - run: | - if ("${{ matrix.unity-version }}" -ne "2022") - { - ./scripts/smoke-test-android.ps1 Build -IsIntegrationTest -UnityVersion "${{ matrix.unity-version }}" - } - timeout-minutes: 10 - env: - JAVA_HOME: ${{ env.JAVA_HOME }} - - - name: iOS smoke test - if: ${{ matrix.platform == 'iOS' }} - run: ./scripts/smoke-test-ios.ps1 Build -IsIntegrationTest -UnityVersion "${{ matrix.unity-version }}" -iOSMinVersion "16.1" - timeout-minutes: 10 - - - name: Upload integration-test project on failure - if: ${{ failure() }} - uses: actions/upload-artifact@v4 - with: - name: failed-project-${{ matrix.platform }}-${{ matrix.unity-version }}-${{ matrix.init-type }}-but-compiled - path: | - samples/IntegrationTest - !samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame - # Lower retention period - we only need this to retry CI. - retention-days: 14 + uses: ./.github/workflows/ios-smoke-test-build.yml + with: + unity-version: ${{ matrix.unity-version }} - - name: Upload app - uses: actions/upload-artifact@v4 - # Skipping Android on Unity 2022 for now - if: | - !(matrix.platform == 'Android' && matrix.unity-version == '2022') || matrix.platform == 'iOS' - with: - name: testapp-${{ matrix.platform }}-compiled-${{ matrix.unity-version }}-${{ matrix.init-type }} - # Collect app but ignore the files that are not required for the test. - path: | - samples/IntegrationTest/Build/*.apk - samples/IntegrationTest/Build/archive/Unity-iPhone/Build/Products/Release-iphonesimulator/ - !**/Release-iphonesimulator/*.dSYM - !**/Release-iphonesimulator/UnityFramework.framework/* - # Lower retention period - we only need this to retry CI. - retention-days: 14 + ios-smoke-test-compile: + needs: [ios-smoke-test-build] + secrets: inherit + if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} + strategy: + fail-fast: false + matrix: + unity-version: ["2019", "2022", "6000"] + init-type: ["runtime", "buildtime"] + uses: ./.github/workflows/ios-smoke-test-compile.yml + with: + unity-version: ${{ matrix.unity-version }} + init-type: ${{ matrix.init-type }} ios-smoke-test-run: if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} - needs: [mobile-smoke-test-compile] - name: ${{ matrix.unity-version }} iOS ${{ matrix.ios }} ${{ matrix.init-type }} Run Smoke Test - runs-on: macos-13 # Pinning to get the oldest, supported version of iOS simulator + needs: [ios-smoke-test-compile] + uses: ./.github/workflows/ios-smoke-test-run.yml + with: + unity-version: ${{ matrix.unity-version }} + ios-version: ${{ matrix.ios-version }} + init-type: ${{ matrix.init-type }} strategy: fail-fast: false matrix: @@ -393,36 +297,9 @@ jobs: # Numbers as string otherwise GH will reformat the runtime numbers removing the fractions. # Also make sure to match the versions available here: # - https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md - ios: ["16.1", latest] # last updated October 2024 + ios-version: ["16.1", latest] # last updated October 2024 init-type: ["runtime", "buildtime"] - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Download app artifact - uses: actions/download-artifact@v4 - with: - name: testapp-iOS-compiled-${{ matrix.unity-version }}-${{ matrix.init-type }} - path: samples/IntegrationTest/Build - - - name: Set Xcode for iOS version ${{matrix.ios}} - if: ${{ matrix.ios != 'latest'}} - uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # pin@v1.6 - with: - xcode-version: '14.1' # to run iOS 16.1 we need Xcode 14.1 - - - name: Smoke test - id: smoke-test-ios - timeout-minutes: 20 - run: | - $runtime = "${{ matrix.ios }}" - If ($runtime -ne "latest") - { - $runtime = "iOS " + $runtime - } - ./Scripts/smoke-test-ios.ps1 Test "$runtime" -IsIntegrationTest - smoke-test-run: if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} needs: [smoke-test-build] diff --git a/.github/workflows/ios-smoke-test-build.yml b/.github/workflows/ios-smoke-test-build.yml new file mode 100644 index 000000000..b8bfee0ac --- /dev/null +++ b/.github/workflows/ios-smoke-test-build.yml @@ -0,0 +1,130 @@ +on: + workflow_call: + inputs: + unity-version: + required: true + type: string + +defaults: + run: + shell: pwsh + +jobs: + build: + name: ${{ inputs.unity-version }} + runs-on: ubuntu-latest + strategy: + matrix: + include: + - platform: iOS + check_symbols: false + build_platform: iOS + env: + UNITY_PATH: docker exec unity unity-editor + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - run: echo "::add-mask::${{ secrets.LICENSE_SERVER_URL }}" + + - name: Docker Login + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # pinned v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Start the Unity docker container + run: ./scripts/ci-docker.sh '${{ inputs.unity-version }}' 'iOS' '${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}' + shell: bash + + # Workaround for missing libMonoPosixHelper.so + # See https://github.com/getsentry/sentry-unity/pull/1295 + - name: Install mono-devel + if: ${{ inputs.unity-version == '2019' }} + run: | + docker exec --user root unity apt-get update + docker exec --user root unity apt-get -y -q install mono-devel + + - name: Download IntegrationTest project + uses: actions/download-artifact@v4 + with: + name: smoke-test-${{ inputs.unity-version }} + + - name: Extract project archive + run: tar -xvzf test-project.tar.gz + + # - name: Build without Sentry SDK + # run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform "${{ matrix.platform }}" + + - name: Download UPM package + uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848 + with: + name: ${{ github.sha }} + wait-timeout: 3600 + + - name: Extract UPM package + run: ./test/Scripts.Integration.Test/extract-package.ps1 + + - name: Add Sentry to the project + run: ./test/Scripts.Integration.Test/add-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" + + - name: Configure Sentry + run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols + + - name: Build Project + run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols:$false -UnityVersion "${{ inputs.unity-version }}" + + # We create tar explicitly because upload-artifact is slow for many files. + - name: Create archive + shell: bash + run: | + # Note: remove local.properties file that contains Android SDK & NDK paths in the Unity installation. + rm -rf samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame + tar -cvzf test-app-runtime.tar.gz samples/IntegrationTest/Build + + # Upload runtime initialization build + - name: Upload test app + uses: actions/upload-artifact@v4 + with: + name: testapp-ios-${{ inputs.unity-version }}-runtime + if-no-files-found: error + path: test-app-runtime.tar.gz + retention-days: 14 + + - name: Configure Sentry for mobile platforms (build-time initialization) + run: | + $optionsPath = "samples/IntegrationTest/Assets/Scripts/OptionsConfiguration.cs" + $content = Get-Content $optionsPath -Raw + $content = $content -replace 'IosNativeInitializationType = NativeInitializationType.Runtime', 'IosNativeInitializationType = NativeInitializationType.BuildTime' + Set-Content $optionsPath $content + + - name: Build Project for mobile platforms (build-time initialization) + run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols:$false -UnityVersion "${{ inputs.unity-version }}" + + - name: Create archive (build-time initialization) + shell: bash + run: | + rm -rf samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame + tar -cvzf test-app-buildtime.tar.gz samples/IntegrationTest/Build + + # Upload build-time initialization build + - name: Upload test app (build-time initialization) + uses: actions/upload-artifact@v4 + with: + name: testapp-ios-${{ inputs.unity-version }}-buildtime + if-no-files-found: error + path: test-app-buildtime.tar.gz + retention-days: 14 + + - name: Upload IntegrationTest project on failure + if: ${{ failure() }} + uses: actions/upload-artifact@v4 + with: + name: failed-project-ios-${{ inputs.unity-version }} + path: | + samples/IntegrationTest + !samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame + # Lower retention period - we only need this to retry CI. + retention-days: 14 \ No newline at end of file diff --git a/.github/workflows/ios-smoke-test-compile.yml b/.github/workflows/ios-smoke-test-compile.yml new file mode 100644 index 000000000..145c8286d --- /dev/null +++ b/.github/workflows/ios-smoke-test-compile.yml @@ -0,0 +1,57 @@ +on: + workflow_call: + inputs: + unity-version: + required: true + type: string + init-type: + required: true + type: string + +defaults: + run: + shell: pwsh + +jobs: + compile: + name: ${{ inputs.unity-version }} ${{ inputs.init-type }} + runs-on: 'macos-latest' + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Download app project + uses: actions/download-artifact@v4 + with: + name: testapp-ios-${{ inputs.unity-version }}-${{ inputs.init-type }} + + - name: Extract app project + run: tar -xvzf test-app-${{ inputs.init-type }}.tar.gz + + - name: iOS smoke test + run: ./scripts/smoke-test-ios.ps1 Build -IsIntegrationTest -UnityVersion "${{ inputs.unity-version }}" -iOSMinVersion "16.1" + timeout-minutes: 10 + + - name: Upload integration-test project on failure + if: ${{ failure() }} + uses: actions/upload-artifact@v4 + with: + name: failed-project-ios-${{ inputs.unity-version }}-${{ inputs.init-type }}-compiled + path: | + samples/IntegrationTest + !samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame + # Lower retention period - we only need this to retry CI. + retention-days: 14 + + - name: Upload app + uses: actions/upload-artifact@v4 + with: + name: testapp-ios-compiled-${{ inputs.unity-version }}-${{ inputs.init-type }} + # Collect app but ignore the files that are not required for the test. + path: | + samples/IntegrationTest/Build/archive/Unity-iPhone/Build/Products/Release-iphonesimulator/ + !**/Release-iphonesimulator/*.dSYM + !**/Release-iphonesimulator/UnityFramework.framework/* + # Lower retention period - we only need this to retry CI. + retention-days: 14 diff --git a/.github/workflows/ios-smoke-test-run.yml b/.github/workflows/ios-smoke-test-run.yml new file mode 100644 index 000000000..c938c7e8c --- /dev/null +++ b/.github/workflows/ios-smoke-test-run.yml @@ -0,0 +1,56 @@ +on: + workflow_call: + inputs: + unity-version: + required: true + type: string + ios-version: + required: true + type: string + init-type: + required: true + type: string + # Map the workflow outputs to job outputs + outputs: + status: + description: "Smoke test status" + value: ${{ jobs.run.outputs.status }} + +defaults: + run: + shell: pwsh + +jobs: + run: + name: ${{ inputs.unity-version }} ${{ inputs.init-type }} + runs-on: macos-13 # Pinning to get the oldest, supported version of iOS simulator + # Map the job outputs to step outputs + outputs: + status: ${{ steps.smoke-test.outputs.status }} + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Download app artifact + uses: actions/download-artifact@v4 + with: + name: testapp-iOS-compiled-${{ inputs.unity-version }}-${{ inputs.init-type }} + path: samples/IntegrationTest/Build + + - name: Set Xcode for iOS version ${{ inputs.ios-version }} + if: ${{ inputs.ios-version != 'latest'}} + uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # pin@v1.6 + with: + xcode-version: '14.1' # to run iOS 16.1 we need Xcode 14.1 + + - name: Run iOS Smoke Tests + id: smoke-test + timeout-minutes: 20 + run: | + $runtime = "${{ inputs.ios-version }}" + If ($runtime -ne "latest") + { + $runtime = "iOS " + $runtime + } + ./Scripts/smoke-test-ios.ps1 Test "$runtime" -IsIntegrationTest \ No newline at end of file From a81dc29302c0401513122e84983ce4fef5e6c290 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Fri, 24 Jan 2025 14:35:04 +0100 Subject: [PATCH 12/29] fixed artifact name and uploading of non-mobile apps --- .github/workflows/ci.yml | 13 ++----------- .github/workflows/ios-smoke-test-run.yml | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66adc6c7d..aceb4d1e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -151,8 +151,8 @@ jobs: - name: Extract project archive run: tar -xvzf test-project.tar.gz - - name: Build without Sentry SDK - run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform "${{ matrix.platform }}" + # - name: Build without Sentry SDK + # run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform "${{ matrix.platform }}" - name: Download UPM package uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848 @@ -188,15 +188,6 @@ jobs: if-no-files-found: error path: test-app-runtime.tar.gz retention-days: 14 - - # Upload build-time initialization build - - name: Upload test app (build-time initialization) - uses: actions/upload-artifact@v4 - with: - name: testapp-${{ matrix.platform }}-${{ matrix.unity-version }}-buildtime - if-no-files-found: error - path: test-app-buildtime.tar.gz - retention-days: 14 - name: Upload IntegrationTest project on failure if: ${{ failure() }} diff --git a/.github/workflows/ios-smoke-test-run.yml b/.github/workflows/ios-smoke-test-run.yml index c938c7e8c..f78cdac11 100644 --- a/.github/workflows/ios-smoke-test-run.yml +++ b/.github/workflows/ios-smoke-test-run.yml @@ -35,7 +35,7 @@ jobs: - name: Download app artifact uses: actions/download-artifact@v4 with: - name: testapp-iOS-compiled-${{ inputs.unity-version }}-${{ inputs.init-type }} + name: testapp-ios-compiled-${{ inputs.unity-version }}-${{ inputs.init-type }} path: samples/IntegrationTest/Build - name: Set Xcode for iOS version ${{ inputs.ios-version }} From fafb3d59baf9b8735ed184288a5c61ce22fa8c8d Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Fri, 24 Jan 2025 15:15:56 +0100 Subject: [PATCH 13/29] ios artifacts --- .github/workflows/ios-smoke-test-compile.yml | 4 ++++ .github/workflows/ios-smoke-test-run.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/ios-smoke-test-compile.yml b/.github/workflows/ios-smoke-test-compile.yml index 145c8286d..3e6b93c80 100644 --- a/.github/workflows/ios-smoke-test-compile.yml +++ b/.github/workflows/ios-smoke-test-compile.yml @@ -44,6 +44,10 @@ jobs: # Lower retention period - we only need this to retry CI. retention-days: 14 + - name: List downloaded files + run: | + Get-ChildItem -Path "samples/IntegrationTest/Build" -Recurse + - name: Upload app uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/ios-smoke-test-run.yml b/.github/workflows/ios-smoke-test-run.yml index f78cdac11..a28ac9ee9 100644 --- a/.github/workflows/ios-smoke-test-run.yml +++ b/.github/workflows/ios-smoke-test-run.yml @@ -38,6 +38,10 @@ jobs: name: testapp-ios-compiled-${{ inputs.unity-version }}-${{ inputs.init-type }} path: samples/IntegrationTest/Build + - name: List downloaded files + run: | + Get-ChildItem -Path "samples/IntegrationTest/Build" -Recurse + - name: Set Xcode for iOS version ${{ inputs.ios-version }} if: ${{ inputs.ios-version != 'latest'}} uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # pin@v1.6 From 3d7038a920458b4d8abcc6a678b3af282745114b Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Fri, 24 Jan 2025 16:30:37 +0100 Subject: [PATCH 14/29] artifact path --- scripts/smoke-test-ios.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/smoke-test-ios.ps1 b/scripts/smoke-test-ios.ps1 index ed21a3f9e..ee70fc608 100644 --- a/scripts/smoke-test-ios.ps1 +++ b/scripts/smoke-test-ios.ps1 @@ -21,7 +21,7 @@ Write-Host "Args received Action=$Action, SelectedRuntime=$SelectedRuntime, IsIn $ProjectName = "Unity-iPhone" $XcodeArtifactPath = "samples/IntegrationTest/Build" $ArchivePath = "$XcodeArtifactPath/archive" -$AppPath = "$ArchivePath/$ProjectName/Build/Products/Release-iphonesimulator/IntegrationTest.app" +$AppPath = "$ArchivePath/$ProjectName/Build/IntegrationTest.app" $AppName = "com.DefaultCompany.IntegrationTest" Class AppleDevice From f022c62a9ad40a6cc5e69c94082b612ef9c3ae4f Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Fri, 24 Jan 2025 16:52:20 +0100 Subject: [PATCH 15/29] artifact path oddness --- scripts/smoke-test-ios.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/smoke-test-ios.ps1 b/scripts/smoke-test-ios.ps1 index ee70fc608..4742998a7 100644 --- a/scripts/smoke-test-ios.ps1 +++ b/scripts/smoke-test-ios.ps1 @@ -21,7 +21,7 @@ Write-Host "Args received Action=$Action, SelectedRuntime=$SelectedRuntime, IsIn $ProjectName = "Unity-iPhone" $XcodeArtifactPath = "samples/IntegrationTest/Build" $ArchivePath = "$XcodeArtifactPath/archive" -$AppPath = "$ArchivePath/$ProjectName/Build/IntegrationTest.app" +$AppPath = "$XcodeArtifactPath/IntegrationTest.app" $AppName = "com.DefaultCompany.IntegrationTest" Class AppleDevice From 2f8a52a2ff880c95aa5be3d86ec99b27a7e40765 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Fri, 24 Jan 2025 18:22:23 +0100 Subject: [PATCH 16/29] . --- .github/workflows/smoke-test-create.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/smoke-test-create.yml b/.github/workflows/smoke-test-create.yml index 25ca08491..1c8778777 100644 --- a/.github/workflows/smoke-test-create.yml +++ b/.github/workflows/smoke-test-create.yml @@ -15,6 +15,9 @@ jobs: create: name: Create Smoke Test - ${{ inputs.unity-version }} runs-on: ubuntu-latest + env: + UNITY_PATH: docker exec unity unity-editor + steps: - name: Checkout uses: actions/checkout@v3 @@ -33,7 +36,7 @@ jobs: shell: bash - name: Create new Project - run: ./test/Scripts.Integration.Test/create-project.ps1 -UnityPath "docker exec unity unity-editor" + run: ./test/Scripts.Integration.Test/create-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" # We create tar explicitly because upload-artifact is slow for many files. - name: Create archive @@ -47,4 +50,8 @@ jobs: path: test-project.tar.gz # Lower retention period - we only need this to retry CI. retention-days: 14 + + # TODO: Can we build without Sentry SDK for all platforms here? The rest of the CI run waits for the SDK build to finish anyway + # - name: Build without Sentry SDK + # run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform "${{ matrix.platform }}" \ No newline at end of file From 9116801cab4d4332461bbe02247d286193b4c305 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Mon, 27 Jan 2025 11:49:34 +0100 Subject: [PATCH 17/29] merge android export & compile --- .../workflows/android-smoke-test-build.yml | 47 ++++++++----------- .github/workflows/ci.yml | 18 +------ 2 files changed, 21 insertions(+), 44 deletions(-) diff --git a/.github/workflows/android-smoke-test-build.yml b/.github/workflows/android-smoke-test-build.yml index 8485794c0..d9918a8c2 100644 --- a/.github/workflows/android-smoke-test-build.yml +++ b/.github/workflows/android-smoke-test-build.yml @@ -83,25 +83,20 @@ jobs: - name: Configure Sentry run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols - - name: Build Project + - name: Export Gradle Project - Runtime run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols:$false -UnityVersion "${{ inputs.unity-version }}" - # We create tar explicitly because upload-artifact is slow for many files. - - name: Create archive - shell: bash - run: | - # Note: remove local.properties file that contains Android SDK & NDK paths in the Unity installation. - rm -rf samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame - tar -cvzf test-app-runtime.tar.gz samples/IntegrationTest/Build + - name: Build Gradle Project - Runtime + run: ./scripts/smoke-test-android.ps1 Build -IsIntegrationTest -UnityVersion "${{ inputs.unity-version }}" - # Upload runtime initialization build - - name: Upload test app + - name: Upload app uses: actions/upload-artifact@v4 with: - name: testapp-android-${{ inputs.unity-version }}-runtime - if-no-files-found: error - path: test-app-runtime.tar.gz - retention-days: 14 + name: testapp-android-compiled-${{ inputs.unity-version }}-runtime + # Collect app but ignore the files that are not required for the test. + path: | + samples/IntegrationTest/Build/*.apk + retention-days: 14 # Lower retention period - we only need this to retry CI. - name: Configure Sentry for mobile platforms (build-time initialization) run: | @@ -110,23 +105,20 @@ jobs: $content = $content -replace 'AndroidNativeInitializationType = NativeInitializationType.Runtime', 'AndroidNativeInitializationType = NativeInitializationType.BuildTime' Set-Content $optionsPath $content - - name: Build Project for mobile platforms (build-time initialization) + - name: Export Gradle Project - Build Time run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols:$false -UnityVersion "${{ inputs.unity-version }}" - - name: Create archive (build-time initialization) - shell: bash - run: | - rm -rf samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame - tar -cvzf test-app-buildtime.tar.gz samples/IntegrationTest/Build + - name: Build Gradle Project - Build Time + run: ./scripts/smoke-test-android.ps1 Build -IsIntegrationTest -UnityVersion "${{ inputs.unity-version }}" - # Upload build-time initialization build - - name: Upload test app (build-time initialization) + - name: Upload app uses: actions/upload-artifact@v4 with: - name: testapp-android-${{ inputs.unity-version }}-buildtime - if-no-files-found: error - path: test-app-buildtime.tar.gz - retention-days: 14 + name: testapp-android-compiled-${{ inputs.unity-version }}-buildtime + # Collect app but ignore the files that are not required for the test. + path: | + samples/IntegrationTest/Build/*.apk + retention-days: 14 # Lower retention period - we only need this to retry CI. - name: Upload IntegrationTest project on failure if: ${{ failure() }} @@ -136,5 +128,4 @@ jobs: path: | samples/IntegrationTest !samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame - # Lower retention period - we only need this to retry CI. - retention-days: 14 \ No newline at end of file + retention-days: 14 # Lower retention period - we only need this to retry CI. \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aceb4d1e9..4e70c1278 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -204,31 +204,17 @@ jobs: needs: [smoke-test-create] secrets: inherit if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} - strategy: - fail-fast: false - matrix: - unity-version: ["2019", "2022", "6000"] - uses: ./.github/workflows/android-smoke-test-build.yml - with: - unity-version: ${{ matrix.unity-version }} - - android-smoke-test-compile: - needs: [android-smoke-test-build] - secrets: inherit - if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} strategy: fail-fast: false matrix: unity-version: ["2019", "6000"] - init-type: ["runtime", "buildtime"] - uses: ./.github/workflows/android-smoke-test-compile.yml + uses: ./.github/workflows/android-smoke-test-build.yml with: unity-version: ${{ matrix.unity-version }} - init-type: ${{ matrix.init-type }} android-smoke-test-run: if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} - needs: [android-smoke-test-compile] + needs: [android-smoke-test-build] uses: ./.github/workflows/android-smoke-test-run.yml with: unity-version: ${{ matrix.unity-version }} From a1f5c925472dbbf059aa59f641a77641740c3546 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Mon, 27 Jan 2025 12:05:30 +0100 Subject: [PATCH 18/29] export apk --- .github/workflows/android-smoke-test-build.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/android-smoke-test-build.yml b/.github/workflows/android-smoke-test-build.yml index d9918a8c2..05be6761e 100644 --- a/.github/workflows/android-smoke-test-build.yml +++ b/.github/workflows/android-smoke-test-build.yml @@ -18,7 +18,7 @@ jobs: include: - platform: Android check_symbols: false - build_platform: Android-Export + build_platform: Android env: UNITY_PATH: docker exec unity unity-editor @@ -83,11 +83,11 @@ jobs: - name: Configure Sentry run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols - - name: Export Gradle Project - Runtime + - name: Export Project - Runtime run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols:$false -UnityVersion "${{ inputs.unity-version }}" - - name: Build Gradle Project - Runtime - run: ./scripts/smoke-test-android.ps1 Build -IsIntegrationTest -UnityVersion "${{ inputs.unity-version }}" + # - name: Build Gradle Project - Runtime + # run: ./scripts/smoke-test-android.ps1 Build -IsIntegrationTest -UnityVersion "${{ inputs.unity-version }}" - name: Upload app uses: actions/upload-artifact@v4 @@ -105,11 +105,11 @@ jobs: $content = $content -replace 'AndroidNativeInitializationType = NativeInitializationType.Runtime', 'AndroidNativeInitializationType = NativeInitializationType.BuildTime' Set-Content $optionsPath $content - - name: Export Gradle Project - Build Time + - name: Export Project - Build Time run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols:$false -UnityVersion "${{ inputs.unity-version }}" - - name: Build Gradle Project - Build Time - run: ./scripts/smoke-test-android.ps1 Build -IsIntegrationTest -UnityVersion "${{ inputs.unity-version }}" + # - name: Build Gradle Project - Build Time + # run: ./scripts/smoke-test-android.ps1 Build -IsIntegrationTest -UnityVersion "${{ inputs.unity-version }}" - name: Upload app uses: actions/upload-artifact@v4 From 1f2e21df7dd5b7ad91656dc8afc026c1eace1918 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Mon, 27 Jan 2025 12:56:04 +0100 Subject: [PATCH 19/29] log debug symbol upload --- .../Android/DebugSymbolUpload.cs | 28 ++++--------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/src/Sentry.Unity.Editor/Android/DebugSymbolUpload.cs b/src/Sentry.Unity.Editor/Android/DebugSymbolUpload.cs index bd798d954..28fc1e4d4 100644 --- a/src/Sentry.Unity.Editor/Android/DebugSymbolUpload.cs +++ b/src/Sentry.Unity.Editor/Android/DebugSymbolUpload.cs @@ -46,39 +46,23 @@ private string SymbolUploadTaskFormat stringBuilder.AppendLine("afterEvaluate {"); stringBuilder.AppendLine("task sentryUploadSymbols {"); stringBuilder.AppendLine(" doLast {"); - if (_isExporting) - { - stringBuilder.AppendLine(" println 'Uploading symbols to Sentry.'"); - } - else + stringBuilder.AppendLine(" println 'Uploading symbols to Sentry.'"); + + if (!_isExporting && _ignoreCliErrors) { - var logsDir = $"{ConvertSlashes(_unityProjectPath)}/Logs"; - Directory.CreateDirectory(logsDir); - stringBuilder.AppendLine(" println 'Uploading symbols to Sentry. You can find the full log in ./Logs/sentry-symbols-upload.log (the file content may not be strictly sequential because it\\'s a merge of two streams).'"); - stringBuilder.AppendLine($" def logFilePath = '{logsDir}/{SymbolUploadLogName}'"); - stringBuilder.AppendLine(" def sentryLogFile = new FileOutputStream(logFilePath)"); - if (_ignoreCliErrors) - { - stringBuilder.AppendLine(" try {"); - } + stringBuilder.AppendLine(" try {"); } stringBuilder.AppendLine(" exec {"); stringBuilder.AppendLine(" environment 'SENTRY_PROPERTIES', './sentry.properties'"); stringBuilder.AppendLine($" executable '{SentryCliMarker}'"); stringBuilder.AppendLine($" args = ['debug-files', 'upload'{UploadArgsMarker}]"); - if (!_isExporting) - { - stringBuilder.AppendLine(" standardOutput sentryLogFile"); - stringBuilder.AppendLine(" errorOutput sentryLogFile"); - } - stringBuilder.AppendLine(" }"); + if (!_isExporting && _ignoreCliErrors) { stringBuilder.AppendLine(" } catch (exception) {"); - stringBuilder.AppendLine(" def file = new File(logFilePath)"); - stringBuilder.AppendLine(" file.append('===ERROR===' + exception)"); + stringBuilder.AppendLine(" println '===ERROR===' + exception"); stringBuilder.AppendLine(" }"); } CheckMapping(stringBuilder); From cde46a12d26b09bfd7bdf93ccd6a34a029a614c6 Mon Sep 17 00:00:00 2001 From: Sentry Github Bot Date: Mon, 27 Jan 2025 11:58:03 +0000 Subject: [PATCH 20/29] Format code --- src/Sentry.Unity.Editor/Android/DebugSymbolUpload.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Sentry.Unity.Editor/Android/DebugSymbolUpload.cs b/src/Sentry.Unity.Editor/Android/DebugSymbolUpload.cs index 28fc1e4d4..61c7df465 100644 --- a/src/Sentry.Unity.Editor/Android/DebugSymbolUpload.cs +++ b/src/Sentry.Unity.Editor/Android/DebugSymbolUpload.cs @@ -47,7 +47,7 @@ private string SymbolUploadTaskFormat stringBuilder.AppendLine("task sentryUploadSymbols {"); stringBuilder.AppendLine(" doLast {"); stringBuilder.AppendLine(" println 'Uploading symbols to Sentry.'"); - + if (!_isExporting && _ignoreCliErrors) { stringBuilder.AppendLine(" try {"); From 28e1d4fd6c6c154f5f7e1ad73ac9ba102e2f8871 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Mon, 27 Jan 2025 19:31:15 +0100 Subject: [PATCH 21/29] check symbol upload --- .github/workflows/android-smoke-test-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/android-smoke-test-build.yml b/.github/workflows/android-smoke-test-build.yml index 05be6761e..02745622d 100644 --- a/.github/workflows/android-smoke-test-build.yml +++ b/.github/workflows/android-smoke-test-build.yml @@ -84,7 +84,7 @@ jobs: run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols - name: Export Project - Runtime - run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols:$false -UnityVersion "${{ inputs.unity-version }}" + run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols:$true -UnityVersion "${{ inputs.unity-version }}" # - name: Build Gradle Project - Runtime # run: ./scripts/smoke-test-android.ps1 Build -IsIntegrationTest -UnityVersion "${{ inputs.unity-version }}" @@ -106,7 +106,7 @@ jobs: Set-Content $optionsPath $content - name: Export Project - Build Time - run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols:$false -UnityVersion "${{ inputs.unity-version }}" + run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols:$true -UnityVersion "${{ inputs.unity-version }}" # - name: Build Gradle Project - Build Time # run: ./scripts/smoke-test-android.ps1 Build -IsIntegrationTest -UnityVersion "${{ inputs.unity-version }}" From d9002684a19b1d5ce4a62641238066606f8dd5d9 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Tue, 28 Jan 2025 14:04:35 +0100 Subject: [PATCH 22/29] revert symbol upload logging changes --- .../Android/DebugSymbolUpload.cs | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/Sentry.Unity.Editor/Android/DebugSymbolUpload.cs b/src/Sentry.Unity.Editor/Android/DebugSymbolUpload.cs index 61c7df465..bd798d954 100644 --- a/src/Sentry.Unity.Editor/Android/DebugSymbolUpload.cs +++ b/src/Sentry.Unity.Editor/Android/DebugSymbolUpload.cs @@ -46,23 +46,39 @@ private string SymbolUploadTaskFormat stringBuilder.AppendLine("afterEvaluate {"); stringBuilder.AppendLine("task sentryUploadSymbols {"); stringBuilder.AppendLine(" doLast {"); - stringBuilder.AppendLine(" println 'Uploading symbols to Sentry.'"); - - if (!_isExporting && _ignoreCliErrors) + if (_isExporting) { - stringBuilder.AppendLine(" try {"); + stringBuilder.AppendLine(" println 'Uploading symbols to Sentry.'"); + } + else + { + var logsDir = $"{ConvertSlashes(_unityProjectPath)}/Logs"; + Directory.CreateDirectory(logsDir); + stringBuilder.AppendLine(" println 'Uploading symbols to Sentry. You can find the full log in ./Logs/sentry-symbols-upload.log (the file content may not be strictly sequential because it\\'s a merge of two streams).'"); + stringBuilder.AppendLine($" def logFilePath = '{logsDir}/{SymbolUploadLogName}'"); + stringBuilder.AppendLine(" def sentryLogFile = new FileOutputStream(logFilePath)"); + if (_ignoreCliErrors) + { + stringBuilder.AppendLine(" try {"); + } } stringBuilder.AppendLine(" exec {"); stringBuilder.AppendLine(" environment 'SENTRY_PROPERTIES', './sentry.properties'"); stringBuilder.AppendLine($" executable '{SentryCliMarker}'"); stringBuilder.AppendLine($" args = ['debug-files', 'upload'{UploadArgsMarker}]"); - stringBuilder.AppendLine(" }"); + if (!_isExporting) + { + stringBuilder.AppendLine(" standardOutput sentryLogFile"); + stringBuilder.AppendLine(" errorOutput sentryLogFile"); + } + stringBuilder.AppendLine(" }"); if (!_isExporting && _ignoreCliErrors) { stringBuilder.AppendLine(" } catch (exception) {"); - stringBuilder.AppendLine(" println '===ERROR===' + exception"); + stringBuilder.AppendLine(" def file = new File(logFilePath)"); + stringBuilder.AppendLine(" file.append('===ERROR===' + exception)"); stringBuilder.AppendLine(" }"); } CheckMapping(stringBuilder); From 2391cef35023161c752ba8ff520f785e557e9146 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Tue, 28 Jan 2025 14:09:19 +0100 Subject: [PATCH 23/29] cleanup --- .../workflows/android-smoke-test-build.yml | 14 +-- .../workflows/android-smoke-test-compile.yml | 87 ------------------- 2 files changed, 4 insertions(+), 97 deletions(-) delete mode 100644 .github/workflows/android-smoke-test-compile.yml diff --git a/.github/workflows/android-smoke-test-build.yml b/.github/workflows/android-smoke-test-build.yml index 02745622d..75992d11e 100644 --- a/.github/workflows/android-smoke-test-build.yml +++ b/.github/workflows/android-smoke-test-build.yml @@ -13,12 +13,6 @@ jobs: build: name: ${{ inputs.unity-version }} runs-on: ubuntu-latest - strategy: - matrix: - include: - - platform: Android - check_symbols: false - build_platform: Android env: UNITY_PATH: docker exec unity unity-editor @@ -66,7 +60,7 @@ jobs: run: tar -xvzf test-project.tar.gz # - name: Build without Sentry SDK - # run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform "${{ matrix.platform }}" + # run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform "Android" - name: Download UPM package uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848 @@ -81,10 +75,10 @@ jobs: run: ./test/Scripts.Integration.Test/add-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" - name: Configure Sentry - run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols + run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform "Android" -CheckSymbols - name: Export Project - Runtime - run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols:$true -UnityVersion "${{ inputs.unity-version }}" + run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform "Android" -CheckSymbols:$true -UnityVersion "${{ inputs.unity-version }}" # - name: Build Gradle Project - Runtime # run: ./scripts/smoke-test-android.ps1 Build -IsIntegrationTest -UnityVersion "${{ inputs.unity-version }}" @@ -106,7 +100,7 @@ jobs: Set-Content $optionsPath $content - name: Export Project - Build Time - run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols:$true -UnityVersion "${{ inputs.unity-version }}" + run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform "Android" -CheckSymbols:$true -UnityVersion "${{ inputs.unity-version }}" # - name: Build Gradle Project - Build Time # run: ./scripts/smoke-test-android.ps1 Build -IsIntegrationTest -UnityVersion "${{ inputs.unity-version }}" diff --git a/.github/workflows/android-smoke-test-compile.yml b/.github/workflows/android-smoke-test-compile.yml deleted file mode 100644 index cbd823928..000000000 --- a/.github/workflows/android-smoke-test-compile.yml +++ /dev/null @@ -1,87 +0,0 @@ -on: - workflow_call: - inputs: - unity-version: - required: true - type: string - init-type: - required: true - type: string - -defaults: - run: - shell: pwsh - -jobs: - compile: - name: ${{ inputs.unity-version }} ${{ inputs.init-type }} - runs-on: 'ubuntu-latest-4-cores' - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Download app project - uses: actions/download-artifact@v4 - with: - name: testapp-android-${{ inputs.unity-version }}-${{ inputs.init-type }} - - - name: Extract app project - run: tar -xvzf test-app-${{ inputs.init-type }}.tar.gz - - - name: Setup Android - uses: android-actions/setup-android@7c5672355aaa8fde5f97a91aa9a99616d1ace6bc # pin@v2 - - - name: Setup NDK - uses: nttld/setup-ndk@8c3b609ff4d54576ea420551943fd34b4d03b0dc # pin@v1 - id: setup-ndk - with: - # See supported version in https://docs.unity3d.com/6000.0/Documentation/Manual/android-sdksetup.html - ndk-version: ${{ inputs.unity-version == '2019' && 'r19' || 'r23b' }} - add-to-path: false - - - name: Setup Java for Unity - run: ./scripts/ci-setup-java.ps1 -UnityVersion "${{ inputs.unity-version }}" - - # We modify the exported gradle project to deal with the different build-environment - # I.e. we're fixing the paths for SDK & NDK that have been hardcoded to point at the Unity installation - - name: Modify gradle project - run: | - ./test/Scripts.Integration.Test/modify-gradle-project.ps1 ` - -AndroidSdkRoot $env:ANDROID_SDK_ROOT ` - -NdkPath ${{ steps.setup-ndk.outputs.ndk-path }} ` - -UnityVersion ${{ inputs.unity-version }} - - - name: Android smoke test - # Skipping Android on Unity 2022 for now - run: | - if ("${{ inputs.unity-version }}" -ne "2022") - { - ./scripts/smoke-test-android.ps1 Build -IsIntegrationTest -UnityVersion "${{ inputs.unity-version }}" - } - timeout-minutes: 10 - env: - JAVA_HOME: ${{ env.JAVA_HOME }} - - - name: Upload integration-test project on failure - if: ${{ failure() }} - uses: actions/upload-artifact@v4 - with: - name: failed-project-android-${{ inputs.unity-version }}-${{ inputs.init-type }}-compiled - path: | - samples/IntegrationTest - !samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame - # Lower retention period - we only need this to retry CI. - retention-days: 14 - - - name: Upload app - uses: actions/upload-artifact@v4 - # Skipping Android on Unity 2022 for now - if: ${{ inputs.unity-version != '2022' }} - with: - name: testapp-android-compiled-${{ inputs.unity-version }}-${{ inputs.init-type }} - # Collect app but ignore the files that are not required for the test. - path: | - samples/IntegrationTest/Build/*.apk - # Lower retention period - we only need this to retry CI. - retention-days: 14 \ No newline at end of file From c5ffa70545d721a8ebba49e28ca170157bda618d Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Tue, 28 Jan 2025 14:10:17 +0100 Subject: [PATCH 24/29] big runner and no cleaning disk space --- .github/workflows/android-smoke-test-build.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/android-smoke-test-build.yml b/.github/workflows/android-smoke-test-build.yml index 75992d11e..47bd5cf8f 100644 --- a/.github/workflows/android-smoke-test-build.yml +++ b/.github/workflows/android-smoke-test-build.yml @@ -12,7 +12,7 @@ defaults: jobs: build: name: ${{ inputs.unity-version }} - runs-on: ubuntu-latest + runs-on: ubuntu-latest-4-cores env: UNITY_PATH: docker exec unity unity-editor @@ -20,16 +20,6 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Free Disk Space (Ubuntu) - uses: jlumbroso/free-disk-space@f68fdb76e2ea636224182cfb7377ff9a1708f9b8 - with: - android: true - dotnet: false - haskell: true - large-packages: false - docker-images: false - swap-storage: true - - run: echo "::add-mask::${{ secrets.LICENSE_SERVER_URL }}" - name: Docker Login From 0e062552d03a6ae57c27e11909d4d256c725ffbb Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Tue, 28 Jan 2025 14:16:31 +0100 Subject: [PATCH 25/29] fixed naming --- .github/workflows/ci.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e70c1278..66bc5144d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,7 +78,7 @@ jobs: smoke-test-create: secrets: inherit if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} - name: ${{ matrix.unity-version }} Prepare Smoke Test + name: Prepare ${{ matrix.unity-version }} Smoke Test strategy: fail-fast: false matrix: @@ -90,7 +90,7 @@ jobs: # A Linux, docker-based build to prepare a game ("player") for some platforms. The tests run in `smoke-test-run`. smoke-test-build: if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} - name: ${{ matrix.unity-version }} ${{ matrix.platform }} Build Smoke Test + name: Build ${{ matrix.platform }} ${{ matrix.unity-version }} Smoke Test needs: [smoke-test-create] runs-on: ubuntu-latest strategy: @@ -201,6 +201,7 @@ jobs: retention-days: 14 android-smoke-test-build: + name: Build Android ${{ matrix.unity-version }} Smoke Test needs: [smoke-test-create] secrets: inherit if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} @@ -213,6 +214,7 @@ jobs: unity-version: ${{ matrix.unity-version }} android-smoke-test-run: + name: Run Android ${{ matrix.unity-version }} Smoke Test if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} needs: [android-smoke-test-build] uses: ./.github/workflows/android-smoke-test-run.yml @@ -228,6 +230,7 @@ jobs: unity-version: ["2019", "6000"] ios-smoke-test-build: + name: Build iOS ${{ matrix.unity-version }} Smoke Test needs: [smoke-test-create] secrets: inherit if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} @@ -240,6 +243,7 @@ jobs: unity-version: ${{ matrix.unity-version }} ios-smoke-test-compile: + name: Compile iOS ${{ matrix.unity-version }} Smoke Test needs: [ios-smoke-test-build] secrets: inherit if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} @@ -254,6 +258,7 @@ jobs: init-type: ${{ matrix.init-type }} ios-smoke-test-run: + name: Run iOS ${{ matrix.unity-version }} Smoke Test if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} needs: [ios-smoke-test-compile] uses: ./.github/workflows/ios-smoke-test-run.yml @@ -278,9 +283,9 @@ jobs: init-type: ["runtime", "buildtime"] smoke-test-run: + name: Run ${{ matrix.platform }} ${{ matrix.unity-version }} Smoke Test if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} needs: [smoke-test-build] - name: ${{ matrix.unity-version }} ${{ matrix.platform }} Run Smoke Test runs-on: ubuntu-latest strategy: fail-fast: false @@ -316,8 +321,8 @@ jobs: run: ./test/Scripts.Integration.Test/run-smoke-test.ps1 -Crash desktop-smoke-test: + name: Run ${{ matrix.unity-version }} ${{ matrix.os }} Smoke Test if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} - name: ${{ matrix.unity-version }} ${{ matrix.os }} Run Smoke Test needs: [smoke-test-create] runs-on: ${{ matrix.os }}-latest strategy: From 64921bbc9bd910255a423c23dfb95097a5b82567 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Fri, 31 Jan 2025 10:54:25 +0100 Subject: [PATCH 26/29] fixed merge conflicts --- .../workflows/android-smoke-test-build.yml | 50 +------------------ 1 file changed, 1 insertion(+), 49 deletions(-) diff --git a/.github/workflows/android-smoke-test-build.yml b/.github/workflows/android-smoke-test-build.yml index 7927278a8..3da40eb04 100644 --- a/.github/workflows/android-smoke-test-build.yml +++ b/.github/workflows/android-smoke-test-build.yml @@ -19,11 +19,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 -<<<<<<< HEAD -======= - ->>>>>>> main - run: echo "::add-mask::${{ secrets.LICENSE_SERVER_URL }}" - name: Docker Login @@ -53,12 +49,6 @@ jobs: - name: Extract project archive run: tar -xvzf test-project.tar.gz -<<<<<<< HEAD - # - name: Build without Sentry SDK - # run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform "Android" - -======= ->>>>>>> main - name: Download UPM package uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848 with: @@ -74,24 +64,6 @@ jobs: - name: Configure Sentry run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform "Android" -CheckSymbols -<<<<<<< HEAD - - name: Export Project - Runtime - run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform "Android" -CheckSymbols:$true -UnityVersion "${{ inputs.unity-version }}" - - # - name: Build Gradle Project - Runtime - # run: ./scripts/smoke-test-android.ps1 Build -IsIntegrationTest -UnityVersion "${{ inputs.unity-version }}" - - - name: Upload app - uses: actions/upload-artifact@v4 - with: - name: testapp-android-compiled-${{ inputs.unity-version }}-runtime - # Collect app but ignore the files that are not required for the test. - path: | - samples/IntegrationTest/Build/*.apk - retention-days: 14 # Lower retention period - we only need this to retry CI. - - - name: Configure Sentry for mobile platforms (build-time initialization) -======= - name: Export APK - Runtime Initialization run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform "Android" -CheckSymbols:$true -UnityVersion "${{ inputs.unity-version }}" @@ -103,28 +75,12 @@ jobs: retention-days: 14 # Lower retention period - we only need this to retry CI. - name: Overwrite OptionsConfiguration for build-time initialization ->>>>>>> main run: | $optionsPath = "samples/IntegrationTest/Assets/Scripts/OptionsConfiguration.cs" $content = Get-Content $optionsPath -Raw $content = $content -replace 'AndroidNativeInitializationType = NativeInitializationType.Runtime', 'AndroidNativeInitializationType = NativeInitializationType.BuildTime' Set-Content $optionsPath $content -<<<<<<< HEAD - - name: Export Project - Build Time - run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform "Android" -CheckSymbols:$true -UnityVersion "${{ inputs.unity-version }}" - - # - name: Build Gradle Project - Build Time - # run: ./scripts/smoke-test-android.ps1 Build -IsIntegrationTest -UnityVersion "${{ inputs.unity-version }}" - - - name: Upload app - uses: actions/upload-artifact@v4 - with: - name: testapp-android-compiled-${{ inputs.unity-version }}-buildtime - # Collect app but ignore the files that are not required for the test. - path: | - samples/IntegrationTest/Build/*.apk -======= - name: Export APK - Build-Time Initialization run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform "Android" -CheckSymbols:$true -UnityVersion "${{ inputs.unity-version }}" @@ -133,7 +89,6 @@ jobs: with: name: testapp-android-compiled-${{ inputs.unity-version }}-buildtime path: samples/IntegrationTest/Build/*.apk # Collect app but ignore the files that are not required for the test. ->>>>>>> main retention-days: 14 # Lower retention period - we only need this to retry CI. - name: Upload IntegrationTest project on failure @@ -144,8 +99,5 @@ jobs: path: | samples/IntegrationTest !samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame -<<<<<<< HEAD retention-days: 14 # Lower retention period - we only need this to retry CI. -======= - retention-days: 14 # Lower retention period - we only need this to retry CI. ->>>>>>> main + From 50f1048e2eeefcf1c6f6cac5432ad577eeb9f798 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Fri, 31 Jan 2025 10:54:49 +0100 Subject: [PATCH 27/29] fixed merge conflicts --- .github/workflows/ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a778ca55..35017e1a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,10 +53,6 @@ jobs: with: unity-version: ${{ matrix.unity-version }} -<<<<<<< HEAD - -======= ->>>>>>> main package-validation: name: UPM Package validation runs-on: ubuntu-latest From 3530398a61bcb42c50126c3350fe813389e4bd59 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Fri, 31 Jan 2025 10:56:51 +0100 Subject: [PATCH 28/29] fixed merge conflicts --- .github/workflows/ios-smoke-test-build.yml | 10 ---------- .github/workflows/smoke-test-create.yml | 8 -------- 2 files changed, 18 deletions(-) diff --git a/.github/workflows/ios-smoke-test-build.yml b/.github/workflows/ios-smoke-test-build.yml index 1912ea99a..624f22487 100644 --- a/.github/workflows/ios-smoke-test-build.yml +++ b/.github/workflows/ios-smoke-test-build.yml @@ -55,12 +55,6 @@ jobs: - name: Extract project archive run: tar -xvzf test-project.tar.gz -<<<<<<< HEAD - # - name: Build without Sentry SDK - # run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform "${{ matrix.platform }}" - -======= ->>>>>>> main - name: Download UPM package uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848 with: @@ -96,11 +90,7 @@ jobs: path: test-app-runtime.tar.gz retention-days: 14 -<<<<<<< HEAD - - name: Configure Sentry for mobile platforms (build-time initialization) -======= - name: Overwrite OptionsConfiguration for build-time initialization ->>>>>>> main run: | $optionsPath = "samples/IntegrationTest/Assets/Scripts/OptionsConfiguration.cs" $content = Get-Content $optionsPath -Raw diff --git a/.github/workflows/smoke-test-create.yml b/.github/workflows/smoke-test-create.yml index 9e32e61ac..2fdf7186b 100644 --- a/.github/workflows/smoke-test-create.yml +++ b/.github/workflows/smoke-test-create.yml @@ -50,11 +50,3 @@ jobs: path: test-project.tar.gz # Lower retention period - we only need this to retry CI. retention-days: 14 -<<<<<<< HEAD - - # TODO: Can we build without Sentry SDK for all platforms here? The rest of the CI run waits for the SDK build to finish anyway - # - name: Build without Sentry SDK - # run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform "${{ matrix.platform }}" - -======= ->>>>>>> main From e4daa101cc0085eb8e81210f06f2d25e34b94c52 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Fri, 31 Jan 2025 11:58:53 +0100 Subject: [PATCH 29/29] fixed naming --- .github/workflows/android-smoke-test-run.yml | 2 +- .github/workflows/ci.yml | 13 +++++++------ .github/workflows/ios-smoke-test-run.yml | 2 +- .github/workflows/smoke-test-create.yml | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/android-smoke-test-run.yml b/.github/workflows/android-smoke-test-run.yml index e90b03dcd..b022de3e0 100644 --- a/.github/workflows/android-smoke-test-run.yml +++ b/.github/workflows/android-smoke-test-run.yml @@ -22,7 +22,7 @@ defaults: jobs: run: - name: ${{ inputs.unity-version }} ${{ inputs.init-type }} + name: ${{ inputs.unity-version }} ${{ inputs.api-level }} ${{ inputs.init-type }} runs-on: ubuntu-latest env: ARTIFACTS_PATH: samples/IntegrationTest/test-artifacts/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35017e1a9..49c323c6b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,7 @@ jobs: runsOn: ${{ matrix.host }} build-unity-sdk: + name: Build Unity SDK secrets: inherit strategy: fail-fast: false @@ -75,9 +76,9 @@ jobs: # This produces the `samples/IntegrationTest` as `smoke-test-${{ matrix.unity-version }}`. smoke-test-create: - secrets: inherit + name: Create ${{ matrix.unity-version }} Smoke Test Project if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} - name: Prepare ${{ matrix.unity-version }} Smoke Test + secrets: inherit strategy: fail-fast: false matrix: @@ -88,8 +89,8 @@ jobs: # A Linux, docker-based build to prepare a game ("player") for some platforms. The tests run in `smoke-test-run`. smoke-test-build: - if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} name: Build ${{ matrix.platform }} ${{ matrix.unity-version }} Smoke Test + if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} needs: [smoke-test-create] runs-on: ubuntu-latest strategy: @@ -201,9 +202,9 @@ jobs: android-smoke-test-build: name: Build Android ${{ matrix.unity-version }} Smoke Test + if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} needs: [smoke-test-create] secrets: inherit - if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} strategy: fail-fast: false matrix: @@ -230,9 +231,9 @@ jobs: ios-smoke-test-build: name: Build iOS ${{ matrix.unity-version }} Smoke Test + if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} needs: [smoke-test-create] secrets: inherit - if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} strategy: fail-fast: false matrix: @@ -243,9 +244,9 @@ jobs: ios-smoke-test-compile: name: Compile iOS ${{ matrix.unity-version }} Smoke Test + if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} needs: [ios-smoke-test-build] secrets: inherit - if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} strategy: fail-fast: false matrix: diff --git a/.github/workflows/ios-smoke-test-run.yml b/.github/workflows/ios-smoke-test-run.yml index a28ac9ee9..a5ed528f5 100644 --- a/.github/workflows/ios-smoke-test-run.yml +++ b/.github/workflows/ios-smoke-test-run.yml @@ -22,7 +22,7 @@ defaults: jobs: run: - name: ${{ inputs.unity-version }} ${{ inputs.init-type }} + name: ${{ inputs.unity-version }} ${{ inputs.ios-version }} ${{ inputs.init-type }} runs-on: macos-13 # Pinning to get the oldest, supported version of iOS simulator # Map the job outputs to step outputs outputs: diff --git a/.github/workflows/smoke-test-create.yml b/.github/workflows/smoke-test-create.yml index 2fdf7186b..521e94f10 100644 --- a/.github/workflows/smoke-test-create.yml +++ b/.github/workflows/smoke-test-create.yml @@ -13,7 +13,7 @@ defaults: jobs: create: - name: Create Smoke Test - ${{ inputs.unity-version }} + name: ${{ inputs.unity-version }} runs-on: ubuntu-latest env: UNITY_PATH: docker exec unity unity-editor