-
-
Notifications
You must be signed in to change notification settings - Fork 372
ci: Reduce number of variants built on PRs #5941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
itaybre
merged 24 commits into
main
from
itaybre/build_only_selected_variants_on_each_pr
Aug 28, 2025
Merged
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 9762085
Use env variable for github output
itaybre d5b9ce9
Use echo
itaybre 07de050
Move script to a file
itaybre 951ec84
Checkout code
itaybre b548d33
Update file permissions
itaybre 11a2aec
Pass sdklist to assemble xcframework
itaybre dfd888d
Add script to release.yml trigger
itaybre 2013bf1
Fix variable name
itaybre 4f0eaf3
Build `Sentry-Dynamic`
itaybre 2b8b2c6
Add SentrySwiftUI to build list
itaybre 73d75a1
Fix extra ,
itaybre 771218e
Remove `Sentry-Dynamic-WithARM64e` from Package.swift for PR
itaybre d2c0d8a
Add `iphonesimulator` sdk to build list
itaybre 74c98ec
Add comment
itaybre 8fb9223
Split slices and variant into base and additional arrays
itaybre ab1f079
Add package file input to prepare-package action
itaybre b4e023d
Add step to remove newer package files in prepare-package action
itaybre 9003981
Add real devices sdks to variants built on PRs
itaybre e7ea525
Build WithoutUIKitOrAppKit on PRs
itaybre bae2cd5
ci: Build all slices
itaybre 8827bdf
Merge branch 'main' of github.com:getsentry/sentry-cocoa into itaybre…
itaybre 74d3832
Update file filters
itaybre 43c0584
Use JSON and jq to make script easier to read
itaybre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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=( | ||
itaybre marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| '"iphoneos"' | ||
| '"iphonesimulator"' | ||
| '"macosx"' | ||
| '"maccatalyst"' | ||
| '"appletvos"' | ||
| '"watchos"' | ||
| '"xros"' | ||
| ) | ||
|
|
||
| # Slices and Variants only needed on main or release | ||
| ADDITIONAL_SLICES=( | ||
itaybre marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| '{"name": "Sentry", "macho-type": "mh_dylib", "suffix": "-WithoutUIKitOrAppKit", "configuration-suffix": "WithoutUIKit", "id": "sentry-withoutuikit-dynamic"}' | ||
| ) | ||
cursor[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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() { | ||
itaybre marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.