From 591f1026ad42e55aabcce5a803f5edefbbe43087 Mon Sep 17 00:00:00 2001 From: Ricardo Colombo Oliveira Date: Sat, 24 Oct 2026 01:24:13 +0200 Subject: [PATCH 1/4] ci: stop installing Mono Every Linux and macOS job installed Mono, but nothing runs it. #4545 added it for the net4-console integration test, which ran the .NET Framework app through Mono there. Two weeks later #4461 made that test Windows-only, and the logs show it skipped on Linux and macOS. The .NET Framework unit tests only build on Windows too. On Ubuntu the install downloads 53 MB from the package mirror. On October 23 that download took 15 to 21 minutes in 4 linux-x64 legs and 1 Android device test job. The chmod after it only repaired the /usr/share/dotnet permissions that installing Mono had changed. Co-Authored-By: Claude Opus 5.5 --- .github/actions/environment/action.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.github/actions/environment/action.yml b/.github/actions/environment/action.yml index 3754453a45..6db8d2671e 100644 --- a/.github/actions/environment/action.yml +++ b/.github/actions/environment/action.yml @@ -53,23 +53,6 @@ runs: packages: platform-tools platforms;android-35 platforms;android-36 build-tools;36.0.0 log-accepted-android-sdk-licenses: false - - name: Install Mono (macOS) - 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 Mono (Ubuntu) - if: ${{ runner.os == 'Linux' && !matrix.container }} - shell: bash - run: | - sudo apt install -y mono-devel - # restore perms for actions/setup-dotnet - sudo chmod -R a+rw /usr/share/dotnet - - name: Install .NET SDK uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 with: From 6ed241b5375c7fcff30f15a21f4a583d5df75600 Mon Sep 17 00:00:00 2001 From: Ricardo Colombo Oliveira Date: Sat, 24 Oct 2026 00:29:40 +0200 Subject: [PATCH 2/4] ci: stop writing detailed text build logs The Build step wrote a detailed text log next to the binlog, 1.9 GB on macOS, and uploaded both. The binlog holds the same events and warnings, and nothing reads the text log. The MSBuild job and the integration test builds wrote one too. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/build.yml | 12 ++++-------- integration-test/common.ps1 | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b3b3ad321b..ce163f3883 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -234,7 +234,7 @@ jobs: - name: Build id: build - run: dotnet build ${{ matrix.slnf }} -c Release --no-restore --nologo -v:minimal -flp:logfile=build.log -p:CopyLocalLockFileAssemblies=true -bl:build.binlog + run: dotnet build ${{ matrix.slnf }} -c Release --no-restore --nologo -v:minimal -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 @@ -249,9 +249,7 @@ jobs: uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: ${{ matrix.rid }}-build-logs - path: | - build.log - build.binlog + path: build.binlog if-no-files-found: ignore - name: Free disk space before tests @@ -366,7 +364,7 @@ jobs: - name: Run MSBuild id: msbuild - run: msbuild Sentry-CI-Build-Windows.slnf -t:Restore,Build,Pack -p:Configuration=Release --nologo -v:minimal -flp:logfile=msbuild.log -p:CopyLocalLockFileAssemblies=true -bl:msbuild.binlog + run: msbuild Sentry-CI-Build-Windows.slnf -t:Restore,Build,Pack -p:Configuration=Release --nologo -v:minimal -p:CopyLocalLockFileAssemblies=true -bl:msbuild.binlog - name: Test MSBuild uses: getsentry/github-workflows/sentry-cli/integration-test@959162c159b866489d3fabe93327f48f9b8cb7ee # 3.4.1 @@ -378,9 +376,7 @@ jobs: uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: ${{ runner.os }}-msbuild-logs - path: | - msbuild.log - msbuild.binlog + path: msbuild.binlog if-no-files-found: ignore # Unsupported Native AOT runtimes should have SentryNative auto-disabled diff --git a/integration-test/common.ps1 b/integration-test/common.ps1 index d09721ce15..908a1bda4c 100644 --- a/integration-test/common.ps1 +++ b/integration-test/common.ps1 @@ -124,7 +124,7 @@ BeforeAll { Write-Host "::group::${action}ing $project" try { - dotnet $action $project -flp:logfile=build.log ` + dotnet $action $project ` -c Release ` --nologo ` --framework $TargetFramework ` From 881636f1c432969cac5a8a77f1325c193fdd7922 Mon Sep 17 00:00:00 2001 From: Ricardo Colombo Oliveira Date: Sun, 25 Oct 2026 16:04:02 +0100 Subject: [PATCH 3/4] ci: install only the workloads each job needs Setup Environment ran dotnet workload restore without a project, so it evaluated every project in Sentry.slnx in every job. The Linux legs without mobile targets installed android, maui-android, maui-tizen, macos, wasm-tools and wasm-tools-net9, and Windows installed ios, maccatalyst and macos. The environment action now requires the solution filters or project files the job builds, and restores only their workloads. dotnet workload restore doesn't accept a solution filter, so the step passes the projects in it, and names the filter if it finds none. Jobs that build everything pass Sentry.slnx. The Android test app is restored only when the job builds the tests that build it, and the legs without mobile targets skip Java and the Android SDK. CodeQL, format-code and verify-api no longer run a second, unfiltered workload restore after the action. Jobs that build a MAUI project still get maui-tizen, because dotnet workload restore adds it for every MAUI project. Measured on top of the other CI changes, Setup Environment went from about 190 to 89 seconds in the trim job and from 170-180 to 71-78 in the Android device test build. Co-Authored-By: Claude Opus 5.5 --- .github/actions/environment/action.yml | 47 +++++++++++++++----- .github/workflows/build.yml | 6 +++ .github/workflows/codeql-analysis.yml | 7 ++- .github/workflows/device-tests-android.yml | 5 +++ .github/workflows/device-tests-ios.yml | 2 + .github/workflows/format-code.yml | 7 ++- .github/workflows/playwright-blazor-wasm.yml | 2 +- .github/workflows/verify-api.yml | 6 +-- .github/workflows/vulnerabilities.yml | 2 + 9 files changed, 62 insertions(+), 22 deletions(-) diff --git a/.github/actions/environment/action.yml b/.github/actions/environment/action.yml index 6db8d2671e..996ce2ec22 100644 --- a/.github/actions/environment/action.yml +++ b/.github/actions/environment/action.yml @@ -1,5 +1,9 @@ name: Setup Environment description: Sets env vars and installs dependencies +inputs: + projects: + description: The solution filters and project files the job builds, separated by spaces, so only the workloads they need are installed. Jobs that build everything pass Sentry.slnx. + required: true runs: using: composite @@ -39,14 +43,14 @@ runs: # Java 21 is needed by .NET Android - name: Install Java 21 - if: ${{ !matrix.container }} + if: ${{ !matrix.container && env.NO_MOBILE != 'true' }} uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1 with: distribution: temurin java-version: '21' - name: Setup Android SDK - if: ${{ !matrix.container }} + if: ${{ !matrix.container && env.NO_MOBILE != 'true' }} uses: android-actions/setup-android@be39fa834029ff78f1a44aa3bb0819b8fc2bd8fd # v4.0.4 with: # Exclude "tools" because the emulator is not needed (nor available for Windows/Linux ARM64) @@ -70,14 +74,37 @@ runs: - name: Install .NET Workloads shell: bash + env: + PROJECTS: ${{ inputs.projects }} run: | set -euo pipefail pwd - dotnet workload restore \ - --temp-dir "${{ runner.temp }}" \ - --skip-sign-check - dotnet workload restore test/AndroidTestApp/AndroidTestApp.csproj \ - --temp-dir "${{ runner.temp }}" \ - --skip-sign-check - # Restore the Android test app explicitly to ensure runtime packs are available - dotnet restore test/AndroidTestApp/AndroidTestApp.csproj -r android-x64 --nologo || true + projects=() + for item in $PROJECTS; do + if [[ "$item" == *.slnf ]]; then + # dotnet workload restore doesn't accept a solution filter, but it accepts the projects in one + found=$(grep -o '"[^"]*\.csproj"' "$item" | tr -d '"' | sed 's#\\\\#/#g' || true) + if [[ -z "$found" ]]; then + echo "::error::Found no projects in $item, so there are no workloads to restore" + exit 1 + fi + projects+=($found) + else + projects+=("$item") + fi + done + if [[ ${#projects[@]} -eq 0 ]]; then + echo "::error::Pass the solution filters or project files this job builds as projects, so only their workloads are installed" + exit 1 + fi + dotnet workload restore "${projects[@]}" --temp-dir "${{ runner.temp }}" --skip-sign-check + # Sentry.Android.AssemblyReader.Tests builds the Android test app with an MSBuild task, not a project reference, + # so workload restore doesn't see it. grep reads a here-string because with pipefail, printf piped into grep -q + # fails with SIGPIPE when grep exits before printf has written everything. + if grep -q -E 'Sentry\.slnx$|Sentry\.Android\.AssemblyReader\.Tests|AndroidTestApp' <<< "$(printf '%s\n' "${projects[@]}")"; then + dotnet workload restore test/AndroidTestApp/AndroidTestApp.csproj \ + --temp-dir "${{ runner.temp }}" \ + --skip-sign-check + # Restore the Android test app explicitly to ensure runtime packs are available + dotnet restore test/AndroidTestApp/AndroidTestApp.csproj -r android-x64 --nologo || true + fi diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ce163f3883..88b065d748 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -145,6 +145,8 @@ jobs: - name: Setup Environment uses: ./.github/actions/environment + with: + projects: ${{ matrix.slnf }} # We use macOS for the final publishing build so we get all the iOS/macCatalyst targets in the packages - name: Set Environment Variables @@ -355,6 +357,8 @@ jobs: - name: Setup Environment uses: ./.github/actions/environment + with: + projects: Sentry-CI-Build-Windows.slnf - name: Build Native Dependencies uses: ./.github/actions/buildnative @@ -455,6 +459,8 @@ jobs: - name: Setup Environment uses: ./.github/actions/environment + with: + projects: test/Sentry.TrimTest/Sentry.TrimTest.csproj test/Sentry.MauiTrimTest/Sentry.MauiTrimTest.csproj - name: Build Native Dependencies uses: ./.github/actions/buildnative diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 2ca3af60fd..f3b0092ad5 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -33,6 +33,8 @@ jobs: - name: Setup Environment uses: ./.github/actions/environment + with: + projects: Sentry-CI-CodeQL.slnf - name: Initialize CodeQL uses: github/codeql-action/init@24c54180a607b1449ed407dd24f251e4e9147c8d # v4.38.3 @@ -40,10 +42,7 @@ jobs: languages: csharp - name: Restore .NET Dependencies - # We should be able to get rid of the restore here, if we install the correct workloads in actions/environment - run: | - dotnet workload restore - dotnet restore Sentry-CI-CodeQL.slnf --nologo + run: dotnet restore Sentry-CI-CodeQL.slnf --nologo - name: Build run: dotnet build Sentry-CI-CodeQL.slnf --no-restore --nologo diff --git a/.github/workflows/device-tests-android.yml b/.github/workflows/device-tests-android.yml index d59fa75a9f..1183a7191f 100644 --- a/.github/workflows/device-tests-android.yml +++ b/.github/workflows/device-tests-android.yml @@ -75,8 +75,11 @@ jobs: with: submodules: recursive + # The device test app references Sentry.Android.AssemblyReader.Tests, which builds the Android test app - name: Setup Environment uses: ./.github/actions/environment + with: + projects: test/Sentry.Maui.Device.TestApp/Sentry.Maui.Device.TestApp.csproj test/AndroidTestApp/AndroidTestApp.csproj - name: Build Native Dependencies uses: ./.github/actions/buildnative @@ -164,6 +167,8 @@ jobs: - name: Setup Environment uses: ./.github/actions/environment + with: + projects: integration-test/net9-maui/Sentry.Maui.Device.IntegrationTestApp.csproj - name: Select Java 21 uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1 diff --git a/.github/workflows/device-tests-ios.yml b/.github/workflows/device-tests-ios.yml index 222f969c52..f1ac40fa39 100644 --- a/.github/workflows/device-tests-ios.yml +++ b/.github/workflows/device-tests-ios.yml @@ -74,6 +74,8 @@ jobs: - name: Setup Environment uses: ./.github/actions/environment + with: + projects: test/Sentry.Maui.Device.TestApp/Sentry.Maui.Device.TestApp.csproj integration-test/net9-maui/Sentry.Maui.Device.IntegrationTestApp.csproj # See build.yml - name: Get Cocoa SDK cache key diff --git a/.github/workflows/format-code.yml b/.github/workflows/format-code.yml index 7113382488..e8099fec36 100644 --- a/.github/workflows/format-code.yml +++ b/.github/workflows/format-code.yml @@ -28,12 +28,11 @@ jobs: - name: Setup Environment uses: ./.github/actions/environment + with: + projects: Sentry.slnx - name: Restore .NET Dependencies - # We should be able to get rid of the restore here, if we install the correct workloads in actions/environment - run: | - dotnet workload restore - dotnet restore Sentry.slnx --nologo + run: dotnet restore Sentry.slnx --nologo - name: Format Code # We exclude `./**/*OptionsSetup.cs` from the format because the tool struggles with diff --git a/.github/workflows/playwright-blazor-wasm.yml b/.github/workflows/playwright-blazor-wasm.yml index ce4d6305b5..f7cd51dd8e 100644 --- a/.github/workflows/playwright-blazor-wasm.yml +++ b/.github/workflows/playwright-blazor-wasm.yml @@ -46,7 +46,7 @@ jobs: global-json-file: global.json - name: Install .NET Workloads - run: dotnet workload restore --temp-dir "${{ runner.temp }}" --skip-sign-check + run: dotnet workload restore test/Sentry.AspNetCore.Blazor.WebAssembly.PlaywrightTests/Sentry.AspNetCore.Blazor.WebAssembly.PlaywrightTests.csproj --temp-dir "${{ runner.temp }}" --skip-sign-check - name: Build run: dotnet build test/Sentry.AspNetCore.Blazor.WebAssembly.PlaywrightTests -c Release diff --git a/.github/workflows/verify-api.yml b/.github/workflows/verify-api.yml index 5e4ccf5115..3a8c6bc212 100644 --- a/.github/workflows/verify-api.yml +++ b/.github/workflows/verify-api.yml @@ -44,6 +44,8 @@ jobs: - name: Setup Environment uses: ./.github/actions/environment + with: + projects: ${{ matrix.slnf }} - name: Restore sentry-native cache id: cache-native @@ -62,9 +64,7 @@ jobs: uses: ./.github/actions/buildnative - name: Restore .NET Dependencies - run: | - dotnet workload restore - dotnet restore ${{ matrix.slnf }} --nologo + run: dotnet restore ${{ matrix.slnf }} --nologo - name: Build run: dotnet build ${{ matrix.slnf }} -c Release --no-restore --nologo -v:minimal diff --git a/.github/workflows/vulnerabilities.yml b/.github/workflows/vulnerabilities.yml index 27407afa7c..0b0ffc4d9d 100644 --- a/.github/workflows/vulnerabilities.yml +++ b/.github/workflows/vulnerabilities.yml @@ -28,6 +28,8 @@ jobs: - name: Setup Environment uses: ./.github/actions/environment + with: + projects: Sentry.slnx # We only need to restore to check for vulnerable packages - name: Restore .NET Dependencies From 61ebec88bdd83a477e8b54cad0062d5d21eb5ffa Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Tue, 27 Oct 2026 10:47:33 +1300 Subject: [PATCH 4/4] Apply suggestion from @jamescrosswell --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 88b065d748..492828b395 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -404,7 +404,7 @@ jobs: # This job is on the critical path, after the whole build-sentry matrix. aot.Tests.ps1 only publishes a # console app against the packages from the macOS build, so it needs the .NET SDK but not the full - # Setup Environment (Java, Android SDK, Mono, workloads). + # Setup Environment (Java, Android SDK, workloads). steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1