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
29 changes: 28 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,19 @@ jobs:
with:
unity-version: ${{ matrix.unity-version }}

test-build-macos:
name: Build macOS ${{ matrix.unity-version }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [test-create, create-unity-matrix]
secrets: inherit
strategy:
fail-fast: false
matrix:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
uses: ./.github/workflows/test-build-macos.yml
with:
unity-version: ${{ matrix.unity-version }}

test-run-linux:
name: Run Linux ${{ matrix.unity-version }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
Expand Down Expand Up @@ -407,11 +420,25 @@ jobs:
unity-version: ${{ matrix.unity-version }}
platform: windows

test-run-macos:
name: Run macOS ${{ matrix.unity-version }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [test-build-macos, create-unity-matrix]
secrets: inherit
strategy:
fail-fast: false
matrix:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
uses: ./.github/workflows/test-run-desktop.yml
with:
unity-version: ${{ matrix.unity-version }}
platform: macos

build-size-summary:
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]
needs: [test-build-webgl, test-build-android, test-compile-ios, test-build-linux, test-build-windows, test-build-macos]
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand Down
125 changes: 125 additions & 0 deletions .github/workflows/test-build-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: "Test: Build macOS"
on:
workflow_call:
inputs:
unity-version:
required: true
type: string

defaults:
run:
shell: pwsh

jobs:
build:
name: macOS ${{ inputs.unity-version }}
runs-on: macos-latest
env:
UNITY_VERSION: ${{ inputs.unity-version }}
BUILD_PLATFORM: MacOS

steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Load env
id: env
run: |
echo "unityVersion=$(./scripts/ci-env.ps1 "unity$env:UNITY_VERSION")" >> $env:GITHUB_OUTPUT
echo "unityChangeset=$(./scripts/ci-env.ps1 "unity$env:UNITY_VERSION-changeset")" >> $env:GITHUB_OUTPUT

- name: Setup Unity
uses: getsentry/setup-unity@1bbd385ae3b0505069aacc56d47f0a16366f10b1
with:
unity-version: ${{ steps.env.outputs.unityVersion }}
unity-version-changeset: ${{ steps.env.outputs.unityChangeset }}
unity-modules: mac-il2cpp

- name: Create Unity license config
run: |
sudo mkdir -p "/Library/Application Support/Unity/config"
echo "$env:UNITY_LICENSE_SERVER_CONFIG" | sudo tee "/Library/Application Support/Unity/config/services-config.json" > /dev/null
env:
UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}

- name: Download IntegrationTest project
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: test-${{ env.UNITY_VERSION }}

- name: Extract project archive
run: tar -xvzf test-project.tar.gz

- name: Cache Unity Library
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: samples/IntegrationTest/Library
key: Library-IntegrationTest-macos-${{ env.UNITY_VERSION }}-v1
restore-keys: |
Library-IntegrationTest-macos-${{ env.UNITY_VERSION }}-
Library-IntegrationTest-macos-

- name: Restore cached build without Sentry
id: cache-build-nosentry
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: samples/IntegrationTest/Build-NoSentry
key: build-nosentry-MacOS-${{ inputs.unity-version }}

- name: Build without Sentry SDK
if: steps.cache-build-nosentry.outputs.cache-hit != 'true'
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform MacOS -BuildDirName "Build-NoSentry"

- name: Download UPM package
uses: ./.github/actions/wait-for-artifact
with:
name: package-release

- 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" -PackagePath "test-package-release"

- name: Configure Sentry
run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "$env:UNITY_PATH" -Platform MacOS
env:
SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }}

- name: Build with Sentry SDK
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform MacOS -UnityVersion "$env:UNITY_VERSION"

- name: Compare build sizes
run: ./test/Scripts.Integration.Test/measure-build-size.ps1 -Path1 "samples/IntegrationTest/Build-NoSentry" -Path2 "samples/IntegrationTest/Build" -Platform MacOS -UnityVersion "$env:UNITY_VERSION"

