Skip to content

Commit b478665

Browse files
Pin macos-15 build runner (#3754)
1 parent ba94729 commit b478665

File tree

5 files changed

+57
-46
lines changed

5 files changed

+57
-46
lines changed

.github/actions/environment/action.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,35 @@ runs:
2222
with:
2323
log-accepted-android-sdk-licenses: false
2424

25+
# https://github.com/actions/runner-images/issues/10814
26+
- name: Workaround build-tools issue
27+
if: runner.os == 'macOS'
28+
shell: bash
29+
run: |
30+
curl https://dl.google.com/android/repository/build-tools_r35_macosx.zip > $ANDROID_HOME/build-tools_r35_macosx.zip
31+
cd $ANDROID_HOME
32+
mkdir -p build-tools
33+
unzip build-tools_r35_macosx.zip
34+
mv android-15 build-tools/35.0.0
35+
cd -
36+
2537
- name: Set Java Version
2638
uses: actions/setup-java@v3
2739
with:
2840
distribution: 'temurin'
2941
java-version: '11'
3042

31-
# .NET 6 and .NET 8 are not built-in with macos-13
43+
- name: Install Mono
44+
if: runner.os == 'macOS'
45+
shell: bash
46+
# Attempt to install Mono, allowing it to fail silently
47+
# Then ensure mono is correctly linked, overwriting any conflicting symlinks
48+
run: |
49+
brew install mono || true
50+
brew link --overwrite mono
51+
3252
- name: Install .NET SDK
53+
if: runner.os != 'Windows'
3354
uses: actions/setup-dotnet@v3
3455
with:
3556
dotnet-version: |

.github/workflows/build.yml

Lines changed: 19 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ env:
1515
jobs:
1616
build-sentry-native:
1717
name: sentry-native (${{ matrix.os }})
18-
runs-on: ${{ matrix.os }}-latest
18+
runs-on: ${{ matrix.os }}
1919
strategy:
2020
fail-fast: false
2121
matrix:
22-
os: [ubuntu, windows, macos]
22+
# Pin macos to get the version of XCode that we need: https://github.com/actions/runner-images/issues/10703
23+
os: [ubuntu-latest, windows-latest, macos-15]
2324

2425
steps:
2526
- name: Checkout
@@ -35,7 +36,7 @@ jobs:
3536
enableCrossOsArchive: true
3637

3738
- name: Free Disk Space (Ubuntu)
38-
if: matrix.os == 'ubuntu-latest'
39+
if: runner.os == 'Linux'
3940
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
4041
with:
4142
android: true
@@ -63,31 +64,20 @@ jobs:
6364
strategy:
6465
fail-fast: false
6566
matrix:
66-
os: [ubuntu-latest, windows-latest, macos-latest]
67+
# Pin macos to get the version of XCode that we need: https://github.com/actions/runner-images/issues/10703
68+
os: [ubuntu-latest, windows-latest, macos-15]
6769

6870
steps:
6971
- name: Cancel Previous Runs
7072
if: github.ref_name != 'main' && !startsWith(github.ref_name, 'release/')
7173
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # Tag: 0.12.1
7274

7375
- name: Setup Xcode
74-
if: matrix.os == 'macos-latest'
76+
if: runner.os == 'macOS'
7577
run: |
7678
sudo xcode-select --switch /Applications/Xcode_${{env.XCODE_VERSION}}.app/Contents/Developer
7779
xcodebuild -version
7880
79-
# We only use Xcode 16
80-
- name: Remove unused applications
81-
if: matrix.os == 'macos-latest'
82-
run: |
83-
df -hI /dev/disk3s1s1
84-
sudo rm -rf /Applications/Xcode_14.3.1.app
85-
sudo rm -rf /Applications/Xcode_15.0.1.app
86-
sudo rm -rf /Applications/Xcode_15.1.app
87-
sudo rm -rf /Applications/Xcode_15.2.app
88-
sudo rm -rf /Applications/Xcode_15.3.app
89-
df -hI /dev/disk3s1s1
90-
9181
- name: Checkout
9282
uses: actions/checkout@v4
9383
with:
@@ -96,7 +86,7 @@ jobs:
9686

9787
# We use macOS for the final publishing build so we we get all the iOS/macCatalyst targets in the packages
9888
- name: Set Environment Variables
99-
if: startsWith(matrix.os, 'macos')
89+
if: runner.os == 'macOS'
10090
run: echo "CI_PUBLISHING_BUILD=true" >> $GITHUB_ENV
10191

10292
- name: Download sentry-native (Linux)
@@ -133,6 +123,12 @@ jobs:
133123
- name: Restore .NET Dependencies
134124
run: dotnet restore Sentry-CI-Build-${{ runner.os }}.slnf --nologo
135125

126+
- name: Install Android SDKs
127+
if: runner.os == 'macOS'
128+
run: |
129+
dotnet build src/Sentry/Sentry.csproj -t:InstallAndroidDependencies -f:net7.0-android -p:AcceptAndroidSDKLicenses=True -p:AndroidSdkPath="/usr/local/lib/android/sdk/"
130+
dotnet build src/Sentry/Sentry.csproj -t:InstallAndroidDependencies -f:net8.0-android -p:AcceptAndroidSDKLicenses=True -p:AndroidSdkPath="/usr/local/lib/android/sdk/"
131+
136132
- name: Build
137133
run: dotnet build Sentry-CI-Build-${{ runner.os }}.slnf -c Release --no-restore --nologo -v:minimal -flp:logfile=build.log -p:CopyLocalLockFileAssemblies=true
138134

@@ -173,7 +169,8 @@ jobs:
173169
strategy:
174170
fail-fast: false
175171
matrix:
176-
os: [ubuntu-latest, windows-latest, macos-latest]
172+
# Pin macos to get the version of XCode that we need: https://github.com/actions/runner-images/issues/10703
173+
os: [ubuntu-latest, windows-latest, macos-15]
177174

178175
steps:
179176
- uses: actions/checkout@v4
@@ -183,6 +180,7 @@ jobs:
183180
sparse-checkout: |
184181
Directory.Build.props
185182
integration-test
183+
.github
186184
- name: Fetch Nuget Packages
187185
uses: actions/download-artifact@v4
188186
with:
@@ -195,26 +193,8 @@ jobs:
195193
sudo apt update
196194
sudo apt install libcurl4-openssl-dev
197195
198-
- uses: actions/setup-dotnet@v4
199-
with:
200-
dotnet-version: 8.0.x
201-
202-
- name: Setup Xcode
203-
if: matrix.os == 'macos-latest'
204-
run: |
205-
sudo xcode-select --switch /Applications/Xcode_${{env.XCODE_VERSION}}.app/Contents/Developer
206-
xcodebuild -version
207-
208-
# Needed for Android SDK setup step
209-
- uses: actions/setup-java@v4
210-
with:
211-
distribution: 'temurin'
212-
java-version: '17'
213-
214-
- name: Setup Android SDK
215-
uses: android-actions/setup-android@9fc6c4e9069bf8d3d10b2204b1fb8f6ef7065407 # v3.2.2
216-
217-
- run: dotnet workload install android maui-android
196+
- name: Setup Environment
197+
uses: ./.github/actions/environment
218198

219199
- name: Test
220200
uses: getsentry/github-workflows/sentry-cli/integration-test/@v2

.github/workflows/format-code.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ on:
1010
jobs:
1111
format-code:
1212
name: Format Code
13-
# Running on 'macos' because Linux is missing the `ios` workload
14-
# See: https://github.com/dotnet/runtime/issues/85505
15-
runs-on: macos-latest
13+
# Run on 'macos' because Linux is missing the `ios` workload: https://github.com/dotnet/runtime/issues/85505
14+
# Pin macos to get the version of XCode that we need: https://github.com/actions/runner-images/issues/10703
15+
runs-on: macos-15
1616
steps:
1717
- name: Checkout
1818
uses: actions/checkout@v4
@@ -29,12 +29,12 @@ jobs:
2929
run: dotnet tool install -g dotnet-format
3030

3131
- name: Format Code
32-
# We're excluding `./**/*OptionsSetup.cs` from the format because the tool struggles with
32+
# We're excluding `./**/*OptionsSetup.cs` from the format because the tool struggles with
3333
# source generators
3434
run: dotnet format Sentry.sln --no-restore --exclude ./modules --exclude ./**/*OptionsSetup.cs
3535

3636
# actions/checkout fetches only a single commit in a detached HEAD state. Therefore
3737
# we need to pass the current branch, otherwise we can't commit the changes.
3838
# GITHUB_HEAD_REF is the name of the head branch. GitHub Actions only sets this for PRs.
3939
- name: Commit Formatted Code
40-
run: ./scripts/commit-formatted-code.sh $GITHUB_HEAD_REF
40+
run: ./scripts/commit-formatted-code.sh $GITHUB_HEAD_REF

.github/workflows/vulnerabilities.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ on:
1010
jobs:
1111
list-vulnerable-packages:
1212
name: List vulnerable packages
13-
runs-on: macos-latest
13+
# Pin macos to get the version of XCode that we need: https://github.com/actions/runner-images/issues/10703
14+
runs-on: macos-15
1415

1516
steps:
1617
- name: Checkout

integration-test/cli.Tests.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,15 @@ Describe 'MAUI' -ForEach @(
141141
}
142142

143143
AddPackageReference $name 'Sentry.Maui'
144+
145+
if (Test-Path env:CI)
146+
{
147+
dotnet build $name/$name.csproj -t:InstallAndroidDependencies -f:$framework-android -p:AcceptAndroidSDKLicenses=True -p:AndroidSdkPath="/usr/local/lib/android/sdk/" | ForEach-Object { Write-Host $_ }
148+
if ($LASTEXITCODE -ne 0)
149+
{
150+
throw "Failed to install android dependencies."
151+
}
152+
}
144153
}
145154

146155
It "uploads symbols and sources for an Android build" {

0 commit comments

Comments
 (0)