Skip to content

Commit d622ff2

Browse files
authored
build on windows-11-arm (#4187)
1 parent 4821fe7 commit d622ff2

File tree

9 files changed

+200
-36
lines changed

9 files changed

+200
-36
lines changed

.github/actions/environment/action.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,36 @@ runs:
1111
echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" >> $GITHUB_ENV
1212
echo "DOTNET_NOLOGO=1" >> $GITHUB_ENV
1313
14+
# zstd is needed for cross OS actions/cache but missing from windows-11-arm
15+
# https://github.com/actions/partner-runner-images/issues/99
16+
- name: Install zstd on Windows ARM64
17+
if: runner.os == 'Windows' && runner.arch == 'ARM64'
18+
shell: pwsh
19+
run: choco install zstandard
20+
1421
# See https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md#xcode
1522
- name: Pin the Xcode Version
1623
if: runner.os == 'macOS'
1724
shell: bash
1825
run: sudo xcode-select --switch /Applications/Xcode_16.2.app
1926

20-
# Needed for Android SDK setup step
21-
- uses: actions/setup-java@v3
27+
# Java 17 is needed for Android SDK setup step
28+
- name: Install Java 17
29+
uses: actions/setup-java@v4
2230
with:
23-
distribution: 'temurin'
31+
distribution: ${{ runner.os == 'Windows' && runner.arch == 'ARM64' && 'microsoft' || 'temurin' }}
2432
java-version: '17'
2533

2634
- name: Setup Android SDK
2735
uses: android-actions/setup-android@07976c6290703d34c16d382cb36445f98bb43b1f # v3.2.0
2836
with:
2937
log-accepted-android-sdk-licenses: false
3038

31-
- name: Set Java Version
32-
uses: actions/setup-java@v3
39+
# Java 11 is needed by .NET Android
40+
- name: Install Java 11
41+
uses: actions/setup-java@v4
3342
with:
34-
distribution: 'temurin'
43+
distribution: ${{ runner.os == 'Windows' && runner.arch == 'ARM64' && 'microsoft' || 'temurin' }}
3544
java-version: '11'
3645

3746
- name: Install Mono

.github/workflows/build.yml

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,31 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
# Pin ubuntu to ensure mono is installed
20-
# Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
21-
os: [ubuntu-22.04, windows-latest, macos-15]
19+
include:
20+
- os: ubuntu-22.04 # Pin ubuntu to ensure mono is installed
21+
- os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
22+
- os: windows-latest
23+
- os: windows-11-arm
24+
target: Windows-arm64
2225

2326
steps:
2427
- name: Checkout
2528
uses: actions/checkout@v4
2629

2730
- run: git submodule update --init modules/sentry-native
2831

32+
# zstd is needed for cross OS actions/cache but missing from windows-11-arm
33+
# https://github.com/actions/partner-runner-images/issues/99
34+
- name: Install zstd on Windows ARM64
35+
if: runner.os == 'Windows' && runner.arch == 'ARM64'
36+
shell: pwsh
37+
run: choco install zstandard
38+
2939
- uses: actions/cache@v4
3040
id: cache
3141
with:
3242
path: src/Sentry/Platforms/Native/sentry-native
33-
key: sentry-native-${{ runner.os }}-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
43+
key: sentry-native-${{ matrix.target || runner.os }}-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
3444
enableCrossOsArchive: true
3545

3646
- name: Remove unused applications
@@ -54,9 +64,12 @@ jobs:
5464
strategy:
5565
fail-fast: false
5666
matrix:
57-
# Pin ubuntu to ensure mono is installed
58-
# Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
59-
os: [ubuntu-22.04, windows-latest, macos-15]
67+
include:
68+
- os: ubuntu-22.04 # Pin ubuntu to ensure mono is installed
69+
- os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
70+
- os: windows-latest
71+
- os: windows-11-arm
72+
target: Windows-arm64
6073

6174
steps:
6275
- name: Cancel Previous Runs
@@ -72,6 +85,9 @@ jobs:
7285
- name: Remove unused applications
7386
uses: ./.github/actions/freediskspace
7487

88+
- name: Setup Environment
89+
uses: ./.github/actions/environment
90+
7591
# We use macOS for the final publishing build so we get all the iOS/macCatalyst targets in the packages
7692
- name: Set Environment Variables
7793
if: runner.os == 'macOS'
@@ -94,36 +110,42 @@ jobs:
94110
fail-on-cache-miss: true
95111

96112
- name: Download sentry-native (Windows)
97-
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'Windows') }}
113+
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'Windows' && runner.arch == 'X64') }}
98114
uses: actions/cache/restore@v4
99115
with:
100116
path: src/Sentry/Platforms/Native/sentry-native
101117
key: sentry-native-Windows-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
102118
fail-on-cache-miss: true
103119
enableCrossOsArchive: true
104120

