From 353b7361c5f3d3baf911480c4470d70363827e9f Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Wed, 13 Aug 2025 14:39:48 -0300 Subject: [PATCH 01/23] ci: Reduce number of variants built on PRs --- .github/workflows/release.yml | 106 +++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 48 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index be6a62e442e..a9254669293 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,9 +48,59 @@ concurrency: cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: + setup-matrix: + runs-on: ubuntu-latest + steps: + - name: Setup matrix combinations + id: setup-matrix-combinations + run: | + if [ "$EVENT_NAME" = "pull_request" ]; then + SLICES_COMBINATIONS=' + [ + { "name": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic" }, + { "name": "Sentry", "macho-type": "staticlib", "id": "sentry-static" } + ] + ' + VARIANTS_COMBINATIONS=' + [ + { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "override-name": "Sentry-Dynamic-WithARM64e" }, + { "scheme": "Sentry", "macho-type": "staticlib", "id": "sentry-static" } + ] + ' + else + SLICES_COMBINATIONS=' + [ + { "name": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic" }, + { "name": "Sentry", "macho-type": "staticlib", "id": "sentry-static" }, + { "name": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui" }, + { "name": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic" } + ] + ' + VARIANTS_COMBINATIONS=' + [ + { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "excluded-archs": "arm64e" }, + { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "override-name": "Sentry-Dynamic-WithARM64e" }, + { "scheme": "Sentry", "macho-type": "staticlib", "id": "sentry-static" }, + { "scheme": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui" }, + { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic", "excluded-archs": "arm64e" }, + { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic", "override-name": "Sentry-WithoutUIKitOrAppKit-WithARM64e" } + ] + ' + fi + + + echo ::set-output name=slices::{\"include\":[$SLICES_COMBINATIONS]} + echo ::set-output name=variants::{\"include\":[$VARIANTS_COMBINATIONS]} + env: + EVENT_NAME: ${{ github.event_name }} + outputs: + slices: ${{ steps.setup-matrix-combinations.outputs.slices }} + variants: ${{ steps.setup-matrix-combinations.outputs.variants }} + build-xcframework-variant-slices: name: Build XCFramework Slices uses: ./.github/workflows/build-xcframework-variant-slices.yml + needs: setup-matrix with: name: ${{matrix.variant.name}} suffix: ${{matrix.variant.suffix}} @@ -58,27 +108,16 @@ jobs: configuration-suffix: ${{matrix.variant.configuration-suffix}} variant-id: ${{matrix.variant.id}} release-version: ${{ github.event.inputs.version }} + # Build only selected platforms on PRs, but all for main / release. + sdk-list: ${{ github.event_name == 'pull_request' && '["iphoneos", "macosx"]' || null }} strategy: - matrix: - variant: - - name: Sentry - macho-type: mh_dylib - suffix: "-Dynamic" - id: sentry-dynamic - - name: Sentry - macho-type: staticlib - id: sentry-static - - name: SentrySwiftUI - macho-type: mh_dylib - id: sentry-swiftui - - name: Sentry - macho-type: mh_dylib - suffix: "-WithoutUIKitOrAppKit" - configuration-suffix: WithoutUIKit - id: sentry-withoutuikit-dynamic + matrix: ${{ fromJson(needs.setup-matrix.outputs.slices) }} assemble-xcframework-variant: - needs: build-xcframework-variant-slices + needs: [ + "build-xcframework-variant-slices", + "setup-matrix", + ] name: Assemble XCFramework Variant uses: ./.github/workflows/assemble-xcframework-variant.yml secrets: inherit @@ -92,36 +131,7 @@ jobs: excluded-archs: ${{matrix.variant.excluded-archs}} override-name: ${{matrix.variant.override-name}} strategy: - matrix: - variant: - - scheme: Sentry - macho-type: mh_dylib - suffix: "-Dynamic" - id: sentry-dynamic - excluded-archs: arm64e - - scheme: Sentry - macho-type: mh_dylib - suffix: "-Dynamic" - id: sentry-dynamic - override-name: Sentry-Dynamic-WithARM64e - - scheme: Sentry - macho-type: staticlib - id: sentry-static - - scheme: SentrySwiftUI - macho-type: mh_dylib - id: sentry-swiftui - - scheme: Sentry - macho-type: mh_dylib - suffix: "-WithoutUIKitOrAppKit" - configuration-suffix: WithoutUIKit - id: sentry-withoutuikit-dynamic - excluded-archs: arm64e - - scheme: Sentry - macho-type: mh_dylib - suffix: "-WithoutUIKitOrAppKit" - configuration-suffix: WithoutUIKit - id: sentry-withoutuikit-dynamic - override-name: Sentry-WithoutUIKitOrAppKit-WithARM64e + matrix: ${{ fromJson(needs.setup-matrix.outputs.variants) }} validate-xcframework: name: Validate XCFramework From 9762085a2d380161d7d7120742454b361faa4bf6 Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Wed, 13 Aug 2025 14:51:45 -0300 Subject: [PATCH 02/23] Use env variable for github output --- .github/workflows/release.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a9254669293..925b16af952 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -88,9 +88,10 @@ jobs: ' fi + echo "SLICES_COMBINATIONS=$SLICES_COMBINATIONS" - echo ::set-output name=slices::{\"include\":[$SLICES_COMBINATIONS]} - echo ::set-output name=variants::{\"include\":[$VARIANTS_COMBINATIONS]} + echo "slices=$SLICES_COMBINATIONS" >> $GITHUB_OUTPUT + echo "variants=$VARIANTS_COMBINATIONS" >> $GITHUB_OUTPUT env: EVENT_NAME: ${{ github.event_name }} outputs: @@ -111,7 +112,8 @@ jobs: # Build only selected platforms on PRs, but all for main / release. sdk-list: ${{ github.event_name == 'pull_request' && '["iphoneos", "macosx"]' || null }} strategy: - matrix: ${{ fromJson(needs.setup-matrix.outputs.slices) }} + matrix: + variant: ${{ fromJson(needs.setup-matrix.outputs.slices) }} assemble-xcframework-variant: needs: [ @@ -131,7 +133,8 @@ jobs: excluded-archs: ${{matrix.variant.excluded-archs}} override-name: ${{matrix.variant.override-name}} strategy: - matrix: ${{ fromJson(needs.setup-matrix.outputs.variants) }} + matrix: + variant: ${{ fromJson(needs.setup-matrix.outputs.variants) }} validate-xcframework: name: Validate XCFramework From d5b9ce92f8993ec03ca26fd6885cc38308e18a95 Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Wed, 13 Aug 2025 14:54:18 -0300 Subject: [PATCH 03/23] Use echo --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 925b16af952..650c0388c85 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -90,8 +90,8 @@ jobs: echo "SLICES_COMBINATIONS=$SLICES_COMBINATIONS" - echo "slices=$SLICES_COMBINATIONS" >> $GITHUB_OUTPUT - echo "variants=$VARIANTS_COMBINATIONS" >> $GITHUB_OUTPUT + echo "slices=$( echo "$SLICES_COMBINATIONS" )" >> $GITHUB_OUTPUT + echo "variants=$( echo "$VARIANTS_COMBINATIONS" )" >> $GITHUB_OUTPUT env: EVENT_NAME: ${{ github.event_name }} outputs: From 07de0507a3c7f4247a5fbb22893c768d4c590060 Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Wed, 13 Aug 2025 15:10:59 -0300 Subject: [PATCH 04/23] Move script to a file --- .github/workflows/release.yml | 39 +-------------------------- scripts/generate_release_matrix.sh | 42 ++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 38 deletions(-) create mode 100644 scripts/generate_release_matrix.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 650c0388c85..a5cb5173ccd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,44 +54,7 @@ jobs: - name: Setup matrix combinations id: setup-matrix-combinations run: | - if [ "$EVENT_NAME" = "pull_request" ]; then - SLICES_COMBINATIONS=' - [ - { "name": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic" }, - { "name": "Sentry", "macho-type": "staticlib", "id": "sentry-static" } - ] - ' - VARIANTS_COMBINATIONS=' - [ - { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "override-name": "Sentry-Dynamic-WithARM64e" }, - { "scheme": "Sentry", "macho-type": "staticlib", "id": "sentry-static" } - ] - ' - else - SLICES_COMBINATIONS=' - [ - { "name": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic" }, - { "name": "Sentry", "macho-type": "staticlib", "id": "sentry-static" }, - { "name": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui" }, - { "name": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic" } - ] - ' - VARIANTS_COMBINATIONS=' - [ - { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "excluded-archs": "arm64e" }, - { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "override-name": "Sentry-Dynamic-WithARM64e" }, - { "scheme": "Sentry", "macho-type": "staticlib", "id": "sentry-static" }, - { "scheme": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui" }, - { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic", "excluded-archs": "arm64e" }, - { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic", "override-name": "Sentry-WithoutUIKitOrAppKit-WithARM64e" } - ] - ' - fi - - echo "SLICES_COMBINATIONS=$SLICES_COMBINATIONS" - - echo "slices=$( echo "$SLICES_COMBINATIONS" )" >> $GITHUB_OUTPUT - echo "variants=$( echo "$VARIANTS_COMBINATIONS" )" >> $GITHUB_OUTPUT + ./scripts/generate_release_matrix.sh env: EVENT_NAME: ${{ github.event_name }} outputs: diff --git a/scripts/generate_release_matrix.sh b/scripts/generate_release_matrix.sh new file mode 100644 index 00000000000..97ac301e9e2 --- /dev/null +++ b/scripts/generate_release_matrix.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# This script is used to generate the matrix combinations for the release workflow. + +if [ "$EVENT_NAME" = "pull_request" ]; then + SLICES_COMBINATIONS=' + [ + { "name": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic" }, + { "name": "Sentry", "macho-type": "staticlib", "id": "sentry-static" } + ] + ' + VARIANTS_COMBINATIONS=' + [ + { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "override-name": "Sentry-Dynamic-WithARM64e" }, + { "scheme": "Sentry", "macho-type": "staticlib", "id": "sentry-static" } + ] + ' +else + SLICES_COMBINATIONS=' + [ + { "name": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic" }, + { "name": "Sentry", "macho-type": "staticlib", "id": "sentry-static" }, + { "name": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui" }, + { "name": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic" } + ] + ' + VARIANTS_COMBINATIONS=' + [ + { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "excluded-archs": "arm64e" }, + { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "override-name": "Sentry-Dynamic-WithARM64e" }, + { "scheme": "Sentry", "macho-type": "staticlib", "id": "sentry-static" }, + { "scheme": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui" }, + { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic", "excluded-archs": "arm64e" }, + { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic", "override-name": "Sentry-WithoutUIKitOrAppKit-WithARM64e" } + ] + ' +fi + +echo "SLICES_COMBINATIONS=$SLICES_COMBINATIONS" + +echo "slices=$( echo "$SLICES_COMBINATIONS" | jq -c . )" >> "$GITHUB_OUTPUT" +echo "variants=$( echo "$VARIANTS_COMBINATIONS" | jq -c . )" >> "$GITHUB_OUTPUT" From 951ec84637a09b8183b7ddd7911a434b15117a53 Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Wed, 13 Aug 2025 15:12:12 -0300 Subject: [PATCH 05/23] Checkout code --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a5cb5173ccd..c23d319f9db 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,6 +51,7 @@ jobs: setup-matrix: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 - name: Setup matrix combinations id: setup-matrix-combinations run: | From b548d33325aeccf0dd6f438e2656d2f1d7b4682b Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Wed, 13 Aug 2025 15:12:59 -0300 Subject: [PATCH 06/23] Update file permissions --- scripts/generate_release_matrix.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/generate_release_matrix.sh diff --git a/scripts/generate_release_matrix.sh b/scripts/generate_release_matrix.sh old mode 100644 new mode 100755 From 11a2aecc2acb62761277f129bddae6238b9d4c4b Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Wed, 13 Aug 2025 15:25:18 -0300 Subject: [PATCH 07/23] Pass sdklist to assemble xcframework --- .github/workflows/release.yml | 6 ++++-- scripts/generate_release_matrix.sh | 12 ++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c23d319f9db..aa55588dc00 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,6 +61,8 @@ jobs: outputs: slices: ${{ steps.setup-matrix-combinations.outputs.slices }} variants: ${{ steps.setup-matrix-combinations.outputs.variants }} + sdk-list-array: ${{ steps.setup-matrix-combinations.outputs.sdk-list-array }} + sdk-list-string: ${{ steps.setup-matrix-combinations.outputs.sdk-list-string }} build-xcframework-variant-slices: name: Build XCFramework Slices @@ -73,8 +75,7 @@ jobs: configuration-suffix: ${{matrix.variant.configuration-suffix}} variant-id: ${{matrix.variant.id}} release-version: ${{ github.event.inputs.version }} - # Build only selected platforms on PRs, but all for main / release. - sdk-list: ${{ github.event_name == 'pull_request' && '["iphoneos", "macosx"]' || null }} + sdk-list: ${{ needs.setup-matrix.outputs.sdk-list-array }} strategy: matrix: variant: ${{ fromJson(needs.setup-matrix.outputs.slices) }} @@ -96,6 +97,7 @@ jobs: release-version: ${{ github.event.inputs.version }} excluded-archs: ${{matrix.variant.excluded-archs}} override-name: ${{matrix.variant.override-name}} + sdk-list: ${{ needs.setup-matrix.outputs.sdk-list-string }} strategy: matrix: variant: ${{ fromJson(needs.setup-matrix.outputs.variants) }} diff --git a/scripts/generate_release_matrix.sh b/scripts/generate_release_matrix.sh index 97ac301e9e2..ec1a87bfa62 100755 --- a/scripts/generate_release_matrix.sh +++ b/scripts/generate_release_matrix.sh @@ -15,6 +15,7 @@ if [ "$EVENT_NAME" = "pull_request" ]; then { "scheme": "Sentry", "macho-type": "staticlib", "id": "sentry-static" } ] ' + SDK_LIST='["iphoneos", "macosx"]' else SLICES_COMBINATIONS=' [ @@ -34,9 +35,12 @@ else { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic", "override-name": "Sentry-WithoutUIKitOrAppKit-WithARM64e" } ] ' + SDK_LIST='["iphoneos", "iphonesimulator", "macosx", "maccatalyst", "appletvos", "appletvsimulator", "watchos", "watchsimulator", "xros", "xrsimulator"]' fi -echo "SLICES_COMBINATIONS=$SLICES_COMBINATIONS" - -echo "slices=$( echo "$SLICES_COMBINATIONS" | jq -c . )" >> "$GITHUB_OUTPUT" -echo "variants=$( echo "$VARIANTS_COMBINATIONS" | jq -c . )" >> "$GITHUB_OUTPUT" +{ + echo "slices=$( echo "$SLICES_COMBINATIONS" | jq -c . )" + echo "variants=$( echo "$VARIANTS_COMBINATIONS" | jq -c . )" + echo "sdk-list-array=$( echo "$SDK_LIST" | jq -c . )" + echo "sdk-list-string=$( echo "$SDK_LIST" | jq -r 'join(",")' )" +} >> "$GITHUB_OUTPUT" From dfd888da12421ee9e78ff1d04c1344e90d501c0f Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Wed, 13 Aug 2025 15:26:36 -0300 Subject: [PATCH 08/23] Add script to release.yml trigger --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aa55588dc00..2cdd56ddb3a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,6 +11,7 @@ on: - "Sources/**" - "scripts/ci-select-xcode.sh" - "scripts/ci-diagnostics.sh" + - "scripts/generate_release_matrix.sh" - Sentry.xcworkspace/** - Sentry.xcodeproj/** - "Package*.swift" From 2013bf1e37610e399fe14cf59473342bd662d881 Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Wed, 13 Aug 2025 15:29:45 -0300 Subject: [PATCH 09/23] Fix variable name --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2cdd56ddb3a..ca07f20e970 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -98,7 +98,7 @@ jobs: release-version: ${{ github.event.inputs.version }} excluded-archs: ${{matrix.variant.excluded-archs}} override-name: ${{matrix.variant.override-name}} - sdk-list: ${{ needs.setup-matrix.outputs.sdk-list-string }} + sdks: ${{ needs.setup-matrix.outputs.sdk-list-string }} strategy: matrix: variant: ${{ fromJson(needs.setup-matrix.outputs.variants) }} From 4f0eaf3ab87074ee30491ee681d513817f65f109 Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Wed, 13 Aug 2025 15:37:49 -0300 Subject: [PATCH 10/23] Build `Sentry-Dynamic` --- scripts/generate_release_matrix.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generate_release_matrix.sh b/scripts/generate_release_matrix.sh index ec1a87bfa62..0f9828d1bab 100755 --- a/scripts/generate_release_matrix.sh +++ b/scripts/generate_release_matrix.sh @@ -11,7 +11,7 @@ if [ "$EVENT_NAME" = "pull_request" ]; then ' VARIANTS_COMBINATIONS=' [ - { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "override-name": "Sentry-Dynamic-WithARM64e" }, + { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "excluded-archs": "arm64e" }, { "scheme": "Sentry", "macho-type": "staticlib", "id": "sentry-static" } ] ' From 2b8b2c6bdd0d9c60414ca1bb981ecae1f2dc3168 Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Wed, 13 Aug 2025 16:02:17 -0300 Subject: [PATCH 11/23] Add SentrySwiftUI to build list --- scripts/generate_release_matrix.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/generate_release_matrix.sh b/scripts/generate_release_matrix.sh index 0f9828d1bab..bd07bdba305 100755 --- a/scripts/generate_release_matrix.sh +++ b/scripts/generate_release_matrix.sh @@ -6,13 +6,15 @@ if [ "$EVENT_NAME" = "pull_request" ]; then SLICES_COMBINATIONS=' [ { "name": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic" }, - { "name": "Sentry", "macho-type": "staticlib", "id": "sentry-static" } + { "name": "Sentry", "macho-type": "staticlib", "id": "sentry-static" }, + { "name": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui" }, ] ' VARIANTS_COMBINATIONS=' [ { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "excluded-archs": "arm64e" }, - { "scheme": "Sentry", "macho-type": "staticlib", "id": "sentry-static" } + { "scheme": "Sentry", "macho-type": "staticlib", "id": "sentry-static" }, + { "scheme": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui" }, ] ' SDK_LIST='["iphoneos", "macosx"]' From 73d75a1f66501574931c548cf3901f959f676b53 Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Wed, 13 Aug 2025 16:03:01 -0300 Subject: [PATCH 12/23] Fix extra , --- scripts/generate_release_matrix.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/generate_release_matrix.sh b/scripts/generate_release_matrix.sh index bd07bdba305..37abdd4587d 100755 --- a/scripts/generate_release_matrix.sh +++ b/scripts/generate_release_matrix.sh @@ -7,14 +7,14 @@ if [ "$EVENT_NAME" = "pull_request" ]; then [ { "name": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic" }, { "name": "Sentry", "macho-type": "staticlib", "id": "sentry-static" }, - { "name": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui" }, + { "name": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui" } ] ' VARIANTS_COMBINATIONS=' [ { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "excluded-archs": "arm64e" }, { "scheme": "Sentry", "macho-type": "staticlib", "id": "sentry-static" }, - { "scheme": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui" }, + { "scheme": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui" } ] ' SDK_LIST='["iphoneos", "macosx"]' From 771218ee31c24fbb1f83f52f43211e5dd7741b63 Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Wed, 13 Aug 2025 16:56:20 -0300 Subject: [PATCH 13/23] Remove `Sentry-Dynamic-WithARM64e` from Package.swift for PR --- .../actions/prepare-package.swift/action.yml | 23 ++++++++++ .github/workflows/release.yml | 42 ++++++------------- 2 files changed, 35 insertions(+), 30 deletions(-) create mode 100644 .github/actions/prepare-package.swift/action.yml diff --git a/.github/actions/prepare-package.swift/action.yml b/.github/actions/prepare-package.swift/action.yml new file mode 100644 index 00000000000..ed430ae846c --- /dev/null +++ b/.github/actions/prepare-package.swift/action.yml @@ -0,0 +1,23 @@ +name: "Prepare Package.swift" +description: "Prepares Package.swift" +inputs: + is-pr: + description: "Whether the build is a PR" + required: true + default: "false" +runs: + using: "composite" + steps: + - name: Remove Sentry-Dynamic-WithARM64e target + if: ${{ inputs.is-pr == 'true' }} + shell: bash + run: | + sed -i '' '/Sentry-Dynamic-WithARM64e/d' Package.swift + sed -i '' '/^[[:space:]]*\.binaryTarget($/{N;/\n[[:space:]]*),$/d;}' Package.swift + - name: Change path of the framework + shell: bash + run: | + sed -i '' 's/url.*//g' Package.swift + sed -i '' 's/checksum: ".*" \/\/Sentry-Static/path: "Sentry.xcframework.zip"/g' Package.swift + sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic-WithARM64e/path: "Sentry-Dynamic-WithARM64e.xcframework.zip"/g' Package.swift + sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic/path: "Sentry-Dynamic.xcframework.zip"/g' Package.swift diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ca07f20e970..7c49a0016ec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -136,16 +136,10 @@ jobs: with: pattern: xcframework-${{github.sha}}-* merge-multiple: true - - name: Remove newer package files - if: ${{ matrix.package-file.name == 'Package.swift' }} - run: rm -rf Package@swift* - - name: Change path of the framework - run: | - sed -i '' 's/url.*//g' ${{matrix.package-file.name}} - sed -i '' 's/checksum: ".*" \/\/Sentry-Static/path: "Sentry.xcframework.zip"/g' ${{matrix.package-file.name}} - sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic-WithARM64e/path: "Sentry-Dynamic-WithARM64e.xcframework.zip"/g' ${{matrix.package-file.name}} - sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic/path: "Sentry-Dynamic.xcframework.zip"/g' ${{matrix.package-file.name}} - shell: bash + - name: Prepare Package.swift + uses: ./.github/actions/prepare-package.swift + with: + is-pr: ${{ github.event_name == 'pull_request' }} - run: swift build working-directory: Samples/macOS-SPM-CommandLine - name: Run CI Diagnostics @@ -167,16 +161,10 @@ jobs: with: pattern: xcframework-${{github.sha}}-* merge-multiple: true - - name: Remove newer package files - if: ${{ matrix.package-file.name == 'Package.swift' }} - run: rm -rf Package@swift* - - name: Change path of the framework - run: | - sed -i '' 's/url.*//g' ${{matrix.package-file.name}} - sed -i '' 's/checksum: ".*" \/\/Sentry-Static/path: "Sentry.xcframework.zip"/g' ${{matrix.package-file.name}} - sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic-WithARM64e/path: "Sentry-Dynamic-WithARM64e.xcframework.zip"/g' ${{matrix.package-file.name}} - sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic/path: "Sentry-Dynamic.xcframework.zip"/g' ${{matrix.package-file.name}} - shell: bash + - name: Prepare Package.swift + uses: ./.github/actions/prepare-package.swift + with: + is-pr: ${{ github.event_name == 'pull_request' }} - run: swift build working-directory: Samples/SPM-Dynamic - name: Run CI Diagnostics @@ -198,16 +186,10 @@ jobs: with: pattern: xcframework-${{github.sha}}-* merge-multiple: true - - name: Remove newer package files - if: ${{ matrix.package-file.name == 'Package.swift' }} - run: rm -rf Package@swift* - - name: Change path of the framework - run: | - sed -i '' 's/url.*//g' ${{matrix.package-file.name}} - sed -i '' 's/checksum: ".*" \/\/Sentry-Static/path: "Sentry.xcframework.zip"/g' ${{matrix.package-file.name}} - sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic-WithARM64e/path: "Sentry-Dynamic-WithARM64e.xcframework.zip"/g' ${{matrix.package-file.name}} - sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic/path: "Sentry-Dynamic.xcframework.zip"/g' ${{matrix.package-file.name}} - shell: bash + - name: Prepare Package.swift + uses: ./.github/actions/prepare-package.swift + with: + is-pr: ${{ github.event_name == 'pull_request' }} - run: swift build - name: Run CI Diagnostics if: failure() From d2c0d8a41bea08870190236e506be6885a21e4b5 Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Wed, 13 Aug 2025 17:05:36 -0300 Subject: [PATCH 14/23] Add `iphonesimulator` sdk to build list --- scripts/generate_release_matrix.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generate_release_matrix.sh b/scripts/generate_release_matrix.sh index 37abdd4587d..dd87b4c0284 100755 --- a/scripts/generate_release_matrix.sh +++ b/scripts/generate_release_matrix.sh @@ -17,7 +17,7 @@ if [ "$EVENT_NAME" = "pull_request" ]; then { "scheme": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui" } ] ' - SDK_LIST='["iphoneos", "macosx"]' + SDK_LIST='["iphoneos", "iphonesimulator", "macosx"]' else SLICES_COMBINATIONS=' [ From 74c98ec8998198dfa634d8f630c9e0df3b74de65 Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Thu, 14 Aug 2025 09:52:31 -0300 Subject: [PATCH 15/23] Add comment --- .github/actions/prepare-package.swift/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/prepare-package.swift/action.yml b/.github/actions/prepare-package.swift/action.yml index ed430ae846c..1124633d1e2 100644 --- a/.github/actions/prepare-package.swift/action.yml +++ b/.github/actions/prepare-package.swift/action.yml @@ -9,6 +9,7 @@ runs: using: "composite" steps: - name: Remove Sentry-Dynamic-WithARM64e target + # We don't build it on PRs, so we need to remove it from the package.swift file. if: ${{ inputs.is-pr == 'true' }} shell: bash run: | From 8fb92235fea29b2e39c343824be1af67bdb6ad26 Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Thu, 14 Aug 2025 10:38:28 -0300 Subject: [PATCH 16/23] Split slices and variant into base and additional arrays --- scripts/generate_release_matrix.sh | 115 +++++++++++++++++++---------- 1 file changed, 77 insertions(+), 38 deletions(-) diff --git a/scripts/generate_release_matrix.sh b/scripts/generate_release_matrix.sh index dd87b4c0284..f5671b0a9cb 100755 --- a/scripts/generate_release_matrix.sh +++ b/scripts/generate_release_matrix.sh @@ -2,47 +2,86 @@ # This script is used to generate the matrix combinations for the release workflow. +set -euo pipefail + +# Slices and Variants only needed on PRs +BASE_SLICES=( + '{"name": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic"}' + '{"name": "Sentry", "macho-type": "staticlib", "id": "sentry-static"}' + '{"name": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui"}' +) +BASE_VARIANTS=( + '{"scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "excluded-archs": "arm64e"}' + '{"scheme": "Sentry", "macho-type": "staticlib", "id": "sentry-static"}' + '{"scheme": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui"}' +) +BASE_SDKS=( + '"iphoneos"' + '"iphonesimulator"' + '"macosx"' +) + +# Slices and Variants only needed on main or release +ADDITIONAL_SLICES=( + '{"name": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic"}' +) +ADDITIONAL_VARIANTS=( + '{"scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "override-name": "Sentry-Dynamic-WithARM64e"}' + '{"scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic", "excluded-archs": "arm64e"}' + '{"scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic", "override-name": "Sentry-WithoutUIKitOrAppKit-WithARM64e"}' +) +ADDITIONAL_SDKS=( + '"maccatalyst"' + '"appletvos"' + '"appletvsimulator"' + '"watchos"' + '"watchsimulator"' + '"xros"' + '"xrsimulator"' +) + +build_json_array() { + local array_name=$1 + local result="[" + local first=true + + # Get the array elements using indirect expansion + local array_values + eval "array_values=(\"\${${array_name}[@]}\")" + + for item in "${array_values[@]}"; do + if [ "$first" = true ]; then + first=false + else + result+="," + fi + result+="$item" + done + + result+="]" + echo "$result" +} + if [ "$EVENT_NAME" = "pull_request" ]; then - SLICES_COMBINATIONS=' - [ - { "name": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic" }, - { "name": "Sentry", "macho-type": "staticlib", "id": "sentry-static" }, - { "name": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui" } - ] - ' - VARIANTS_COMBINATIONS=' - [ - { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "excluded-archs": "arm64e" }, - { "scheme": "Sentry", "macho-type": "staticlib", "id": "sentry-static" }, - { "scheme": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui" } - ] - ' - SDK_LIST='["iphoneos", "iphonesimulator", "macosx"]' + SLICES_COMBINATIONS=$(build_json_array BASE_SLICES) + VARIANTS_COMBINATIONS=$(build_json_array BASE_VARIANTS) + SDK_LIST=$(build_json_array BASE_SDKS) else - SLICES_COMBINATIONS=' - [ - { "name": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic" }, - { "name": "Sentry", "macho-type": "staticlib", "id": "sentry-static" }, - { "name": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui" }, - { "name": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic" } - ] - ' - VARIANTS_COMBINATIONS=' - [ - { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "excluded-archs": "arm64e" }, - { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "override-name": "Sentry-Dynamic-WithARM64e" }, - { "scheme": "Sentry", "macho-type": "staticlib", "id": "sentry-static" }, - { "scheme": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui" }, - { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic", "excluded-archs": "arm64e" }, - { "scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic", "override-name": "Sentry-WithoutUIKitOrAppKit-WithARM64e" } - ] - ' - SDK_LIST='["iphoneos", "iphonesimulator", "macosx", "maccatalyst", "appletvos", "appletvsimulator", "watchos", "watchsimulator", "xros", "xrsimulator"]' + # shellcheck disable=SC2034 + ALL_SLICES=("${BASE_SLICES[@]}" "${ADDITIONAL_SLICES[@]}") + # shellcheck disable=SC2034 + ALL_VARIANTS=("${BASE_VARIANTS[@]}" "${ADDITIONAL_VARIANTS[@]}") + # shellcheck disable=SC2034 + ALL_SDKS=("${BASE_SDKS[@]}" "${ADDITIONAL_SDKS[@]}") + + SLICES_COMBINATIONS=$(build_json_array ALL_SLICES) + VARIANTS_COMBINATIONS=$(build_json_array ALL_VARIANTS) + SDK_LIST=$(build_json_array ALL_SDKS) fi { - echo "slices=$( echo "$SLICES_COMBINATIONS" | jq -c . )" - echo "variants=$( echo "$VARIANTS_COMBINATIONS" | jq -c . )" - echo "sdk-list-array=$( echo "$SDK_LIST" | jq -c . )" - echo "sdk-list-string=$( echo "$SDK_LIST" | jq -r 'join(",")' )" + echo "slices=$SLICES_COMBINATIONS" + echo "variants=$VARIANTS_COMBINATIONS" + echo "sdk-list-array=$SDK_LIST" + echo "sdk-list-string=$(echo "$SDK_LIST" | jq -r 'join(",")')" } >> "$GITHUB_OUTPUT" From ab1f079421d5b8fc3a00ad53c51c9e16c2ace6d2 Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Fri, 15 Aug 2025 11:17:25 -0300 Subject: [PATCH 17/23] Add package file input to prepare-package action --- .../actions/prepare-package.swift/action.yml | 20 +++++++++++++------ .github/workflows/release.yml | 3 +++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/actions/prepare-package.swift/action.yml b/.github/actions/prepare-package.swift/action.yml index 1124633d1e2..3d0f0c4da20 100644 --- a/.github/actions/prepare-package.swift/action.yml +++ b/.github/actions/prepare-package.swift/action.yml @@ -5,6 +5,10 @@ inputs: description: "Whether the build is a PR" required: true default: "false" + package-file: + description: "The package file to prepare" + required: true + default: "Package.swift" runs: using: "composite" steps: @@ -12,13 +16,17 @@ runs: # We don't build it on PRs, so we need to remove it from the package.swift file. if: ${{ inputs.is-pr == 'true' }} shell: bash + env: + PACKAGE_FILE: ${{ inputs.package-file }} run: | - sed -i '' '/Sentry-Dynamic-WithARM64e/d' Package.swift - sed -i '' '/^[[:space:]]*\.binaryTarget($/{N;/\n[[:space:]]*),$/d;}' Package.swift + sed -i '' '/Sentry-Dynamic-WithARM64e/d' $PACKAGE_FILE + sed -i '' '/^[[:space:]]*\.binaryTarget($/{N;/\n[[:space:]]*),$/d;}' $PACKAGE_FILE - name: Change path of the framework shell: bash + env: + PACKAGE_FILE: ${{ inputs.package-file }} run: | - sed -i '' 's/url.*//g' Package.swift - sed -i '' 's/checksum: ".*" \/\/Sentry-Static/path: "Sentry.xcframework.zip"/g' Package.swift - sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic-WithARM64e/path: "Sentry-Dynamic-WithARM64e.xcframework.zip"/g' Package.swift - sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic/path: "Sentry-Dynamic.xcframework.zip"/g' Package.swift + sed -i '' 's/url.*//g' $PACKAGE_FILE + sed -i '' 's/checksum: ".*" \/\/Sentry-Static/path: "Sentry.xcframework.zip"/g' $PACKAGE_FILE + sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic-WithARM64e/path: "Sentry-Dynamic-WithARM64e.xcframework.zip"/g' $PACKAGE_FILE + sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic/path: "Sentry-Dynamic.xcframework.zip"/g' $PACKAGE_FILE diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7c49a0016ec..45024d5e99c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -140,6 +140,7 @@ jobs: uses: ./.github/actions/prepare-package.swift with: is-pr: ${{ github.event_name == 'pull_request' }} + package-file: ${{matrix.package-file.name}} - run: swift build working-directory: Samples/macOS-SPM-CommandLine - name: Run CI Diagnostics @@ -165,6 +166,7 @@ jobs: uses: ./.github/actions/prepare-package.swift with: is-pr: ${{ github.event_name == 'pull_request' }} + package-file: ${{matrix.package-file.name}} - run: swift build working-directory: Samples/SPM-Dynamic - name: Run CI Diagnostics @@ -190,6 +192,7 @@ jobs: uses: ./.github/actions/prepare-package.swift with: is-pr: ${{ github.event_name == 'pull_request' }} + package-file: ${{matrix.package-file.name}} - run: swift build - name: Run CI Diagnostics if: failure() From b4e023d034a81ce4c60d302335ed5f38e69c5954 Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Fri, 15 Aug 2025 11:23:22 -0300 Subject: [PATCH 18/23] Add step to remove newer package files in prepare-package action --- .github/actions/prepare-package.swift/action.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/actions/prepare-package.swift/action.yml b/.github/actions/prepare-package.swift/action.yml index 3d0f0c4da20..4943b46b370 100644 --- a/.github/actions/prepare-package.swift/action.yml +++ b/.github/actions/prepare-package.swift/action.yml @@ -12,6 +12,11 @@ inputs: runs: using: "composite" steps: + - name: Remove newer package files + # Remove newer package files when processing Package.swift to prevent interference + if: ${{ inputs.package-file == 'Package.swift' }} + shell: bash + run: rm -rf Package@swift* - name: Remove Sentry-Dynamic-WithARM64e target # We don't build it on PRs, so we need to remove it from the package.swift file. if: ${{ inputs.is-pr == 'true' }} From 90039819f73d29798ff3aaa384a9f7d4ce161712 Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Fri, 15 Aug 2025 13:37:51 -0300 Subject: [PATCH 19/23] Add real devices sdks to variants built on PRs --- scripts/generate_release_matrix.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/generate_release_matrix.sh b/scripts/generate_release_matrix.sh index f5671b0a9cb..426f5026992 100755 --- a/scripts/generate_release_matrix.sh +++ b/scripts/generate_release_matrix.sh @@ -19,6 +19,10 @@ BASE_SDKS=( '"iphoneos"' '"iphonesimulator"' '"macosx"' + '"maccatalyst"' + '"appletvos"' + '"watchos"' + '"xros"' ) # Slices and Variants only needed on main or release @@ -31,12 +35,8 @@ ADDITIONAL_VARIANTS=( '{"scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic", "override-name": "Sentry-WithoutUIKitOrAppKit-WithARM64e"}' ) ADDITIONAL_SDKS=( - '"maccatalyst"' - '"appletvos"' '"appletvsimulator"' - '"watchos"' '"watchsimulator"' - '"xros"' '"xrsimulator"' ) From e7ea525bb45469e64cde59a7b6e081106ebbdfc2 Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Fri, 15 Aug 2025 14:41:25 -0300 Subject: [PATCH 20/23] Build WithoutUIKitOrAppKit on PRs --- scripts/generate_release_matrix.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generate_release_matrix.sh b/scripts/generate_release_matrix.sh index 426f5026992..c00cf2ec168 100755 --- a/scripts/generate_release_matrix.sh +++ b/scripts/generate_release_matrix.sh @@ -14,6 +14,7 @@ BASE_VARIANTS=( '{"scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "excluded-archs": "arm64e"}' '{"scheme": "Sentry", "macho-type": "staticlib", "id": "sentry-static"}' '{"scheme": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui"}' + '{"scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic", "excluded-archs": "arm64e"}' ) BASE_SDKS=( '"iphoneos"' @@ -31,7 +32,6 @@ ADDITIONAL_SLICES=( ) ADDITIONAL_VARIANTS=( '{"scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "override-name": "Sentry-Dynamic-WithARM64e"}' - '{"scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic", "excluded-archs": "arm64e"}' '{"scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic", "override-name": "Sentry-WithoutUIKitOrAppKit-WithARM64e"}' ) ADDITIONAL_SDKS=( From bae2cd5c2e74dee3d06a53d66b34224b82bb9202 Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Tue, 26 Aug 2025 12:04:48 -0300 Subject: [PATCH 21/23] ci: Build all slices --- scripts/generate_release_matrix.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/generate_release_matrix.sh b/scripts/generate_release_matrix.sh index c00cf2ec168..ad7a898265a 100755 --- a/scripts/generate_release_matrix.sh +++ b/scripts/generate_release_matrix.sh @@ -9,6 +9,7 @@ BASE_SLICES=( '{"name": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic"}' '{"name": "Sentry", "macho-type": "staticlib", "id": "sentry-static"}' '{"name": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui"}' + '{"name": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic"}' ) BASE_VARIANTS=( '{"scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "excluded-archs": "arm64e"}' @@ -27,9 +28,6 @@ BASE_SDKS=( ) # Slices and Variants only needed on main or release -ADDITIONAL_SLICES=( - '{"name": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic"}' -) ADDITIONAL_VARIANTS=( '{"scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "override-name": "Sentry-Dynamic-WithARM64e"}' '{"scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic", "override-name": "Sentry-WithoutUIKitOrAppKit-WithARM64e"}' @@ -68,7 +66,7 @@ if [ "$EVENT_NAME" = "pull_request" ]; then SDK_LIST=$(build_json_array BASE_SDKS) else # shellcheck disable=SC2034 - ALL_SLICES=("${BASE_SLICES[@]}" "${ADDITIONAL_SLICES[@]}") + ALL_SLICES=("${BASE_SLICES[@]}") # shellcheck disable=SC2034 ALL_VARIANTS=("${BASE_VARIANTS[@]}" "${ADDITIONAL_VARIANTS[@]}") # shellcheck disable=SC2034 From 74d38329ba795709d93eb3538dafe4c4ba7f97b4 Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Thu, 28 Aug 2025 11:11:58 -0300 Subject: [PATCH 22/23] Update file filters --- .github/file-filters.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/file-filters.yml b/.github/file-filters.yml index e16a187e933..112436b0c28 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -115,6 +115,7 @@ run_release_for_prs: &run_release_for_prs # Release-related code - "scripts/ci-diagnostics.sh" - "scripts/build-xcframework-slice.sh" - "scripts/assemble-xcframework.sh" + - "scripts/generate_release_matrix.sh" # Project files - "Sentry.xcworkspace/**" From 43c05848d3c4df5dea6257cbe08ec576fedd4e9f Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Thu, 28 Aug 2025 11:44:05 -0300 Subject: [PATCH 23/23] Use JSON and jq to make script easier to read --- scripts/generate_release_matrix.sh | 110 +++++++++++------------------ 1 file changed, 41 insertions(+), 69 deletions(-) diff --git a/scripts/generate_release_matrix.sh b/scripts/generate_release_matrix.sh index ad7a898265a..46dddf95bdc 100755 --- a/scripts/generate_release_matrix.sh +++ b/scripts/generate_release_matrix.sh @@ -1,85 +1,57 @@ #!/bin/bash # This script is used to generate the matrix combinations for the release workflow. +# Rewritten to use jq as much as possible for maintainability. set -euo pipefail # Slices and Variants only needed on PRs -BASE_SLICES=( - '{"name": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic"}' - '{"name": "Sentry", "macho-type": "staticlib", "id": "sentry-static"}' - '{"name": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui"}' - '{"name": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic"}' -) -BASE_VARIANTS=( - '{"scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "excluded-archs": "arm64e"}' - '{"scheme": "Sentry", "macho-type": "staticlib", "id": "sentry-static"}' - '{"scheme": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui"}' - '{"scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic", "excluded-archs": "arm64e"}' -) -BASE_SDKS=( - '"iphoneos"' - '"iphonesimulator"' - '"macosx"' - '"maccatalyst"' - '"appletvos"' - '"watchos"' - '"xros"' -) +BASE_SLICES_JSON='[ + {"name": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic"}, + {"name": "Sentry", "macho-type": "staticlib", "id": "sentry-static"}, + {"name": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui"}, + {"name": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic"} +]' +BASE_VARIANTS_JSON='[ + {"scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "excluded-archs": "arm64e"}, + {"scheme": "Sentry", "macho-type": "staticlib", "id": "sentry-static"}, + {"scheme": "SentrySwiftUI", "macho-type": "mh_dylib", "id": "sentry-swiftui"}, + {"scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic", "excluded-archs": "arm64e"} +]' +BASE_SDKS_JSON='[ + "iphoneos", + "iphonesimulator", + "macosx", + "maccatalyst", + "appletvos", + "watchos", + "xros" +]' # Slices and Variants only needed on main or release -ADDITIONAL_VARIANTS=( - '{"scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "override-name": "Sentry-Dynamic-WithARM64e"}' - '{"scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic", "override-name": "Sentry-WithoutUIKitOrAppKit-WithARM64e"}' -) -ADDITIONAL_SDKS=( - '"appletvsimulator"' - '"watchsimulator"' - '"xrsimulator"' -) - -build_json_array() { - local array_name=$1 - local result="[" - local first=true - - # Get the array elements using indirect expansion - local array_values - eval "array_values=(\"\${${array_name}[@]}\")" - - for item in "${array_values[@]}"; do - if [ "$first" = true ]; then - first=false - else - result+="," - fi - result+="$item" - done - - result+="]" - echo "$result" -} +ADDITIONAL_VARIANTS_JSON='[ + {"scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-Dynamic", "id": "sentry-dynamic", "override-name": "Sentry-Dynamic-WithARM64e"}, + {"scheme": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic", "override-name": "Sentry-WithoutUIKitOrAppKit-WithARM64e"} +]' +ADDITIONAL_SDKS_JSON='[ + "appletvsimulator", + "watchsimulator", + "xrsimulator" +]' if [ "$EVENT_NAME" = "pull_request" ]; then - SLICES_COMBINATIONS=$(build_json_array BASE_SLICES) - VARIANTS_COMBINATIONS=$(build_json_array BASE_VARIANTS) - SDK_LIST=$(build_json_array BASE_SDKS) + SLICES_COMBINATIONS="$BASE_SLICES_JSON" + VARIANTS_COMBINATIONS="$BASE_VARIANTS_JSON" + SDK_LIST="$BASE_SDKS_JSON" else - # shellcheck disable=SC2034 - ALL_SLICES=("${BASE_SLICES[@]}") - # shellcheck disable=SC2034 - ALL_VARIANTS=("${BASE_VARIANTS[@]}" "${ADDITIONAL_VARIANTS[@]}") - # shellcheck disable=SC2034 - ALL_SDKS=("${BASE_SDKS[@]}" "${ADDITIONAL_SDKS[@]}") - - SLICES_COMBINATIONS=$(build_json_array ALL_SLICES) - VARIANTS_COMBINATIONS=$(build_json_array ALL_VARIANTS) - SDK_LIST=$(build_json_array ALL_SDKS) + SLICES_COMBINATIONS="$BASE_SLICES_JSON" + VARIANTS_COMBINATIONS=$(jq -c -s '.[0] + .[1]' <(echo "$BASE_VARIANTS_JSON") <(echo "$ADDITIONAL_VARIANTS_JSON")) + SDK_LIST=$(jq -c -s '.[0] + .[1]' <(echo "$BASE_SDKS_JSON") <(echo "$ADDITIONAL_SDKS_JSON")) fi { - echo "slices=$SLICES_COMBINATIONS" - echo "variants=$VARIANTS_COMBINATIONS" - echo "sdk-list-array=$SDK_LIST" + echo "slices=$(echo "$SLICES_COMBINATIONS" | jq -c '.')" + echo "variants=$(echo "$VARIANTS_COMBINATIONS" | jq -c '.')" + echo "sdk-list-array=$(echo "$SDK_LIST" | jq -c '.')" echo "sdk-list-string=$(echo "$SDK_LIST" | jq -r 'join(",")')" -} >> "$GITHUB_OUTPUT" +} >> "$GITHUB_OUTPUT"