-
-
Notifications
You must be signed in to change notification settings - Fork 356
ci: parallelize xcframework slice builds #5218
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
Open
armcknight
wants to merge
73
commits into
main
Choose a base branch
from
armcknight/ci/parallelize-xcframework-build
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
73 commits
Select commit
Hold shift + click to select a range
5e09c96
ci: remove workflow that pushes commits to branches
armcknight de8e3e1
also remove script and update contributing
armcknight 31f52c4
just use the main init and brewfile
armcknight 541ce9a
ref: extract xcframework-based jobs from build.yml into new build-xcf…
armcknight eeac6b7
fix new build trigger
armcknight 3d52789
wip splitting up
armcknight b31dc3b
more wip
armcknight 2abdfa1
more wip
armcknight 8d6b5bc
parameterize everything in a matrix
armcknight 221c5ef
DONOTMERGE remove other ci jobs
armcknight f6670ce
try assembly as well
armcknight f2f2a94
fix yaml spec
armcknight 8ca70ef
try to fix suffix
armcknight f7d81dd
fix matrix access
armcknight 8182223
capture logfile
armcknight 4713730
fix logs
armcknight 8f5ff02
step ordering with checkout
armcknight 94d8d9f
put xcbeautify in build ci brewfile
armcknight adb0215
oh yeah xcbeautify is preinstalled
armcknight f794b76
DONOTMERGE let all jobs run
armcknight 92b0202
fix args
armcknight 7347998
remove dylib machotype for uikitless variant
armcknight 1e22c5e
try the correct macho type
armcknight 62eff3d
remove target dependency of sentryswiftui on sentry
armcknight 6b36de1
implement assembly steps
armcknight dc1f0aa
differentiate separate xcframeworks
armcknight c86924b
add some missing trigger files
armcknight bcd8e9f
Revert "remove target dependency of sentryswiftui on sentry"
armcknight d193556
fix create xcframework name, TEMP comment out other jobs
armcknight a277b97
uncomment
armcknight 63c3b39
Revert "DONOTMERGE let all jobs run"
armcknight f3050f6
Revert "DONOTMERGE remove other ci jobs"
armcknight f898d9a
DONOTMERGE remove all but build and release jobs
armcknight eb2e5db
put back release job and use the two new parallel steps
armcknight 1e7c5bc
extract assembly to script
armcknight b741791
put in the release version
armcknight 8a61b47
fix perms
armcknight 7d4f81b
fix awks, remove unnecessary workflow job steps
armcknight e285af8
properly interpolate path into awk script
armcknight 96f0096
dont need to append path prefix
armcknight 4fe1801
eval as one long string
armcknight 889ea3a
interleave framework/debugsymbol args
armcknight e67bfd4
separately check for existence of dsym and framework; static framewor…
armcknight c69cfd4
do the sentry dep build removal before even archiving
armcknight 27357dd
use pattern for all the validation downloads
armcknight 746500e
update the version in release.yml
armcknight 335339e
merge multiple artfact downloads for validation steps
armcknight 2d85054
only download sentry-dynamic and sentryswiftui for the valdation step
armcknight 44b08de
need the static sentry framework not the dynamic one
armcknight cca1c02
try fixing paths?
armcknight 54f9320
correctly remove sentry.framework from sentryswiftui build
armcknight e31ad72
fix comparison
armcknight 3ea10bf
try single quotes
armcknight 2c79300
ls some directories
armcknight dc97c90
fix find invocations, use -t on xargs to print every invocation
armcknight 760bb97
find instead of ls
armcknight 3b20a6a
find zipfiles
armcknight dff5aaf
move up to Carthage/
armcknight 3e312a5
fix xargs mv
armcknight 9762535
clean up
armcknight 8fd80de
add back in the other workflows
armcknight 4609768
remove reference scripts
armcknight 0bcfb02
clean up makefile and more workflow file triggers
armcknight ea25a75
ci: refactor xcframework build workflows (#5277)
armcknight 517598f
resolve merge leftovers
armcknight adf3872
put back some stuff after rebase
armcknight 8de450f
format
armcknight 0dbd80c
Merge branch 'main' into armcknight/ci/parallelize-xcframework-build
armcknight 306772a
more format
armcknight 5ec9eef
more format
armcknight 4c80072
need to archive the maccatalyst slices too
armcknight 11fb006
only build a catalyst slice for macosx sdk
armcknight ab6cd13
look more generally for frameworks and dsyms
armcknight 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,49 @@ | ||||||
name: "Assemble Sentry Cocoa XCFramework variant" | ||||||
|
||||||
on: | ||||||
workflow_call: | ||||||
inputs: | ||||||
name: | ||||||
description: |- | ||||||
The Sentry project target to build an XCFramework slice for. | ||||||
Possible values: Sentry, SentrySwiftUI. | ||||||
required: true | ||||||
type: string | ||||||
|
||||||
suffix: | ||||||
description: |- | ||||||
The suffix to add to the build product name. | ||||||
E.g. "-Dynamic" or "-WithoutUIKitOrAppKit". | ||||||
required: false | ||||||
type: string | ||||||
|
||||||
variant-id: | ||||||
description: |- | ||||||
The ID of the variant to build an XCFramework slice for. Used to collect appropriate slices for final deliverable assembly. | ||||||
required: true | ||||||
type: string | ||||||
|
||||||
jobs: | ||||||
assemble-xcframework-variant: | ||||||
name: Assemble ${{inputs.name}}${{inputs.suffix}} XCFramework Variant | ||||||
|
||||||
runs-on: macos-14 | ||||||
steps: | ||||||
- uses: actions/checkout@v4 | ||||||
|
||||||
- name: Download ${{inputs.variant-id}} Slices | ||||||
uses: actions/download-artifact@v4 | ||||||
with: | ||||||
pattern: xcframework-${{inputs.variant-id}}-slice-* | ||||||
path: xcframework-slices | ||||||
|
||||||
- name: Assemble XCFramework | ||||||
run: ./scripts/assemble-xcframework.sh "${{github.workspace}}/xcframework-slices" "${{inputs.name}}${{inputs.suffix}}" | ||||||
shell: bash | ||||||
|
||||||
- name: Archive XCFramework | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
uses: actions/upload-artifact@v4 | ||||||
with: | ||||||
name: xcframework-${{github.sha}}-${{inputs.variant-id}} | ||||||
if-no-files-found: error | ||||||
path: ${{inputs.name}}${{inputs.suffix}}.xcframework.zip |
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,100 @@ | ||
name: "Build Sentry Cocoa XCFramework variant slices" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
sdk-list: | ||
description: |- | ||
The list of Apple platform SDKs for which to build slices and assemble into an XCFramework. This must be a JSON array of strings, itself in a string since GitHub Actions doesn't support arrays as inputs. | ||
Possible values: iphoneos, iphonesimulator, macosx, appletvos, appletvsimulator, watchos, watchsimulator, xros, xrsimulator. | ||
required: false | ||
default: '["iphoneos", "iphonesimulator", "macosx", "appletvos", "appletvsimulator", "watchos", "watchsimulator", "xros", "xrsimulator"]' | ||
type: string | ||
|
||
name: | ||
description: |- | ||
The Sentry project target to build an XCFramework slice for. | ||
Possible values: Sentry, SentrySwiftUI. | ||
required: true | ||
type: string | ||
|
||
suffix: | ||
description: |- | ||
The suffix to add to the build product name. | ||
E.g. "-Dynamic" or "-WithoutUIKitOrAppKit". | ||
required: false | ||
type: string | ||
|
||
macho-type: | ||
description: |- | ||
The Mach-O type of the build product. | ||
Possible values: mh_dylib, staticlib. | ||
required: false | ||
type: string | ||
default: "mh_dylib" | ||
|
||
configuration-suffix: | ||
description: |- | ||
The suffix to add to the build product name to build an alternate configuration of the target. | ||
E.g. "WithoutUIKit". | ||
required: false | ||
type: string | ||
|
||
variant-id: | ||
description: |- | ||
The ID of the variant to build an XCFramework slice for. Used to collect appropriate slices for final deliverable assembly. | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
build-xcframework-variant-slices: | ||
name: Build ${{inputs.name}}${{inputs.suffix}} XCFramework Variant Slice for ${{matrix.sdk}} | ||
|
||
# We must compile this on an arm64 runner, cause it's required for visionOS. macos-14 uses arm64. | ||
# To see the available runners see https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories. | ||
runs-on: macos-14 | ||
|
||
strategy: | ||
matrix: | ||
sdk: ${{ fromJson(inputs.sdk-list) }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
# We have to compile on Xcode 15.2 because compiling on Xcode 15.4 fails with | ||
# Data+SentryTracing.swift:21:62: error: 'ReadingOptions' aliases 'Foundation.ReadingOptions' | ||
# and cannot be used here because C++ types from imported module 'Foundation' do not support | ||
# library evolution; this is an error in the Swift 6 language mode | ||
# We also can't use Xcode 16.x because validating the XCFramework then fails with Xcode 15.x. | ||
- run: ./scripts/ci-select-xcode.sh 15.2 | ||
shell: bash | ||
|
||
- name: Build ${{inputs.name}}${{inputs.suffix}} XCFramework slice for ${{matrix.sdk}} | ||
if: startsWith(github.ref, 'refs/heads/release/') == false | ||
run: ./scripts/build-xcframework-slice.sh ${{matrix.sdk}} ${{inputs.name}} "${{inputs.suffix}}" ${{inputs.macho-type}} ${{inputs.configuration-suffix}} | ||
shell: bash | ||
|
||
- name: Remove Sentry.framework from SentrySwiftUI build | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if: inputs.name == 'SentrySwiftUI' | ||
run: | | ||
find "${{github.workspace}}/Carthage/archive" -name "Sentry.framework" -print0 | xargs -t0 rm -rf | ||
find "${{github.workspace}}/Carthage/archive" -name "Sentry.framework.dSYM" -print0 | xargs -t0 rm -rf | ||
shell: bash | ||
|
||
- name: Archiving xcarchive | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: xcframework-${{inputs.variant-id}}-slice-${{matrix.sdk}} | ||
if-no-files-found: error | ||
path: | | ||
${{github.workspace}}/Carthage/archive/${{inputs.name}}${{inputs.suffix}}/${{matrix.sdk}}.xcarchive | ||
${{github.workspace}}/Carthage/DerivedData/Build/Products/${{inputs.name}}${{inputs.suffix}}.framework | ||
${{github.workspace}}/Carthage/DerivedData/Build/Products/${{inputs.name}}${{inputs.suffix}}.framework.dSYM | ||
|
||
- name: Archive build log if failed | ||
uses: actions/upload-artifact@v4 | ||
if: ${{ failure() || cancelled() }} | ||
with: | ||
name: raw-build-output-build-xcframework-${{inputs.variant-id}}-${{matrix.sdk}} | ||
path: | | ||
*.log |
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,154 @@ | ||
name: "Build Sentry XCFramework" | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- release/** | ||
|
||
pull_request: | ||
paths: | ||
- "Sources/**" | ||
- ".github/workflows/build-xcframework.yml" | ||
- "scripts/ci-select-xcode.sh" | ||
- Sentry.xcworkspace/** | ||
- Sentry.xcodeproj/** | ||
- "Package.swift" | ||
- "scripts/build-xcframework-slice.sh" | ||
- "scripts/assemble-xcframework.sh" | ||
- ".github/workflows/build-xcframework-variant-slices.yml" | ||
- ".github/workflows/assemble-xcframework-variant.yml" | ||
- Samples/macOS-SPM-CommandLine/** | ||
- Samples/SPM-Dynamic/** | ||
|
||
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-xcframework-variant-slices: | ||
uses: ./.github/workflows/build-xcframework-variant-slices.yml | ||
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}} | ||
strategy: | ||
matrix: | ||
variant: | ||
- name: Sentry | ||
suffix: "-Dynamic" | ||
id: sentry-dynamic | ||
- name: Sentry | ||
macho-type: staticlib | ||
id: sentry-static | ||
- name: SentrySwiftUI | ||
id: sentryswiftui | ||
- name: Sentry | ||
suffix: "-WithoutUIKitOrAppKit" | ||
macho-type: mh_dylib | ||
configuration-suffix: WithoutUIKit | ||
id: sentry-withoutuikit-dynamic | ||
|
||
assemble-xcframework-variant: | ||
needs: build-xcframework-variant-slices | ||
uses: ./.github/workflows/assemble-xcframework-variant.yml | ||
with: | ||
name: ${{matrix.variant.name}} | ||
suffix: ${{matrix.variant.suffix}} | ||
variant-id: ${{matrix.variant.id}} | ||
strategy: | ||
matrix: | ||
variant: | ||
- name: Sentry | ||
suffix: "-Dynamic" | ||
id: sentry-dynamic | ||
- name: Sentry | ||
id: sentry-static | ||
- name: SentrySwiftUI | ||
id: sentryswiftui | ||
- name: Sentry | ||
suffix: "-WithoutUIKitOrAppKit" | ||
id: sentry-withoutuikit-dynamic | ||
|
||
validate-xcframework: | ||
name: Validate XCFramework | ||
runs-on: macos-13 | ||
needs: assemble-xcframework-variant | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
pattern: xcframework-${{github.sha}}-sentry-static | ||
path: Carthage/ | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
pattern: xcframework-${{github.sha}}-sentryswiftui | ||
path: Carthage/ | ||
- run: find Carthage -name "*.zip" -print0 | xargs -t0I @ mv @ Carthage | ||
- run: ./scripts/ci-select-xcode.sh 15.2 | ||
- run: make build-xcframework-sample | ||
shell: sh | ||
|
||
# Use github.event.pull_request.head.sha instead of github.sha when available as | ||
# the github.sha is be the pre merge commit id for PRs. | ||
# See https://github.community/t/github-sha-isnt-the-value-expected/17903/17906. | ||
validate-spm: | ||
name: Validate Swift Package Manager | ||
runs-on: macos-13 | ||
needs: assemble-xcframework-variant | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
pattern: xcframework-${{github.sha}}-* | ||
merge-multiple: true | ||
- name: Change path of the framework | ||
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/path: "Sentry-Dynamic.xcframework.zip"/g' Package.swift | ||
shell: bash | ||
- run: swift build | ||
working-directory: Samples/macOS-SPM-CommandLine | ||
shell: sh | ||
|
||
validate-spm-dynamic: | ||
name: Validate Swift Package Manager Dynamic | ||
runs-on: macos-13 | ||
needs: assemble-xcframework-variant | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
pattern: xcframework-${{github.sha}}-* | ||
merge-multiple: true | ||
- name: Change path of the framework | ||
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/path: "Sentry-Dynamic.xcframework.zip"/g' Package.swift | ||
shell: bash | ||
- run: swift build | ||
working-directory: Samples/SPM-Dynamic | ||
shell: sh | ||
|
||
swift-build: | ||
name: Build with Swift | ||
runs-on: macos-13 | ||
needs: assemble-xcframework-variant | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
pattern: xcframework-${{github.sha}}-* | ||
merge-multiple: true | ||
- name: Change path of the framework | ||
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/path: "Sentry-Dynamic.xcframework.zip"/g' Package.swift | ||
shell: bash | ||
- run: swift build | ||
shell: sh |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l
: An example for a possible value would be nice.