105-
- name: Setup Environment
106-
uses: ./.github/actions/environment
121+
- name: Download sentry-native (Windows arm64)
122+
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'Windows' && runner.arch == 'ARM64') }}
123+
uses: actions/cache/restore@v4
124+
with:
125+
path: src/Sentry/Platforms/Native/sentry-native
126+
key: sentry-native-Windows-arm64-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
127+
fail-on-cache-miss: true
128+
enableCrossOsArchive: true
107129

108130
- name: Build Native Dependencies
109131
uses: ./.github/actions/buildnative
110132

111133
- name: Restore .NET Dependencies
112-
run: dotnet restore Sentry-CI-Build-${{ runner.os }}.slnf --nologo
134+
run: dotnet restore Sentry-CI-Build-${{ matrix.target || runner.os }}.slnf --nologo
113135

114136
- name: Build
115137
id: build
116-
run: dotnet build Sentry-CI-Build-${{ runner.os }}.slnf -c Release --no-restore --nologo -v:minimal -flp:logfile=build.log -p:CopyLocalLockFileAssemblies=true -bl:build.binlog
138+
run: dotnet build Sentry-CI-Build-${{ matrix.target || runner.os }}.slnf -c Release --no-restore --nologo -v:minimal -flp:logfile=build.log -p:CopyLocalLockFileAssemblies=true -bl:build.binlog
117139

118140
- name: Upload build logs
119141
if: ${{ steps.build.outcome != 'skipped' }}
120142
uses: actions/upload-artifact@v4
121143
with:
122-
name: ${{ runner.os }}-build-logs
144+
name: ${{ matrix.target || runner.os }}-build-logs
123145
path: build.binlog
124146

125147
- name: Test
126-
run: dotnet test Sentry-CI-Build-${{ runner.os }}.slnf -c Release --no-build --nologo -l GitHubActions -l "trx;LogFilePrefix=testresults_${{ runner.os }}" --collect "XPlat Code Coverage"
148+
run: dotnet test Sentry-CI-Build-${{ matrix.target || runner.os }}.slnf -c Release --no-build --nologo -l GitHubActions -l "trx;LogFilePrefix=testresults_${{ runner.os }}" --collect "XPlat Code Coverage"
127149

128150
- name: Upload code coverage
129151
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24
@@ -132,16 +154,16 @@ jobs:
132154
if: failure()
133155
uses: actions/upload-artifact@v4
134156
with:
135-
name: ${{ runner.os }}-verify-test-results
157+
name: ${{ matrix.target || runner.os }}-verify-test-results
136158
path: "**/*.received.*"
137159

138-
# To save time and disk space, we only create and archive the Nuget packages when we're actually releasing.
160+
# To save time and disk space, we only create and archive the NuGet packages when we're actually releasing.
139161

140-
- name: Create Nuget Packages
162+
- name: Create NuGet Packages
141163
if: env.CI_PUBLISHING_BUILD == 'true'
142-
run: dotnet pack Sentry-CI-Build-${{ runner.os }}.slnf -c Release --no-build --nologo
164+
run: dotnet pack Sentry-CI-Build-${{ matrix.target || runner.os }}.slnf -c Release --no-build --nologo
143165

144-
- name: Archive Nuget Packages
166+
- name: Archive NuGet Packages
145167
if: env.CI_PUBLISHING_BUILD == 'true'
146168
uses: actions/upload-artifact@v4
147169
with:
@@ -159,9 +181,11 @@ jobs:
159181
strategy:
160182
fail-fast: false
161183
matrix:
162-
# Pin ubuntu to ensure mono is installed
163-
# Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
164-
os: [ubuntu-22.04, windows-latest, macos-15]
184+
include:
185+
- os: ubuntu-22.04 # Pin ubuntu to ensure mono is installed
186+
- os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
187+
- os: windows-latest
188+
- os: windows-11-arm
165189

