Skip to content

Commit 0c9ad51

Browse files
committed
ci: build linux-musl-x64
1 parent 566332a commit 0c9ad51

File tree

4 files changed

+146
-22
lines changed

4 files changed

+146
-22
lines changed

.github/actions/environment/action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ runs:
1111
echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" >> $GITHUB_ENV
1212
echo "DOTNET_NOLOGO=1" >> $GITHUB_ENV
1313
14+
- name: Set Environment Variables for Alpine Linux
15+
if: ${{ contains(matrix.container, 'alpine') }}
16+
shell: bash
17+
run: echo "NO_MOBILE=true" >> $GITHUB_ENV
18+
1419
# See https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md#xcode
1520
- name: Pin the Xcode Version
1621
if: runner.os == 'macOS'
@@ -19,16 +24,19 @@ runs:
1924

2025
# Needed for Android SDK setup step
2126
- uses: actions/setup-java@v3
27+
if: ${{ !matrix.container }}
2228
with:
2329
distribution: 'temurin'
2430
java-version: '17'
2531

2632
- name: Setup Android SDK
33+
if: ${{ !matrix.container }}
2734
uses: android-actions/setup-android@07976c6290703d34c16d382cb36445f98bb43b1f # v3.2.0
2835
with:
2936
log-accepted-android-sdk-licenses: false
3037

3138
- name: Set Java Version
39+
if: ${{ !matrix.container }}
3240
uses: actions/setup-java@v3
3341
with:
3442
distribution: 'temurin'

.github/workflows/build.yml

Lines changed: 50 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,20 @@ on:
1111

1212
jobs:
1313
build-sentry-native:
14-
name: sentry-native (${{ matrix.os }})
14+
name: sentry-native (${{ matrix.container || matrix.os }})
1515
runs-on: ${{ matrix.os }}
16+
container: ${{ matrix.container }}
1617
strategy:
1718
fail-fast: false
1819
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]
20+
include:
21+
- os: ubuntu-22.04 # Pin ubuntu to ensure mono is installed
22+
target: Linux
23+
- os: ubuntu-latest
24+
container: ghcr.io/getsentry/sentry-dotnet-alpine:3.21
25+
target: Linux-musl
26+
- os: windows-latest
27+
- os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
2228

2329
steps:
2430
- name: Checkout
@@ -30,14 +36,15 @@ jobs:
3036
id: cache
3137
with:
3238
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') }}
39+
key: sentry-native-${{ matrix.target || runner.os }}-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
3440
enableCrossOsArchive: true
3541

3642
- name: Remove unused applications
43+
if: ${{ !matrix.container }}
3744
uses: ./.github/actions/freediskspace
3845

3946
- name: Install build dependencies
40-
if: steps.cache.outputs.cache-hit != 'true' && runner.os == 'Linux'
47+
if: steps.cache.outputs.cache-hit != 'true' && runner.os == 'Linux' && !matrix.container
4148
run: |
4249
sudo apt update
4350
sudo apt install libcurl4-openssl-dev
@@ -48,15 +55,21 @@ jobs:
4855

4956
build:
5057
needs: build-sentry-native
51-
name: .NET (${{ matrix.os }})
58+
name: .NET (${{ matrix.container || matrix.os }})
5259
runs-on: ${{ matrix.os }}
60+
container: ${{ matrix.container }}
5361

5462
strategy:
5563
fail-fast: false
5664
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]
65+
include:
66+
- os: ubuntu-22.04 # Pin ubuntu to ensure mono is installed
67+
target: Linux
68+
- os: ubuntu-latest
69+
container: ghcr.io/getsentry/sentry-dotnet-alpine:3.21
70+
target: Linux-musl
71+
- os: windows-latest
72+
- os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
6073

6174
steps:
6275
- name: Cancel Previous Runs
@@ -70,6 +83,7 @@ jobs:
7083
fetch-depth: 2 # default is 1 and codecov needs > 1
7184

7285
- name: Remove unused applications
86+
if: ${{ !matrix.container }}
7387
uses: ./.github/actions/freediskspace
7488

7589
# We use macOS for the final publishing build so we get all the iOS/macCatalyst targets in the packages
@@ -78,13 +92,21 @@ jobs:
7892
run: echo "CI_PUBLISHING_BUILD=true" >> $GITHUB_ENV
7993

