Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions .github/actions/cocoa-cache-key/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Cocoa SDK cache key
description: Computes the cache key for the Cocoa SDK that Sentry.Bindings.Cocoa builds from the sentry-cocoa submodule
outputs:
key:
description: Covers the selected Xcode, build-sentry-cocoa.sh, sentry-cocoa.xcconfig and the submodule commit
value: ${{ steps.key.outputs.key }}
runs:
using: composite

steps:
- id: key
shell: bash
run: echo "key=sentry-cocoa-$(xcodebuild -version | tr -cs '[:alnum:].' '-')-${{ hashFiles('scripts/build-sentry-cocoa.sh', 'scripts/sentry-cocoa.xcconfig') }}-${{ hashFiles('.git/modules/modules/sentry-cocoa/HEAD') }}" >> "$GITHUB_OUTPUT"
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,22 @@ jobs:
fail-on-cache-miss: true
enableCrossOsArchive: true

# The Cocoa SDK is built from the submodule by the Sentry.Bindings.Cocoa project, which takes ~15 minutes
# on a hosted runner. build-sentry-cocoa.sh skips the build when the restored stamp matches.
# Release builds always build it from source, because it ships in the Sentry.Bindings.Cocoa package.
- name: Get Cocoa SDK cache key
id: cocoa-key
if: runner.os == 'macOS'
uses: ./.github/actions/cocoa-cache-key

- name: Restore Cocoa SDK
id: cache-cocoa
if: runner.os == 'macOS' && !startsWith(github.ref_name, 'release/')
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: modules/sentry-cocoa/Carthage
key: ${{ steps.cocoa-key.outputs.key }}

- name: Build Native Dependencies
if: ${{ !matrix.container && !env.NO_MOBILE }}
uses: ./.github/actions/buildnative
Expand All @@ -220,6 +236,14 @@ jobs:
id: build
run: dotnet build ${{ matrix.slnf }} -c Release --no-restore --nologo -v:minimal -flp:logfile=build.log -p:CopyLocalLockFileAssemblies=true -bl:build.binlog

# Only a completed Cocoa build writes the stamp, so a failed one is never cached.
- name: Save Cocoa SDK
if: ${{ !cancelled() && steps.cache-cocoa.outputs.cache-primary-key != '' && steps.cache-cocoa.outputs.cache-hit != 'true' && hashFiles('modules/sentry-cocoa/Carthage/.built-from-sha') != '' }}
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: modules/sentry-cocoa/Carthage
key: ${{ steps.cache-cocoa.outputs.cache-primary-key }}

- name: Upload build logs
if: ${{ always() }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/device-tests-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,28 @@ jobs:
- name: Setup Environment
uses: ./.github/actions/environment

# See build.yml
- name: Get Cocoa SDK cache key
id: cocoa-key
uses: ./.github/actions/cocoa-cache-key

- name: Restore Cocoa SDK
id: cache-cocoa
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: modules/sentry-cocoa/Carthage
key: ${{ steps.cocoa-key.outputs.key }}

- name: Build iOS Test App
run: pwsh ./scripts/device-test.ps1 ios -Build

- name: Save Cocoa SDK
if: ${{ !cancelled() && steps.cache-cocoa.outputs.cache-hit != 'true' && hashFiles('modules/sentry-cocoa/Carthage/.built-from-sha') != '' }}
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: modules/sentry-cocoa/Carthage
key: ${{ steps.cache-cocoa.outputs.cache-primary-key }}

- name: Run Tests
id: first-test-run
continue-on-error: true
Expand Down
Loading