166190
steps:
167191
- uses: actions/checkout@v4
@@ -173,7 +197,7 @@ jobs:
173197
integration-test
174198
.github
175199
176-
- name: Fetch Nuget Packages
200+
- name: Fetch NuGet Packages
177201
uses: actions/download-artifact@v4
178202
with:
179203
name: ${{ github.sha }}
@@ -195,6 +219,7 @@ jobs:
195219

196220

197221
trim-analysis:
222+
needs: build-sentry-native
198223
name: Trim analysis
199224
runs-on: macos-15
200225

@@ -205,7 +230,7 @@ jobs:
205230
submodules: recursive
206231
fetch-depth: 2 # default is 1 and codecov needs > 1
207232

208-
# We use macOS for the final publishing build so we get all the iOS/macCatalyst targets in the packages
233+
# We use macOS for the final publishing build so we get all the iOS/Mac Catalyst targets in the packages
209234
- name: Set Environment Variables
210235
run: echo "CI_PUBLISHING_BUILD=true" >> $GITHUB_ENV
211236

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Features
66

77
- .NET MAUI integration with CommunityToolkit.Mvvm Async Relay Commands can now be auto spanned with the new package Sentry.Maui.CommunityToolkit.Mvvm ([#4125](https://github.com/getsentry/sentry-dotnet/pull/4125))
8+
- Support for Windows ARM64 with Native AOT ([#4187](https://github.com/getsentry/sentry-dotnet/pull/4187))
89

910
### Fixes
1011

Sentry-CI-Build-Windows-arm64.slnf

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"solution": {
3+
"path": "Sentry.sln",
4+
"projects": [
5+
"benchmarks\\Sentry.Benchmarks\\Sentry.Benchmarks.csproj",
6+
"modules\\perfview\\src\\FastSerialization\\FastSerialization.csproj",
7+
"modules\\perfview\\src\\TraceEvent\\TraceEvent.csproj",
8+
"samples\\Sentry.Samples.AspNetCore.Basic\\Sentry.Samples.AspNetCore.Basic.csproj",
9+
"samples\\Sentry.Samples.AspNetCore.Blazor.Server\\Sentry.Samples.AspNetCore.Blazor.Server.csproj",
10+
"samples\\Sentry.Samples.AspNetCore.Blazor.Wasm\\Sentry.Samples.AspNetCore.Blazor.Wasm.csproj",
11+
"samples\\Sentry.Samples.AspNetCore.Grpc\\Sentry.Samples.AspNetCore.Grpc.csproj",
12+
"samples\\Sentry.Samples.AspNetCore.Mvc\\Sentry.Samples.AspNetCore.Mvc.csproj",
13+
"samples\\Sentry.Samples.AspNetCore.Serilog\\Sentry.Samples.AspNetCore.Serilog.csproj",
14+
"samples\\Sentry.Samples.AspNetCore.WebAPI.Profiling\\Sentry.Samples.AspNetCore.WebAPI.Profiling.csproj",
15+
"samples\\Sentry.Samples.Aws.Lambda.AspNetCoreServer\\Sentry.Samples.Aws.Lambda.AspNetCoreServer.csproj",
16+
"samples\\Sentry.Samples.Azure.Functions.Worker\\Sentry.Samples.Azure.Functions.Worker.csproj",
17+
"samples\\Sentry.Samples.Console.Basic\\Sentry.Samples.Console.Basic.csproj",
18+
"samples\\Sentry.Samples.Console.Customized\\Sentry.Samples.Console.Customized.csproj",
19+
"samples\\Sentry.Samples.Console.HeapDump\\Sentry.Samples.Console.HeapDump.csproj",
20+
"samples\\Sentry.Samples.Console.Native\\Sentry.Samples.Console.Native.csproj",
21+
"samples\\Sentry.Samples.Console.Profiling\\Sentry.Samples.Console.Profiling.csproj",
22+
"samples\\Sentry.Samples.EntityFramework\\Sentry.Samples.EntityFramework.csproj",
23+
"samples\\Sentry.Samples.GenericHost\\Sentry.Samples.GenericHost.csproj",
24+
"samples\\Sentry.Samples.Google.Cloud.Functions\\Sentry.Samples.Google.Cloud.Functions.csproj",
25+
"samples\\Sentry.Samples.GraphQL.Client.Http\\Sentry.Samples.GraphQL.Client.Http.csproj",
26+
"samples\\Sentry.Samples.GraphQL.Server\\Sentry.Samples.GraphQL.Server.csproj",
27+
"samples\\Sentry.Samples.Hangfire\\Sentry.Samples.Hangfire.csproj",
28+
"samples\\Sentry.Samples.Log4Net\\Sentry.Samples.Log4Net.csproj",
29+
"samples\\Sentry.Samples.Maui\\Sentry.Samples.Maui.csproj",
30+
"samples\\Sentry.Samples.ME.Logging\\Sentry.Samples.ME.Logging.csproj",
31+
"samples\\Sentry.Samples.NLog\\Sentry.Samples.NLog.csproj",
32+
"samples\\Sentry.Samples.OpenTelemetry.AspNetCore\\Sentry.Samples.OpenTelemetry.AspNetCore.csproj",
33+
"samples\\Sentry.Samples.OpenTelemetry.Console\\Sentry.Samples.OpenTelemetry.Console.csproj",
34+
"samples\\Sentry.Samples.Serilog\\Sentry.Samples.Serilog.csproj",
35+
"src\\Sentry.Analyzers\\Sentry.Analyzers.csproj",
36+
"src\\Sentry.Android.AssemblyReader\\Sentry.Android.AssemblyReader.csproj",
37+
"src\\Sentry.AspNet\\Sentry.AspNet.csproj",
38+
"src\\Sentry.AspNetCore.Blazor.WebAssembly\\Sentry.AspNetCore.Blazor.WebAssembly.csproj",
39+
"src\\Sentry.AspNetCore.Grpc\\Sentry.AspNetCore.Grpc.csproj",
40+
"src\\Sentry.AspNetCore\\Sentry.AspNetCore.csproj",
41+
"src\\Sentry.Azure.Functions.Worker\\Sentry.Azure.Functions.Worker.csproj",
42+
"src\\Sentry.Bindings.Android\\Sentry.Bindings.Android.csproj",
43+
"src\\Sentry.DiagnosticSource\\Sentry.DiagnosticSource.csproj",
44+
"src\\Sentry.EntityFramework\\Sentry.EntityFramework.csproj",
45+
"src\\Sentry.Extensions.Logging\\Sentry.Extensions.Logging.csproj",
46+
"src\\Sentry.Google.Cloud.Functions\\Sentry.Google.Cloud.Functions.csproj",
47+
"src\\Sentry.Hangfire\\Sentry.Hangfire.csproj",
48+
"src\\Sentry.Log4Net\\Sentry.Log4Net.csproj",
49+
"src\\Sentry.Maui.CommunityToolkit.Mvvm\\Sentry.Maui.CommunityToolkit.Mvvm.csproj",
50+
"src\\Sentry.Maui\\Sentry.Maui.csproj",
51+
"src\\Sentry.NLog\\Sentry.NLog.csproj",
52+
"src\\Sentry.OpenTelemetry\\Sentry.OpenTelemetry.csproj",
53+
"src\\Sentry.Profiling\\Sentry.Profiling.csproj",
54+
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
55+
"src\\Sentry.SourceGenerators\\Sentry.SourceGenerators.csproj",
56+
"src\\Sentry\\Sentry.csproj",
57+
"test\\Sentry.Analyzers.Tests\\Sentry.Analyzers.Tests.csproj",
58+
"test\\Sentry.Android.AssemblyReader.Tests\\Sentry.Android.AssemblyReader.Tests.csproj",
59+
"test\\Sentry.AspNet.Tests\\Sentry.AspNet.Tests.csproj",
60+
"test\\Sentry.AspNetCore.Grpc.Tests\\Sentry.AspNetCore.Grpc.Tests.csproj",
61+
"test\\Sentry.AspNetCore.Tests\\Sentry.AspNetCore.Tests.csproj",
62+
"test\\Sentry.AspNetCore.TestUtils\\Sentry.AspNetCore.TestUtils.csproj",
63+
"test\\Sentry.Azure.Functions.Worker.Tests\\Sentry.Azure.Functions.Worker.Tests.csproj",
64+
"test\\Sentry.Extensions.Logging.Tests\\Sentry.Extensions.Logging.Tests.csproj",
65+
"test\\Sentry.Google.Cloud.Functions.Tests\\Sentry.Google.Cloud.Functions.Tests.csproj",
66+
"test\\Sentry.Hangfire.Tests\\Sentry.Hangfire.Tests.csproj",
67+
"test\\Sentry.Log4Net.Tests\\Sentry.Log4Net.Tests.csproj",
68+
"test\\Sentry.Maui.CommunityToolkit.Mvvm.Tests\\Sentry.Maui.CommunityToolkit.Mvvm.Tests.csproj",
69+
"test\\Sentry.Maui.Tests\\Sentry.Maui.Tests.csproj",
70+
"test\\Sentry.NLog.Tests\\Sentry.NLog.Tests.csproj",
71+
"test\\Sentry.OpenTelemetry.Tests\\Sentry.OpenTelemetry.Tests.csproj",
72+
"test\\Sentry.Profiling.Tests\\Sentry.Profiling.Tests.csproj",
73+
"test\\Sentry.Serilog.Tests\\Sentry.Serilog.Tests.csproj",
74+
"test\\Sentry.SourceGenerators.Tests\\Sentry.SourceGenerators.Tests.csproj",
75+
"test\\Sentry.Testing.CrashableApp\\Sentry.Testing.CrashableApp.csproj",
76+
"test\\Sentry.Testing\\Sentry.Testing.csproj",
77+
"test\\Sentry.Tests\\Sentry.Tests.csproj",
78+
"test\\SingleFileTestApp\\SingleFileTestApp.csproj"
79+
]
80+
}
81+
}

integration-test/runtime.Tests.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,14 @@ internal class FakeTransport : ITransport
4949
}
5050
elseif ($IsWindows)
5151
{
52-
return "./console-app/bin/Release/$framework/win-x64/publish/console-app.exe"
52+
if ("Arm64".Equals([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString()))
53+
{
54+
return "./console-app/bin/Release/$framework/win-arm64/publish/console-app.exe"
55+
}
56+
else
57+
{
58+
return "./console-app/bin/Release/$framework/win-x64/publish/console-app.exe"
59+
}
5360
}
5461
else
5562
{

scripts/build-sentry-native.ps1

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,19 @@ try
2121
}
2222
elseif ($IsWindows)
2323
{
24-
$outDir += '/win-x64'
2524
$additionalArgs += @('-C', 'src/Sentry/Platforms/Native/windows-config.cmake')
2625
$actualBuildDir = "$buildDir/RelWithDebInfo"
2726
$libPrefix = ''
2827
$libExtension = '.lib'
28+
29+
if ("Arm64".Equals([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString()))
30+
{
31+
$outDir += '/win-arm64'
32+
}
33+
else
34+
{
35+
$outDir += '/win-x64'
36+
}
2937
}
3038
elseif ($IsLinux)
3139
{

scripts/generate-solution-filters-config.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,29 @@ filterConfigs:
8383
- "**/*Sentry.Samples.Android.csproj"
8484
- "**/*OpenTelemetry.AspNet.csproj"
8585

86+
- outputPath: Sentry-CI-Build-Windows-arm64.slnf
87+
include:
88+
groups:
89+
- "allProjects"
90+
patterns:
91+
- "modules/perfview/**/TraceEvent.csproj"
92+
- "modules/perfview/**/FastSerialization.csproj"
93+
exclude:
94+
groups:
95+
- "macOnly"
96+
- "artefacts"
97+
- "trimTests"
98+
patterns:
99+
- "**/*AndroidTestApp.csproj"
100+
- "**/*DeviceTests*.csproj"
101+
- "**/*Sentry.Maui.Device.TestApp.csproj"
102+
- "**/*Sentry.Samples.Android.csproj"
103+
- "**/*OpenTelemetry.AspNet.csproj"
104+
# Depends on LocalDb or SQLitePCL which are x64
105+
- "**/*Sentry.DiagnosticSource.IntegrationTests.csproj"
106+
- "**/*Sentry.DiagnosticSource.Tests.csproj"
107+
- "**/*Sentry.EntityFramework.Tests.csproj"
108+
86109
- outputPath: Sentry-CI-CodeQL.slnf
87110
include:
88111
groups:

0 commit comments

Comments
 (0)