diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 476c38463..2a5e6f2a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -564,12 +564,24 @@ jobs: platform: macos backend: ${{ matrix.backend }} + test-build-size-ios: + name: Measure iOS ${{ matrix.unity-version }} Build Size + if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} + needs: [test-compile-ios, create-unity-matrix] + strategy: + fail-fast: false + matrix: + unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }} + uses: ./.github/workflows/test-build-size-ios.yml + with: + unity-version: ${{ matrix.unity-version }} + build-size-summary: timeout-minutes: 5 name: Build Size runs-on: ubuntu-latest if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} - needs: [test-build-webgl, test-build-android, test-compile-ios, test-build-linux, test-build-windows, test-build-macos] + needs: [test-build-webgl, test-build-android, test-build-size-ios, test-build-linux, test-build-windows, test-build-macos] steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 diff --git a/.github/workflows/test-build-size-ios.yml b/.github/workflows/test-build-size-ios.yml new file mode 100644 index 000000000..bdf30ae35 --- /dev/null +++ b/.github/workflows/test-build-size-ios.yml @@ -0,0 +1,86 @@ +name: "Test: Build Size iOS" +on: + workflow_call: + inputs: + unity-version: + required: true + type: string + +defaults: + run: + shell: pwsh + +jobs: + measure: + timeout-minutes: 30 + name: ${{ inputs.unity-version }} + runs-on: 'macos-15' + env: + UNITY_VERSION: ${{ inputs.unity-version }} + + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Resolve Unity version + id: unity + shell: bash + run: echo "version=$(jq -r --arg v "$UNITY_VERSION" '.[$v].version' scripts/unity-versions.json)" >> "$GITHUB_OUTPUT" + + - name: Restore cached compiled iOS build without Sentry + id: cache-compiled-nosentry + uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: IntegrationTest-NoSentry.app + key: build-nosentry-iOS-compiled-${{ steps.unity.outputs.version }} + + - name: Download build without Sentry (for size comparison) + if: ${{ steps.cache-compiled-nosentry.outputs.cache-hit != 'true' }} + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: testapp-ios-no-sentry-${{ env.UNITY_VERSION }} + + - name: Extract and compile build without Sentry + if: ${{ steps.cache-compiled-nosentry.outputs.cache-hit != 'true' }} + run: | + tar -xvzf test-app-no-sentry.tar.gz + Move-Item -Path "samples/IntegrationTest/Build-NoSentry" -Destination "samples/IntegrationTest/Build" + + - name: Compile Xcode project without Sentry + if: ${{ steps.cache-compiled-nosentry.outputs.cache-hit != 'true' }} + run: ./scripts/compile-xcode-project.ps1 + timeout-minutes: 20 + + - name: Save compiled app without Sentry + if: ${{ steps.cache-compiled-nosentry.outputs.cache-hit != 'true' }} + run: | + Move-Item -Path "samples/IntegrationTest/Build/archive/Unity-iPhone/Build/Products/Release-iphonesimulator/IntegrationTest.app" ` + -Destination "IntegrationTest-NoSentry.app" + + - name: Save cached compiled iOS build without Sentry + if: ${{ steps.cache-compiled-nosentry.outputs.cache-hit != 'true' && github.ref == 'refs/heads/main' }} + uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: IntegrationTest-NoSentry.app + key: ${{ steps.cache-compiled-nosentry.outputs.cache-primary-key }} + + - name: Download app + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: testapp-ios-compiled-${{ env.UNITY_VERSION }}-runtime + path: with-sentry + + - name: Compare build sizes + run: | + ./test/Scripts.Integration.Test/measure-build-size.ps1 ` + -Path1 "IntegrationTest-NoSentry.app" ` + -Path2 "with-sentry/IntegrationTest.app" ` + -Platform "iOS" ` + -UnityVersion "$env:UNITY_VERSION" + + - name: Upload build size measurement + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: build-size-iOS-${{ env.UNITY_VERSION }} + path: build-size-measurements/*.json + retention-days: 1 diff --git a/.github/workflows/test-compile-ios.yml b/.github/workflows/test-compile-ios.yml index c10318f1f..dbb1883f9 100644 --- a/.github/workflows/test-compile-ios.yml +++ b/.github/workflows/test-compile-ios.yml @@ -26,51 +26,6 @@ jobs: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Resolve Unity version - if: ${{ inputs.init-type == 'runtime' }} - id: unity - shell: bash - run: echo "version=$(jq -r --arg v "$UNITY_VERSION" '.[$v].version' scripts/unity-versions.json)" >> "$GITHUB_OUTPUT" - - - name: Restore cached compiled iOS build without Sentry - if: ${{ inputs.init-type == 'runtime' }} - id: cache-compiled-nosentry - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: IntegrationTest-NoSentry.app - key: build-nosentry-iOS-compiled-${{ steps.unity.outputs.version }} - - - name: Download build without Sentry (for size comparison) - if: ${{ inputs.init-type == 'runtime' && steps.cache-compiled-nosentry.outputs.cache-hit != 'true' }} - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: testapp-ios-no-sentry-${{ env.UNITY_VERSION }} - - - name: Extract and compile build without Sentry - if: ${{ inputs.init-type == 'runtime' && steps.cache-compiled-nosentry.outputs.cache-hit != 'true' }} - run: | - tar -xvzf test-app-no-sentry.tar.gz - Move-Item -Path "samples/IntegrationTest/Build-NoSentry" -Destination "samples/IntegrationTest/Build" - - - name: Compile Xcode project without Sentry - if: ${{ inputs.init-type == 'runtime' && steps.cache-compiled-nosentry.outputs.cache-hit != 'true' }} - run: ./scripts/compile-xcode-project.ps1 - timeout-minutes: 20 - - - name: Save compiled app without Sentry - if: ${{ inputs.init-type == 'runtime' && steps.cache-compiled-nosentry.outputs.cache-hit != 'true' }} - run: | - Copy-Item -Path "samples/IntegrationTest/Build/archive/Unity-iPhone/Build/Products/Release-iphonesimulator/IntegrationTest.app" ` - -Destination "IntegrationTest-NoSentry.app" -Recurse - Remove-Item -Path "samples/IntegrationTest/Build" -Recurse -Force - - - name: Save cached compiled iOS build without Sentry - if: ${{ inputs.init-type == 'runtime' && steps.cache-compiled-nosentry.outputs.cache-hit != 'true' && github.ref == 'refs/heads/main' }} - uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: IntegrationTest-NoSentry.app - key: ${{ steps.cache-compiled-nosentry.outputs.cache-primary-key }} - - name: Download app project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: @@ -114,20 +69,3 @@ jobs: !**/Release-iphonesimulator/UnityFramework.framework/* # Lower retention period - we only need this to retry CI. retention-days: 14 - - - name: Compare build sizes - if: ${{ inputs.init-type == 'runtime' }} - run: | - ./test/Scripts.Integration.Test/measure-build-size.ps1 ` - -Path1 "IntegrationTest-NoSentry.app" ` - -Path2 "samples/IntegrationTest/Build/archive/Unity-iPhone/Build/Products/Release-iphonesimulator/IntegrationTest.app" ` - -Platform "iOS" ` - -UnityVersion "$env:UNITY_VERSION" - - - name: Upload build size measurement - if: ${{ inputs.init-type == 'runtime' }} - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: build-size-iOS-${{ env.UNITY_VERSION }} - path: build-size-measurements/*.json - retention-days: 1 diff --git a/docs/agent-guides/ci.md b/docs/agent-guides/ci.md index 09e5e6ad2..0e23c388d 100644 --- a/docs/agent-guides/ci.md +++ b/docs/agent-guides/ci.md @@ -45,5 +45,5 @@ Exact Unity editor versions and changesets live in `scripts/unity-versions.json` | Native SDKs | `sdk.yml` | | Integration project creation | `test-create.yml` | | Android build/run | `test-build-android.yml`, `test-run-android.yml` | -| iOS build/compile/run | `test-build-ios.yml`, `test-compile-ios.yml`, `test-run-ios.yml` | +| iOS build/compile/run | `test-build-ios.yml`, `test-compile-ios.yml`, `test-build-size-ios.yml`, `test-run-ios.yml` | | Release preparation | `release.yml` | diff --git a/modules/app-runner b/modules/app-runner index 636c432b9..07fa3b736 160000 --- a/modules/app-runner +++ b/modules/app-runner @@ -1 +1 @@ -Subproject commit 636c432b90225a5f5460bbad75f6ea0a067eafeb +Subproject commit 07fa3b73615840778c93399ebc54b0940b3d4791