Skip to content
Closed
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
56 changes: 29 additions & 27 deletions .github/actions/environment/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: Setup Environment
description: Sets env vars and installs dependencies
inputs:
solution-filter:
description: The solution filter the job builds, so only the workloads its projects need are installed. Without one, every project in Sentry.slnx counts.
required: false
default: ''
runs:
using: composite

Expand Down Expand Up @@ -39,37 +44,20 @@ 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)
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:
Expand All @@ -90,11 +78,25 @@ runs:
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
filter="${{ inputs.solution-filter }}"
if [[ -n "$filter" ]]; then
# dotnet workload restore doesn't accept a solution filter, but it accepts the projects in one
projects=$(grep -o '"[^"]*\.csproj"' "$filter" | tr -d '"' | sed 's#\\\\#/#g' || true)
if [[ -z "$projects" ]]; then
echo "::error::Found no projects in $filter, so there are no workloads to restore"
exit 1
fi
echo "$projects" | xargs dotnet workload restore --temp-dir "${{ runner.temp }}" --skip-sign-check
else
dotnet workload restore \
--temp-dir "${{ runner.temp }}" \
--skip-sign-check
fi
# Sentry.Android.AssemblyReader.Tests builds the Android test app. The Windows solution filters exclude both.
if [[ "$RUNNER_OS" != "Windows" ]] && { [[ -z "$filter" ]] || grep -q 'Sentry.Android.AssemblyReader.Tests' "$filter"; }; 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
42 changes: 42 additions & 0 deletions .github/actions/windows-dotnet-drive/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Windows .NET drive
description: Installs .NET and the NuGet packages on a fast drive on Windows runners
runs:
using: composite

steps:
# The Windows images keep .NET under Program Files, where workloads install as MSI packages, and the NuGet cache
# in the user profile on C:. So .NET goes next to the workspace, where workloads install as plain files. The x64
# runners put the workspace on D:, so the NuGet packages go there too. The arm64 runners only have C:, so the
# NuGet packages and TEMP go on a Dev Drive there. Defender already excludes C:\ on these images.
- name: Install .NET and NuGet packages on a fast drive
shell: pwsh
run: |
$root = Split-Path $env:GITHUB_WORKSPACE
"DOTNET_INSTALL_DIR=$root\.dotnet" >> $env:GITHUB_ENV
if ($root.StartsWith('C:'))
{
# Only volumes mounted after this get no antivirus filters
fsutil devdrv enable /disallowAv | Out-Host
'create vdisk file="C:\devdrive.vhdx" maximum=81920 type=expandable', 'select vdisk file="C:\devdrive.vhdx"', 'attach vdisk', 'convert gpt', 'create partition primary' |
Set-Content "$env:RUNNER_TEMP\diskpart.txt"
diskpart /s "$env:RUNNER_TEMP\diskpart.txt" | Out-Host
if ($LASTEXITCODE -ne 0) { throw "diskpart failed with exit code $LASTEXITCODE" }
$partition = Get-DiskImage -ImagePath 'C:\devdrive.vhdx' | Get-Disk | Get-Partition | Where-Object Type -eq 'Basic'
$partition | Format-Volume -DevDrive -Confirm:$false -Force | Out-Host
$partition | Add-PartitionAccessPath -AccessPath 'X:\'
# Right after the mount, trust can fail with "Access is denied" while the volume is still in use
for ($attempt = 1; $attempt -le 5; $attempt++)
{
fsutil devdrv trust X: | Out-Host
if ($LASTEXITCODE -eq 0) { break }
Start-Sleep -Seconds 3
}
if ($LASTEXITCODE -ne 0) { Write-Warning "Couldn't mark X: as a trusted Dev Drive, so antivirus filters may still scan it" }
fsutil devdrv query X: | Out-Host
$root = 'X:'
New-Item -ItemType Directory "$root\tmp" | Out-Null
"TEMP=$root\tmp" >> $env:GITHUB_ENV
"TMP=$root\tmp" >> $env:GITHUB_ENV
}
"NUGET_PACKAGES=$root\.nuget\packages" >> $env:GITHUB_ENV
$global:LASTEXITCODE = 0
Loading
Loading