Skip to content

Commit

Permalink
Pin macos-15 build runner (#3754)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescrosswell authored Nov 15, 2024
1 parent ba94729 commit b478665
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 46 deletions.
23 changes: 22 additions & 1 deletion .github/actions/environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,35 @@ runs:
with:
log-accepted-android-sdk-licenses: false

# https://github.com/actions/runner-images/issues/10814
- name: Workaround build-tools issue
if: runner.os == 'macOS'
shell: bash
run: |
curl https://dl.google.com/android/repository/build-tools_r35_macosx.zip > $ANDROID_HOME/build-tools_r35_macosx.zip
cd $ANDROID_HOME
mkdir -p build-tools
unzip build-tools_r35_macosx.zip
mv android-15 build-tools/35.0.0
cd -
- name: Set Java Version
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'

# .NET 6 and .NET 8 are not built-in with macos-13
- name: Install Mono
if: runner.os == 'macOS'
shell: bash
# Attempt to install Mono, allowing it to fail silently
# Then ensure mono is correctly linked, overwriting any conflicting symlinks
run: |
brew install mono || true
brew link --overwrite mono
- name: Install .NET SDK
if: runner.os != 'Windows'
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
Expand Down
58 changes: 19 additions & 39 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ env:
jobs:
build-sentry-native:
name: sentry-native (${{ matrix.os }})
runs-on: ${{ matrix.os }}-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
# Pin macos to get the version of XCode that we need: https://github.com/actions/runner-images/issues/10703
os: [ubuntu-latest, windows-latest, macos-15]

steps:
- name: Checkout
Expand All @@ -35,7 +36,7 @@ jobs:
enableCrossOsArchive: true

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

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

- name: Setup Xcode
if: matrix.os == 'macos-latest'
if: runner.os == 'macOS'
run: |
sudo xcode-select --switch /Applications/Xcode_${{env.XCODE_VERSION}}.app/Contents/Developer
xcodebuild -version
# We only use Xcode 16
- name: Remove unused applications
if: matrix.os == 'macos-latest'
run: |
df -hI /dev/disk3s1s1
sudo rm -rf /Applications/Xcode_14.3.1.app
sudo rm -rf /Applications/Xcode_15.0.1.app
sudo rm -rf /Applications/Xcode_15.1.app
sudo rm -rf /Applications/Xcode_15.2.app
sudo rm -rf /Applications/Xcode_15.3.app
df -hI /dev/disk3s1s1
- name: Checkout
uses: actions/checkout@v4
with:
Expand All @@ -96,7 +86,7 @@ jobs:

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

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

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

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

steps:
- uses: actions/checkout@v4
Expand All @@ -183,6 +180,7 @@ jobs:
sparse-checkout: |
Directory.Build.props
integration-test
.github
- name: Fetch Nuget Packages
uses: actions/download-artifact@v4
with:
Expand All @@ -195,26 +193,8 @@ jobs:
sudo apt update
sudo apt install libcurl4-openssl-dev
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Setup Xcode
if: matrix.os == 'macos-latest'
run: |
sudo xcode-select --switch /Applications/Xcode_${{env.XCODE_VERSION}}.app/Contents/Developer
xcodebuild -version
# Needed for Android SDK setup step
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Setup Android SDK
uses: android-actions/setup-android@9fc6c4e9069bf8d3d10b2204b1fb8f6ef7065407 # v3.2.2

- run: dotnet workload install android maui-android
- name: Setup Environment
uses: ./.github/actions/environment

- name: Test
uses: getsentry/github-workflows/sentry-cli/integration-test/@v2
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/format-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ on:
jobs:
format-code:
name: Format Code
# Running on 'macos' because Linux is missing the `ios` workload
# See: https://github.com/dotnet/runtime/issues/85505
runs-on: macos-latest
# Run on 'macos' because Linux is missing the `ios` workload: https://github.com/dotnet/runtime/issues/85505
# Pin macos to get the version of XCode that we need: https://github.com/actions/runner-images/issues/10703
runs-on: macos-15
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -29,12 +29,12 @@ jobs:
run: dotnet tool install -g dotnet-format

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

# actions/checkout fetches only a single commit in a detached HEAD state. Therefore
# we need to pass the current branch, otherwise we can't commit the changes.
# GITHUB_HEAD_REF is the name of the head branch. GitHub Actions only sets this for PRs.
- name: Commit Formatted Code
run: ./scripts/commit-formatted-code.sh $GITHUB_HEAD_REF
run: ./scripts/commit-formatted-code.sh $GITHUB_HEAD_REF
3 changes: 2 additions & 1 deletion .github/workflows/vulnerabilities.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ on:
jobs:
list-vulnerable-packages:
name: List vulnerable packages
runs-on: macos-latest
# Pin macos to get the version of XCode that we need: https://github.com/actions/runner-images/issues/10703
runs-on: macos-15

steps:
- name: Checkout
Expand Down
9 changes: 9 additions & 0 deletions integration-test/cli.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@ Describe 'MAUI' -ForEach @(
}

AddPackageReference $name 'Sentry.Maui'

if (Test-Path env:CI)
{
dotnet build $name/$name.csproj -t:InstallAndroidDependencies -f:$framework-android -p:AcceptAndroidSDKLicenses=True -p:AndroidSdkPath="/usr/local/lib/android/sdk/" | ForEach-Object { Write-Host $_ }
if ($LASTEXITCODE -ne 0)
{
throw "Failed to install android dependencies."
}
}
}

It "uploads symbols and sources for an Android build" {
Expand Down

0 comments on commit b478665

Please sign in to comment.