8094
- name: Download sentry-native (Linux)
81-
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'Linux') }}
95+
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.target == 'Linux') }}
8296
uses: actions/cache/restore@v4
8397
with:
8498
path: src/Sentry/Platforms/Native/sentry-native
8599
key: sentry-native-Linux-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
86100
fail-on-cache-miss: true
87101

102+
- name: Download sentry-native (Linux musl)
103+
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.target == 'Linux-musl') }}
104+
uses: actions/cache/restore@v4
105+
with:
106+
path: src/Sentry/Platforms/Native/sentry-native
107+
key: sentry-native-Linux-musl-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
108+
fail-on-cache-miss: true
109+
88110
- name: Download sentry-native (macOS)
89111
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'macOS') }}
90112
uses: actions/cache/restore@v4
@@ -106,24 +128,25 @@ jobs:
106128
uses: ./.github/actions/environment
107129

108130
- name: Build Native Dependencies
131+
if: ${{ !matrix.container }}
109132
uses: ./.github/actions/buildnative
110133

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

114137
- name: Build
115138
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
139+
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
117140

118141
- name: Upload build logs
119142
if: ${{ steps.build.outcome != 'skipped' }}
120143
uses: actions/upload-artifact@v4
121144
with:
122-
name: ${{ runner.os }}-build-logs
145+
name: ${{ matrix.target || runner.os }}-build-logs
123146
path: build.binlog
124147

125148
- 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"
149+
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"
127150

128151
- name: Upload code coverage
129152
uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d
@@ -132,14 +155,14 @@ jobs:
132155
if: failure()
133156
uses: actions/upload-artifact@v4
134157
with:
135-
name: ${{ runner.os }}-verify-test-results
158+
name: ${{ matrix.target || runner.os }}-verify-test-results
136159
path: "**/*.received.*"
137160

138161
# To save time and disk space, we only create and archive the Nuget packages when we're actually releasing.
139162

140163
- name: Create Nuget Packages
141164
if: env.CI_PUBLISHING_BUILD == 'true'
142-
run: dotnet pack Sentry-CI-Build-${{ runner.os }}.slnf -c Release --no-build --nologo
165+
run: dotnet pack Sentry-CI-Build-${{ matrix.target || runner.os }}.slnf -c Release --no-build --nologo
143166

144167
- name: Archive Nuget Packages
145168
if: env.CI_PUBLISHING_BUILD == 'true'
@@ -153,15 +176,20 @@ jobs:
153176
154177
integration-test:
155178
needs: build
156-
name: Integration test (${{ matrix.os }})
179+
name: Integration test (${{ matrix.container || matrix.os }})
157180
runs-on: ${{ matrix.os }}
181+
container: ${{ matrix.container }}
158182

159183
strategy:
160184
fail-fast: false
161185
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]
186+
include:
187+
- os: ubuntu-22.04 # Pin ubuntu to ensure mono is installed
188+
- os: ubuntu-latest
189+
container: ghcr.io/getsentry/sentry-dotnet-alpine:3.21
190+
target: Linux-musl
191+
- os: windows-latest
192+
- os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
165193

166194
steps:
167195
- uses: actions/checkout@v4
@@ -180,7 +208,7 @@ jobs:
180208
path: src
181209

182210
- name: Install build dependencies
183-
if: runner.os == 'Linux'
211+
if: runner.os == 'Linux' && !matrix.container
184212
run: |
185213
sudo apt update
186214
sudo apt install libcurl4-openssl-dev

Sentry-CI-Build-Linux-musl.slnf

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

scripts/generate-solution-filters-config.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,21 @@ filterConfigs:
4949
- "**/*DeviceTests*.csproj"
5050
- "**/*Maui.Device.TestApp.csproj"
5151

52+
- outputPath: Sentry-CI-Build-Linux-musl.slnf
53+
include:
54+
groups:
55+
- "allProjects"
56+
exclude:
57+
groups:
58+
- "macOnly"
59+
- "windowsOnly"
60+
- "artefacts"
61+
- "trimTests"
62+
patterns:
63+
- "**/*Android*.csproj"
64+
- "**/*DeviceTests*.csproj"
65+
- "**/*Maui*.csproj"
66+
5267
- outputPath: Sentry-CI-Build-macOS.slnf
5368
include:
5469
groups:

0 commit comments

Comments
 (0)