Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
86 changes: 86 additions & 0 deletions .github/workflows/test-build-size-ios.yml
Original file line number Diff line number Diff line change
@@ -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
62 changes: 0 additions & 62 deletions .github/workflows/test-compile-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion docs/agent-guides/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |
Loading