Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin macos-15 build runner #3754

Merged
merged 16 commits into from
Nov 15, 2024
Merged

Pin macos-15 build runner #3754

merged 16 commits into from
Nov 15, 2024

Conversation

jamescrosswell
Copy link
Collaborator

Resolves #3752

#skip-changelog

Copy link
Contributor

@bitsandfoxes bitsandfoxes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ever changing flow of pin/unpin...

.github/workflows/build.yml Show resolved Hide resolved
.github/workflows/build.yml Show resolved Hide resolved
@jamescrosswell
Copy link
Collaborator Author

We're getting this error on the macos-15 runner:

Error: /Users/runner/.dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.145/targets/Microsoft.Android.Sdk.Tooling.targets(31,5): error XA5205: Cannot find `aapt`. Please install the Android SDK Build-Tools package with the `/Users/runner/Library/Android/sdk/tools/android` program. [/Users/runner/work/sentry-dotnet/sentry-dotnet/samples/Sentry.Samples.Maui/Sentry.Samples.Maui.csproj::TargetFramework=net8.0-android]

Looks like that runner doesn't (yet) include the android build tools. Workaround described here:
actions/runner-images#10814 (comment)

      # https://github.com/actions/runner-images/issues/10814
      - name: Workaround build-tools issue
        run: | 
          curl https://dl.google.com/android/repository/build-tools_r35_macosx.zip > $ANDROID_HOME/build-tools_r35_macosx.zip
          cd $ANDROID_HOME
          mkdir build-tools
          unzip build-tools_r35_macosx.zip
          mv android-15 build-tools/35.0.0

@jamescrosswell
Copy link
Collaborator Author

jamescrosswell commented Nov 14, 2024

Now getting an error about mono (when running the tests on macos):

System.IO.FileNotFoundException: Could not find 'mono' host. Make sure that 'mono' is installed on the machine and is available in PATH environment variable.

@bruno-garcia
Copy link
Member

[+] Ensure System.Reflection.Metadata is not missing

Is this a integration test flake @vaind?

image image

I actually don't understand the failure

@jamescrosswell
Copy link
Collaborator Author

Is this a integration test flake @vaind?

It's not the reason the integration test failed... that was because of this:

    /Users/runner/.dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.145/tools/Xamarin.Android.Tooling.targets(100,5): error XA5207: Could not find android.jar for API level 34. This means the Android SDK platform for API level 34 is not installed; it was expected to be in `/Users/runner/Library/Android/sdk/platforms/android-34/android.jar`. [/maui-app/maui-app.csproj::TargetFramework=net8.0-android]
    /Users/runner/.dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.145/tools/Xamarin.Android.Tooling.targets(100,5): error XA5207: You can install the missing API level by running `dotnet build -t:InstallAndroidDependencies -f net8.0-android "-p:AndroidSdkDirectory=/Users/runner/Library/Android/sdk"`, or change the project to target an API version that is installed. [/maui-app/maui-app.csproj::TargetFramework=net8.0-android]

The Android SDKs obviously aren't included on the macos-15 runner, so we need to install these ourselves. I already added that for the build step:

- 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/"

With any luck, this does the same for the integration tests:

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's kind of painful to work through all these issues since they only happen on CI... and now we're getting to the last ones (in the integration tests) there's a minimum 60-90 minute wait after each change to see if it worked.

@jamescrosswell jamescrosswell merged commit b478665 into main Nov 15, 2024
22 checks passed
@jamescrosswell jamescrosswell deleted the pin-macos-15 branch November 15, 2024 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pin macos-15 runners
3 participants