diff --git a/.github/actions/environment/action.yml b/.github/actions/environment/action.yml index f839c143f2..cd0229929b 100644 --- a/.github/actions/environment/action.yml +++ b/.github/actions/environment/action.yml @@ -1,5 +1,12 @@ name: Setup Environment description: Sets env vars and installs dependencies + +inputs: + xcode-version: + description: 'Xcode version to select (e.g. "26.2").' + required: false + default: '' + runs: using: composite @@ -46,10 +53,16 @@ runs: # See https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md#xcode # Also https://github.com/dotnet/macios/issues/21762#issuecomment-3424033859 (don't reference symlinks) - name: Pin the Xcode Version - if: runner.os == 'macOS' + if: runner.os == 'macOS' && inputs.xcode-version == '' shell: bash run: sudo xcode-select --switch /Applications/Xcode_26.2.app + # Cirrus Runners offer different images with various versions of Xcode installed + - name: Pin the Xcode Version to ${{ inputs.xcode-version }} + if: runner.os == 'macOS' && inputs.xcode-version != '' + shell: bash + run: sudo xcode-select --switch /Applications/Xcode_${{ inputs.xcode-version }}.app + # Java 17 is needed for Android SDK setup step - name: Install Java 17 if: ${{ !matrix.container }} diff --git a/.github/workflows/device-tests-ios.yml b/.github/workflows/device-tests-ios.yml index c966f658ca..bb0674d21d 100644 --- a/.github/workflows/device-tests-ios.yml +++ b/.github/workflows/device-tests-ios.yml @@ -52,7 +52,18 @@ on: jobs: ios-tests: - runs-on: macos-15 + name: iOS Tests (${{ matrix.tfm }}) + strategy: + fail-fast: false + matrix: + include: + - tfm: net9.0 + xcode: "26.0.1" + runs-on: ["ghcr.io/cirruslabs/macos-tahoe-xcode:26.0.1,runner_concurrency_group=${{ github.run_id }}", "runner_group_id:10"] + - tfm: net10.0 + xcode: "26.2" + runs-on: ["ghcr.io/cirruslabs/macos-tahoe-xcode:26.2,runner_concurrency_group=${{ github.run_id }}", "runner_group_id:10"] + runs-on: ${{ matrix.runs-on }} env: DOTNET_CLI_TELEMETRY_OPTOUT: 1 DOTNET_NOLOGO: 1 @@ -70,41 +81,56 @@ jobs: - name: Setup Environment uses: ./.github/actions/environment + with: + xcode-version: ${{ matrix.xcode }} + + - name: Install PowerShell + run: | + which pwsh || (dotnet tool install --global PowerShell && echo "$HOME/.dotnet/tools" >> "$GITHUB_PATH") - name: Build iOS Test App - run: pwsh ./scripts/device-test.ps1 ios -Build + run: pwsh ./scripts/device-test.ps1 ios -Build -Tfm ${{ matrix.tfm }} - name: Run Tests id: first-test-run continue-on-error: true timeout-minutes: 40 - run: pwsh scripts/device-test.ps1 ios -Run -Verbose + run: pwsh scripts/device-test.ps1 ios -Run -Tfm ${{ matrix.tfm }} -Verbose - name: Retry Tests (if previous failed to run) if: steps.first-test-run.outcome == 'failure' timeout-minutes: 40 - run: pwsh scripts/device-test.ps1 ios -Run -Verbose + run: pwsh scripts/device-test.ps1 ios -Run -Tfm ${{ matrix.tfm }} -Verbose + + - name: Checkout github-workflows + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + repository: getsentry/github-workflows + ref: 747c4c2906d373f5cd809abe94a7fd732a2421a7 # 3.2.1 + path: modules/github-workflows + + - name: Install Pester + shell: pwsh + run: | + Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted + Install-Module -Name Pester -Scope CurrentUser - name: Run Integration Tests id: first-integration-test-run continue-on-error: true timeout-minutes: 40 - uses: getsentry/github-workflows/sentry-cli/integration-test@747c4c2906d373f5cd809abe94a7fd732a2421a7 # 3.2.1 - with: - path: integration-test/ios.Tests.ps1 + run: pwsh integration-test/ios.Tests.ps1 -dotnet_version ${{ matrix.tfm }} - name: Retry Integration Tests (if previous failed to run) if: steps.first-integration-test-run.outcome == 'failure' timeout-minutes: 40 - uses: getsentry/github-workflows/sentry-cli/integration-test@747c4c2906d373f5cd809abe94a7fd732a2421a7 # 3.2.1 - with: - path: integration-test/ios.Tests.ps1 + run: pwsh integration-test/ios.Tests.ps1 -dotnet_version ${{ matrix.tfm }} - name: Upload results if: success() || failure() uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 with: - name: device-test-ios-results + name: device-test-ios-results-${{ matrix.tfm }} path: | test_output integration-test/mobile-app/test_output diff --git a/Sentry.slnx b/Sentry.slnx index 102e5c66ab..f9d420e952 100644 --- a/Sentry.slnx +++ b/Sentry.slnx @@ -48,6 +48,7 @@ + diff --git a/integration-test/ios.Tests.ps1 b/integration-test/ios.Tests.ps1 index 3c38696f69..267698e32b 100644 --- a/integration-test/ios.Tests.ps1 +++ b/integration-test/ios.Tests.ps1 @@ -1,7 +1,12 @@ +param( + [string] $dotnet_version = "net10.0" +) + # This file contains test cases for https://pester.dev/ Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' . $PSScriptRoot/pester.ps1 +. $PSScriptRoot/common.ps1 . $PSScriptRoot/../scripts/device-test-utils.ps1 BeforeDiscovery { @@ -11,15 +16,17 @@ BeforeDiscovery { $script:simulator = Get-IosSimulatorUdid -PreferredStates @('Booted') } -Describe 'iOS app (, )' -ForEach @( - # Note: we can't run against net10 and net9 becaus .NET 10 requires Xcode 26.2 and .NET 9 requires Xcode 26.0. - # The macOS GitHub Actions runners only have Xcode 26.1+ installed and no support for Xcode 26.2 is planned for - # net9.0-ios: https://github.com/dotnet/macios/issues/24199#issuecomment-3819021247 - @{ tfm = "net10.0-ios26.2"; configuration = "Release" } - @{ tfm = "net10.0-ios26.2"; configuration = "Debug" } -) -Skip:(-not $script:simulator) { +$ios_tpv = switch ($dotnet_version) { + 'net9.0' { '26.0' } + default { '26.2' } +} +$cases = @( + @{ configuration = 'Release' } + @{ configuration = 'Debug' } +) +Describe 'iOS app (, )' -ForEach $cases -Skip:(-not $script:simulator) { BeforeAll { - . $PSScriptRoot/../scripts/device-test-utils.ps1 + $tfm = "$dotnet_version-ios$ios_tpv" Remove-Item -Path "$PSScriptRoot/mobile-app" -Recurse -Force -ErrorAction SilentlyContinue Copy-Item -Path "$PSScriptRoot/net9-maui" -Destination "$PSScriptRoot/mobile-app" -Recurse -Force diff --git a/integration-test/net9-maui/Sentry.Maui.Device.IntegrationTestApp.csproj b/integration-test/net9-maui/Sentry.Maui.Device.IntegrationTestApp.csproj index b609446eba..be72600abd 100644 --- a/integration-test/net9-maui/Sentry.Maui.Device.IntegrationTestApp.csproj +++ b/integration-test/net9-maui/Sentry.Maui.Device.IntegrationTestApp.csproj @@ -2,10 +2,11 @@ $(TargetFrameworks);net9.0-android35.0;net10.0-android36.0 - - $(TargetFrameworks);net10.0-ios26.2 + + $(TargetFrameworks);net10.0-ios26.2 + $(TargetFrameworks);net9.0-ios18.0;net10.0-ios26 Exe Sentry.Maui.Device.IntegrationTestApp @@ -34,7 +35,6 @@ 15.0 21.0 - diff --git a/test/Sentry.Maui.Device.TestApp/Sentry.Maui.Device.TestApp.csproj b/test/Sentry.Maui.Device.TestApp/Sentry.Maui.Device.TestApp.csproj index 64d296477a..8f6e0f83e1 100644 --- a/test/Sentry.Maui.Device.TestApp/Sentry.Maui.Device.TestApp.csproj +++ b/test/Sentry.Maui.Device.TestApp/Sentry.Maui.Device.TestApp.csproj @@ -2,11 +2,10 @@ $(TargetFrameworks);net9.0-android;net10.0-android - - $(TargetFrameworks);net10.0-ios + + $(TargetFrameworks);net10.0-ios + $(TargetFrameworks);net9.0-ios;net10.0-ios $(DefineConstants);VISUAL_RUNNER @@ -36,9 +35,11 @@ 15.0 21.0 - - 26.2 + + 26.0 + 26.2 true