|
| 1 | +name: "Assemble Sentry Cocoa XCFramework variant" |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + name: |
| 7 | + description: |- |
| 8 | + The Sentry project target to build an XCFramework slice for. |
| 9 | + Possible values: Sentry, SentrySwiftUI. |
| 10 | + required: true |
| 11 | + type: string |
| 12 | + |
| 13 | + suffix: |
| 14 | + description: |- |
| 15 | + The suffix to add to the build product name. |
| 16 | + E.g. "-Dynamic" or "-WithoutUIKitOrAppKit". |
| 17 | + required: false |
| 18 | + type: string |
| 19 | + |
| 20 | + configuration-suffix: |
| 21 | + description: |- |
| 22 | + The suffix to add to the build product name to build an alternate configuration of the target. |
| 23 | + E.g. "WithoutUIKit". |
| 24 | + required: false |
| 25 | + type: string |
| 26 | + |
| 27 | + variant-id: |
| 28 | + description: |- |
| 29 | + The ID of the variant to build an XCFramework slice for. Used to collect appropriate slices for final deliverable assembly. |
| 30 | + E.g. "sentry-static", "sentry-dynamic" or "sentry-withoutuikit-dynamic" |
| 31 | + required: true |
| 32 | + type: string |
| 33 | + |
| 34 | + signed: |
| 35 | + description: |- |
| 36 | + Whether or not the assembled XCFramework should be signed. |
| 37 | + required: false |
| 38 | + type: boolean |
| 39 | + default: false |
| 40 | + |
| 41 | + sdks: |
| 42 | + description: |- |
| 43 | + The SDK slices to assemble into an XCFramework. |
| 44 | + required: false |
| 45 | + type: string |
| 46 | + default: "iphoneos,iphonesimulator,macosx,maccatalyst,appletvos,appletvsimulator,watchos,watchsimulator,xros,xrsimulator" |
| 47 | + |
| 48 | + release-version: |
| 49 | + description: |- |
| 50 | + For release workflows, the version to inject into the SDK. |
| 51 | + required: false |
| 52 | + type: string |
| 53 | + |
| 54 | +jobs: |
| 55 | + assemble-xcframework-variant: |
| 56 | + name: Assemble ${{inputs.name}}${{inputs.suffix}} XCFramework Variant |
| 57 | + |
| 58 | + runs-on: macos-14 |
| 59 | + steps: |
| 60 | + - uses: actions/checkout@v4 |
| 61 | + |
| 62 | + - uses: ruby/setup-ruby@v1 |
| 63 | + if: ${{ inputs.signed }} |
| 64 | + with: |
| 65 | + bundler-cache: true |
| 66 | + |
| 67 | + - name: "Download Fastlane Certificate" |
| 68 | + if: ${{ inputs.signed }} |
| 69 | + run: bundle exec fastlane prepare_xcframework_signing |
| 70 | + env: |
| 71 | + APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }} |
| 72 | + APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} |
| 73 | + APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }} |
| 74 | + FASTLANE_KEYCHAIN_PASSWORD: ${{ secrets.FASTLANE_KEYCHAIN_PASSWORD }} |
| 75 | + MATCH_GIT_PRIVATE_KEY: ${{ secrets.MATCH_GIT_PRIVATE_KEY }} |
| 76 | + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} |
| 77 | + MATCH_USERNAME: ${{ secrets.MATCH_USERNAME }} |
| 78 | + |
| 79 | + - name: Get version |
| 80 | + id: get-version |
| 81 | + run: | |
| 82 | + if [ -n "${{ inputs.release-version }}" ]; then |
| 83 | + echo "VERSION=${{ inputs.release-version }}" >> $GITHUB_ENV |
| 84 | + else |
| 85 | + echo "VERSION=$(grep MARKETING_VERSION Sources/Configuration/Versioning.xcconfig | cut -d ' ' -f 3)+${{ github.sha }}" >> $GITHUB_ENV |
| 86 | + fi |
| 87 | + shell: sh |
| 88 | + |
| 89 | + - name: Compute cache key |
| 90 | + run: | |
| 91 | + sdks_string=${{inputs.sdks}} |
| 92 | + sdks_string_slugified=${sdks_string//,/_} |
| 93 | + echo "SENTRY_XCFRAMEWORK_CACHE_KEY=${{runner.os}}-xcframework-${{inputs.variant-id}}-$sdks_string_slugified-${{inputs.signed}}-${{env.VERSION}}-${{hashFiles('Sources/**')}}-${{hashFiles('Sentry.xcodeproj/**')}}" >> $GITHUB_ENV |
| 94 | +
|
| 95 | + - name: Restore XCFramework cache |
| 96 | + id: cache-xcframework |
| 97 | + uses: actions/cache@v4 |
| 98 | + with: |
| 99 | + key: ${{env.SENTRY_XCFRAMEWORK_CACHE_KEY}} |
| 100 | + path: ${{inputs.name}}${{inputs.suffix}}.xcframework.zip |
| 101 | + |
| 102 | + - name: Download ${{inputs.variant-id}} Slices |
| 103 | + if: steps.cache-xcframework.outputs.cache-hit != 'true' |
| 104 | + uses: actions/download-artifact@v4 |
| 105 | + with: |
| 106 | + pattern: xcframework-${{inputs.variant-id}}-slice-* |
| 107 | + path: xcframework-slices |
| 108 | + |
| 109 | + - name: Unzip slice artifact ZIP archives |
| 110 | + if: steps.cache-xcframework.outputs.cache-hit != 'true' |
| 111 | + run: | |
| 112 | + find xcframework-slices -type f -print0 | xargs -t0I @ unzip @ -d xcframework-slices |
| 113 | + shell: bash |
| 114 | + |
| 115 | + - name: Assemble XCFramework |
| 116 | + if: steps.cache-xcframework.outputs.cache-hit != 'true' |
| 117 | + run: ./scripts/assemble-xcframework.sh "${{inputs.name}}" "${{inputs.suffix}}" "${{inputs.configuration-suffix}}" "${{inputs.sdks}}" "/Users/runner/work/sentry-cocoa/sentry-cocoa/xcframework-slices/SDK_NAME.xcarchive" |
| 118 | + shell: bash |
| 119 | + |
| 120 | + - name: Zip XCFramework |
| 121 | + if: steps.cache-xcframework.outputs.cache-hit != 'true' |
| 122 | + run: ./scripts/compress-xcframework.sh ${{inputs.signed && '--sign' || '--not-signed'}} ${{inputs.name}}${{inputs.suffix}} |
| 123 | + shell: bash |
| 124 | + |
| 125 | + - name: Cache XCFramework |
| 126 | + uses: actions/cache@v4 |
| 127 | + with: |
| 128 | + key: ${{env.SENTRY_XCFRAMEWORK_CACHE_KEY}} |
| 129 | + path: ${{inputs.name}}${{inputs.suffix}}.xcframework.zip |
| 130 | + |
| 131 | + - name: Upload XCFramework |
| 132 | + uses: actions/upload-artifact@v4 |
| 133 | + with: |
| 134 | + overwrite: true |
| 135 | + name: xcframework-${{github.sha}}-${{inputs.variant-id}} |
| 136 | + if-no-files-found: error |
| 137 | + path: ${{inputs.name}}${{inputs.suffix}}.xcframework.zip |
0 commit comments