Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
353b736
ci: Reduce number of variants built on PRs
itaybre Aug 13, 2025
9762085
Use env variable for github output
itaybre Aug 13, 2025
d5b9ce9
Use echo
itaybre Aug 13, 2025
07de050
Move script to a file
itaybre Aug 13, 2025
951ec84
Checkout code
itaybre Aug 13, 2025
b548d33
Update file permissions
itaybre Aug 13, 2025
11a2aec
Pass sdklist to assemble xcframework
itaybre Aug 13, 2025
dfd888d
Add script to release.yml trigger
itaybre Aug 13, 2025
2013bf1
Fix variable name
itaybre Aug 13, 2025
4f0eaf3
Build `Sentry-Dynamic`
itaybre Aug 13, 2025
2b8b2c6
Add SentrySwiftUI to build list
itaybre Aug 13, 2025
73d75a1
Fix extra ,
itaybre Aug 13, 2025
771218e
Remove `Sentry-Dynamic-WithARM64e` from Package.swift for PR
itaybre Aug 13, 2025
d2c0d8a
Add `iphonesimulator` sdk to build list
itaybre Aug 13, 2025
74c98ec
Add comment
itaybre Aug 14, 2025
8fb9223
Split slices and variant into base and additional arrays
itaybre Aug 14, 2025
ab1f079
Add package file input to prepare-package action
itaybre Aug 15, 2025
b4e023d
Add step to remove newer package files in prepare-package action
itaybre Aug 15, 2025
9003981
Add real devices sdks to variants built on PRs
itaybre Aug 15, 2025
e7ea525
Build WithoutUIKitOrAppKit on PRs
itaybre Aug 15, 2025
bae2cd5
ci: Build all slices
itaybre Aug 26, 2025
8827bdf
Merge branch 'main' of github.com:getsentry/sentry-cocoa into itaybre…
itaybre Aug 28, 2025
74d3832
Update file filters
itaybre Aug 28, 2025
43c0584
Use JSON and jq to make script easier to read
itaybre Aug 28, 2025
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
37 changes: 37 additions & 0 deletions .github/actions/prepare-package.swift/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Prepare Package.swift"
description: "Prepares Package.swift"
inputs:
is-pr:
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:
- 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' }}
shell: bash
env:
PACKAGE_FILE: ${{ inputs.package-file }}
run: |
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_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
117 changes: 41 additions & 76 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -48,37 +49,43 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
setup-matrix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup matrix combinations
id: setup-matrix-combinations
run: |
./scripts/generate_release_matrix.sh
env:
EVENT_NAME: ${{ github.event_name }}
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
uses: ./.github/workflows/build-xcframework-variant-slices.yml
needs: setup-matrix
with:
name: ${{matrix.variant.name}}
suffix: ${{matrix.variant.suffix}}
macho-type: ${{matrix.variant.macho-type}}
configuration-suffix: ${{matrix.variant.configuration-suffix}}
variant-id: ${{matrix.variant.id}}
release-version: ${{ github.event.inputs.version }}
sdk-list: ${{ needs.setup-matrix.outputs.sdk-list-array }}
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
variant: ${{ 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
Expand All @@ -91,37 +98,10 @@ jobs:
release-version: ${{ github.event.inputs.version }}
excluded-archs: ${{matrix.variant.excluded-archs}}
override-name: ${{matrix.variant.override-name}}
sdks: ${{ needs.setup-matrix.outputs.sdk-list-string }}
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
variant: ${{ fromJson(needs.setup-matrix.outputs.variants) }}

validate-xcframework:
name: Validate XCFramework
Expand Down Expand Up @@ -156,16 +136,11 @@ 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' }}
package-file: ${{matrix.package-file.name}}
- run: swift build
working-directory: Samples/macOS-SPM-CommandLine
- name: Run CI Diagnostics
Expand All @@ -187,16 +162,11 @@ 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' }}
package-file: ${{matrix.package-file.name}}
- run: swift build
working-directory: Samples/SPM-Dynamic
- name: Run CI Diagnostics
Expand All @@ -218,16 +188,11 @@ 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' }}
package-file: ${{matrix.package-file.name}}
- run: swift build
- name: Run CI Diagnostics
if: failure()
Expand Down
87 changes: 87 additions & 0 deletions scripts/generate_release_matrix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/bin/bash

# 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"'
'"maccatalyst"'
'"appletvos"'
'"watchos"'
'"xros"'
)

# 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=(
'"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"
}

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)
else
# 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=$SLICES_COMBINATIONS"
echo "variants=$VARIANTS_COMBINATIONS"
echo "sdk-list-array=$SDK_LIST"
echo "sdk-list-string=$(echo "$SDK_LIST" | jq -r 'join(",")')"
} >> "$GITHUB_OUTPUT"
Loading