Skip to content

Commit 6af9afe

Browse files
authored
chore: Download the Cocoa SDK instead of building it (#681)
* Rework CI to download cocoa instead of building * Fix paths * Remove cocoa submodule * Fix paths * Fix file name * Update deps workflow * Rename job * Update changelog * Update scripts * Merge ios and mac dependencies loading into a single script * Fix dir path * Fix path again * Fix missing dir check * Update CHANGELOG.md
1 parent 88276c2 commit 6af9afe

10 files changed

+122
-104
lines changed

.github/workflows/ci.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,39 @@ on: push
44

55
jobs:
66
android-sdk:
7-
uses: ./.github/workflows/sdk.yml
7+
uses: ./.github/workflows/sdk-build.yml
88
with:
99
target: Android
1010
runsOn: ubuntu-latest
1111

1212
ios-sdk:
13-
uses: ./.github/workflows/sdk.yml
13+
uses: ./.github/workflows/sdk-download.yml
1414
with:
1515
target: IOS
16-
runsOn: macos-13
16+
runsOn: ubuntu-latest
1717

1818
macos-sdk:
19-
uses: ./.github/workflows/sdk.yml
19+
uses: ./.github/workflows/sdk-download.yml
2020
with:
2121
target: Mac
22-
runsOn: macos-13
22+
runsOn: ubuntu-latest
2323

2424
linux-sdk:
25-
uses: ./.github/workflows/sdk.yml
25+
uses: ./.github/workflows/sdk-build.yml
2626
with:
2727
target: Linux
2828
# Build for an older GLIBC so that it can run with the old GLIBC included in EpicGames' Unreal docker images.
2929
# See discussion in https://github.com/getsentry/sentry-unreal/pull/173
3030
runsOn: ubuntu-20.04
3131

3232
windows-crashpad-sdk:
33-
uses: ./.github/workflows/sdk.yml
33+
uses: ./.github/workflows/sdk-build.yml
3434
with:
3535
target: Win64-Crashpad
3636
runsOn: windows-2019
3737

3838
windows-breakpad-sdk:
39-
uses: ./.github/workflows/sdk.yml
39+
uses: ./.github/workflows/sdk-build.yml
4040
with:
4141
target: Win64-Breakpad
4242
runsOn: windows-2019

.github/workflows/sdk.yml renamed to .github/workflows/sdk-build.yml

-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ jobs:
2323
run: |
2424
if [[ "${{ inputs.target }}" == "Android" ]]; then
2525
submodule="modules/sentry-java"
26-
elif [[ "${{ inputs.target }}" == "IOS" || "${{ inputs.target }}" == "Mac" ]]; then
27-
submodule="modules/sentry-cocoa"
2826
else
2927
submodule="modules/sentry-native"
3028
fi

.github/workflows/sdk-download.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
runsOn:
5+
required: true
6+
type: string
7+
target:
8+
required: true
9+
type: string
10+
11+
jobs:
12+
download:
13+
runs-on: ${{ inputs.runsOn }}
14+
timeout-minutes: 30
15+
defaults:
16+
run:
17+
shell: bash
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Select properties file
22+
id: env
23+
run: |
24+
if [[ "${{ inputs.target }}" == "IOS" || "${{ inputs.target }}" == "Mac" ]]; then
25+
echo "cacheLocation=modules/sentry-cocoa" >> $GITHUB_OUTPUT
26+
echo "propertiesFile=modules/sentry-cocoa.properties" >> $GITHUB_OUTPUT
27+
echo "downloadScript=scripts/download-cocoa.sh" >> $GITHUB_OUTPUT
28+
fi
29+
echo "path=plugin-dev/Source/ThirdParty/${{ inputs.target }}" >> $GITHUB_OUTPUT
30+
31+
- uses: actions/cache@v4
32+
id: cache
33+
with:
34+
path: |
35+
${{ steps.env.outputs.path }}
36+
key: sdk=${{ inputs.target }}-${{ hashFiles(steps.env.outputs.propertiesFile, 'scripts/download-*.sh', '.github/workflows/sdk-download.yml') }}
37+
38+
- name: Download
39+
if: steps.cache.outputs.cache-hit != 'true'
40+
run: |
41+
mkdir -p '${{ steps.env.outputs.path }}'
42+
${{ steps.env.outputs.downloadScript }} '${{ steps.env.outputs.cacheLocation }}' '${{ steps.env.outputs.path }}'
43+
44+
- uses: actions/upload-artifact@v4
45+
with:
46+
name: ${{ inputs.target }}-sdk
47+
path: ${{ steps.env.outputs.path }}
48+
retention-days: ${{ github.ref_name == 'main' && 14 || 1 }}

.github/workflows/update-dependencies.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ jobs:
2929
cocoa:
3030
uses: getsentry/github-workflows/.github/workflows/updater.yml@v2
3131
with:
32-
path: modules/sentry-cocoa
33-
name: Cocoa SDK (iOS)
32+
path: modules/sentry-cocoa.properties
33+
name: Cocoa SDK (iOS and Mac)
3434
secrets:
3535
api-token: ${{ secrets.CI_DEPLOY_KEY }}
3636

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,3 @@ url = https://github.com/getsentry/sentry-java.git
44
[submodule "modules/sentry-native"]
55
path = modules/sentry-native
66
url = https://github.com/getsentry/sentry-native.git
7-
[submodule "modules/sentry-cocoa"]
8-
path = modules/sentry-cocoa
9-
url = https://github.com/getsentry/sentry-cocoa

CHANGELOG.md

+5-14
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,15 @@
1212
- Bump CLI from v2.37.0 to v2.38.2 ([#663](https://github.com/getsentry/sentry-unreal/pull/663), [#670](https://github.com/getsentry/sentry-unreal/pull/670), [#677](https://github.com/getsentry/sentry-unreal/pull/677))
1313
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2382)
1414
- [diff](https://github.com/getsentry/sentry-cli/compare/2.37.0...2.38.2)
15-
- Bump Java SDK (Android) from v7.15.0 to v7.16.0 ([#665](https://github.com/getsentry/sentry-unreal/pull/665))
16-
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7160)
17-
- [diff](https://github.com/getsentry/sentry-java/compare/7.15.0...7.16.0)
15+
- Bump Java SDK (Android) from v7.15.0 to v7.17.0 ([#665](https://github.com/getsentry/sentry-unreal/pull/665), [#682](https://github.com/getsentry/sentry-unreal/pull/682))
16+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7170)
17+
- [diff](https://github.com/getsentry/sentry-java/compare/7.15.0...7.17.0)
1818
- Bump Native SDK from v0.7.6 to v0.7.12 ([#667](https://github.com/getsentry/sentry-unreal/pull/667), [#678](https://github.com/getsentry/sentry-unreal/pull/678))
1919
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0712)
2020
- [diff](https://github.com/getsentry/sentry-native/compare/0.7.6...0.7.12)
21-
- Bump Cocoa SDK (iOS) from v8.38.0 to v8.39.0 ([#668](https://github.com/getsentry/sentry-unreal/pull/668))
22-
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8390)
23-
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.38.0...8.39.0)
24-
- Bump Cocoa SDK (iOS) from v8.40.0-5-gf31a3eff to v8.40.0 ([#679](https://github.com/getsentry/sentry-unreal/pull/679))
25-
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8400)
26-
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.40.0-5-gf31a3eff...8.40.0)
27-
- Bump Cocoa SDK (iOS) from v8.40.0 to v8.40.1 ([#680](https://github.com/getsentry/sentry-unreal/pull/680))
21+
- Bump Cocoa SDK (iOS) from v8.38.0 to v8.40.1 ([#668](https://github.com/getsentry/sentry-unreal/pull/668), [#679](https://github.com/getsentry/sentry-unreal/pull/679), [#680](https://github.com/getsentry/sentry-unreal/pull/680))
2822
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8401)
29-
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.40.0...8.40.1)
30-
- Bump Java SDK (Android) from v7.16.0 to v7.17.0 ([#682](https://github.com/getsentry/sentry-unreal/pull/682))
31-
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7170)
32-
- [diff](https://github.com/getsentry/sentry-java/compare/7.16.0...7.17.0)
23+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.38.0...8.40.1)
3324

3425
## 0.20.1
3526

modules/sentry-cocoa.properties

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version=8.40.1
2+
repo=https://github.com/getsentry/sentry-cocoa

scripts/build-ios.sh

-39
This file was deleted.

scripts/build-mac.sh

-36
This file was deleted.

scripts/download-cocoa.sh

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
function getProperty {
5+
cat "$(dirname $0)/../modules/sentry-cocoa.properties" | grep $1 | cut -d'=' -f2 | tr -d '"'
6+
}
7+
8+
export sentryCocoaCache=$1
9+
export sentryArtifactsDestination=$2
10+
11+
if ! [ -d "$sentryCocoaCache" ]; then
12+
mkdir $sentryCocoaCache
13+
fi
14+
15+
cocoaRepo=$(getProperty 'repo')
16+
cocoaVersion=$(getProperty 'version')
17+
18+
cocoaFrameworkUrl="${cocoaRepo}/releases/download/${cocoaVersion}/Sentry-Dynamic.xcframework.zip"
19+
20+
curl -L "${cocoaFrameworkUrl}" -o "${sentryCocoaCache}/Sentry-Dynamic.xcframework.zip"
21+
22+
unzip -o "${sentryCocoaCache}/Sentry-Dynamic.xcframework.zip" -d "${sentryCocoaCache}/"
23+
24+
# Prepare iOS artifacts
25+
26+
if ! [ -d "$(dirname $sentryArtifactsDestination)/IOS" ]; then
27+
mkdir "$(dirname $sentryArtifactsDestination)/IOS"
28+
else
29+
rm -rf "$(dirname $sentryArtifactsDestination)/IOS/"*
30+
fi
31+
32+
cp -R "${sentryCocoaCache}/Sentry-Dynamic.xcframework/ios-arm64_arm64e/Sentry.framework" "$(dirname $sentryArtifactsDestination)/IOS/Sentry.framework"
33+
34+
mkdir "Sentry.embeddedframework"
35+
36+
cp -R "$(dirname $sentryArtifactsDestination)/IOS/Sentry.framework" "Sentry.embeddedframework"
37+
zip -r "Sentry.embeddedframework.zip" "Sentry.embeddedframework"
38+
cp -R "Sentry.embeddedframework.zip" "$(dirname $sentryArtifactsDestination)/IOS/Sentry.embeddedframework.zip"
39+
40+
rm -rf "Sentry.embeddedframework"
41+
rm "Sentry.embeddedframework.zip"
42+
43+
# Prepare Mac artifacts
44+
45+
if ! [ -d "$(dirname $sentryArtifactsDestination)/Mac" ]; then
46+
mkdir "$(dirname $sentryArtifactsDestination)/Mac"
47+
else
48+
rm -rf "$(dirname $sentryArtifactsDestination)/Mac/"*
49+
fi
50+
51+
mkdir "$(dirname $sentryArtifactsDestination)/Mac/bin"
52+
mkdir "$(dirname $sentryArtifactsDestination)/Mac/include"
53+
54+
cp "${sentryCocoaCache}/Sentry-Dynamic.xcframework/macos-arm64_arm64e_x86_64/Sentry.framework/Sentry" "$(dirname $sentryArtifactsDestination)/Mac/bin/sentry.dylib"
55+
56+
cp -rL "${sentryCocoaCache}/Sentry-Dynamic.xcframework/macos-arm64_arm64e_x86_64/Sentry.framework/Headers" "$(dirname $sentryArtifactsDestination)/Mac/include/Sentry"
57+
cp -rL "${sentryCocoaCache}/Sentry-Dynamic.xcframework/macos-arm64_arm64e_x86_64/Sentry.framework/PrivateHeaders/." "$(dirname $sentryArtifactsDestination)/Mac/include/Sentry"

0 commit comments

Comments
 (0)