- name: Upload build size measurement
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: build-size-MacOS-${{ env.UNITY_VERSION }}
path: build-size-measurements/*.json
retention-days: 1

# We create tar explicitly because upload-artifact is slow for many files.
- name: Create archive
run: |
Remove-Item -Recurse -Force samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame -ErrorAction SilentlyContinue
tar -cvzf test-app-desktop.tar.gz samples/IntegrationTest/Build

- name: Upload test app
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: testapp-desktop-compiled-${{ env.UNITY_VERSION }}-macos
if-no-files-found: error
path: test-app-desktop.tar.gz
retention-days: 14

- name: Upload IntegrationTest project on failure
if: ${{ failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: failed-project-desktop-macos-${{ env.UNITY_VERSION }}
path: |
samples/IntegrationTest
unity.log
!samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame
retention-days: 14
7 changes: 5 additions & 2 deletions .github/workflows/test-build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ jobs:

- name: Load env
id: env
run: echo "unityVersion=$(./scripts/ci-env.ps1 "unity$env:UNITY_VERSION")" >> $env:GITHUB_OUTPUT
run: |
echo "unityVersion=$(./scripts/ci-env.ps1 "unity$env:UNITY_VERSION")" >> $env:GITHUB_OUTPUT
echo "unityChangeset=$(./scripts/ci-env.ps1 "unity$env:UNITY_VERSION-changeset")" >> $env:GITHUB_OUTPUT

- name: Setup Unity
uses: getsentry/setup-unity@3bdc8c022b6d30ecf2d21d12a564bfa55a54fa2e
uses: getsentry/setup-unity@1bbd385ae3b0505069aacc56d47f0a16366f10b1
with:
unity-version: ${{ steps.env.outputs.unityVersion }}
unity-version-changeset: ${{ steps.env.outputs.unityChangeset }}
unity-modules: windows-il2cpp

- name: Create Unity license config
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/test-run-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
platform:
required: true
type: string
description: "linux or windows"
description: "linux, windows, or macos"

defaults:
run:
Expand All @@ -17,7 +17,7 @@ defaults:
jobs:
run:
name: ${{ inputs.platform }} ${{ inputs.unity-version }}
runs-on: ${{ inputs.platform == 'linux' && 'ubuntu-latest' || 'windows-latest' }}
runs-on: ${{ inputs.platform == 'linux' && 'ubuntu-latest' || inputs.platform == 'macos' && 'macos-latest' || 'windows-latest' }}
env:
SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
Expand All @@ -43,6 +43,11 @@ jobs:
run: chmod +x samples/IntegrationTest/Build/test
shell: bash

- name: Set executable permission (macOS)
if: inputs.platform == 'macos'
run: chmod +x samples/IntegrationTest/Build/test.app/Contents/MacOS/IntegrationTest
shell: bash

- name: Run Integration Tests (Linux)
if: inputs.platform == 'linux'
timeout-minutes: 20
Expand All @@ -53,6 +58,14 @@ jobs:
Invoke-Pester -Path test/IntegrationTest/Integration.Tests.ps1 -CI'
shell: bash

- name: Run Integration Tests (macOS)
if: inputs.platform == 'macos'
timeout-minutes: 20
run: |
$env:SENTRY_TEST_PLATFORM = "Desktop"
$env:SENTRY_TEST_APP = "samples/IntegrationTest/Build/test.app/Contents/MacOS/IntegrationTest"
Invoke-Pester -Path test/IntegrationTest/Integration.Tests.ps1 -CI

- name: Run Integration Tests (Windows)
if: inputs.platform == 'windows'
timeout-minutes: 20
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/update-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,13 @@ jobs:
run: |
$file = "scripts/ci-env.ps1"
$regexVersion = '${{ matrix.unity-prefix }}' + "\.[0-9]+[a-z][0-9]+"
echo "Regex: $regexVersion"
(Get-Content $file) -replace $regexVersion, '${{ steps.version-select.outputs.version }}' | Out-File $file
$regexChangeset = '("unity${{ matrix.unity-prefix }}-changeset"\s*\{\s*return\s*")[a-f0-9]+(")'
echo "Version regex: $regexVersion"
echo "Changeset regex: $regexChangeset"
(Get-Content $file) `
-replace $regexVersion, '${{ steps.version-select.outputs.version }}' `
-replace $regexChangeset, '${1}${{ steps.version-select.outputs.changeset }}${2}' `
| Out-File $file

- run: git --no-pager diff

Expand Down
24 changes: 9 additions & 15 deletions scripts/ci-env.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,13 @@ param (
)

switch ($name) {
"unity2021.3" {
return "2021.3.45f2"
}
"unity2022.3" {
return "2022.3.62f3"
}
"unity6000.0" {
return "6000.0.74f1"
}
"unity6000.3" {
return "6000.3.14f1"
}
Default {
throw "Unkown variable '$name'"
}
"unity2021.3" { return "2021.3.45f2" }
"unity2021.3-changeset" { return "88f88f591b2e" }
"unity2022.3" { return "2022.3.62f3" }
"unity2022.3-changeset" { return "96770f904ca7" }
"unity6000.0" { return "6000.0.74f1" }
"unity6000.0-changeset" { return "7685f01dc6be" }
"unity6000.3" { return "6000.3.14f1" }
"unity6000.3-changeset" { return "d68c3f99a318" }
Default { throw "Unkown variable '$name'" }
}
Loading