Skip to content
Closed
Show file tree
Hide file tree
Changes from 7 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
3 changes: 3 additions & 0 deletions .github/actions/environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ runs:

# Needed for Android SDK setup step
- uses: actions/setup-java@v3
if: ${{ !matrix.runner.container }}
with:
distribution: 'temurin'
java-version: '17'

- name: Setup Android SDK
if: ${{ !matrix.runner.container }}
uses: android-actions/setup-android@07976c6290703d34c16d382cb36445f98bb43b1f # v3.2.0
with:
log-accepted-android-sdk-licenses: false
Expand All @@ -41,6 +43,7 @@ runs:
cd -
- name: Set Java Version
if: ${{ !matrix.runner.container }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
Expand Down
96 changes: 77 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,29 @@ on:

jobs:
build-sentry-native:
name: sentry-native (${{ matrix.os }})
runs-on: ${{ matrix.os }}
name: sentry-native (${{ matrix.runner.container || matrix.runner.os }})
runs-on: ${{ matrix.runner.os }}
container: ${{ matrix.runner.container }}
strategy:
fail-fast: false
matrix:
# Pin ubuntu to ensure mono is installed
# Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
os: [ubuntu-22.04, windows-latest, macos-15]
runner: [
{os: ubuntu-22.04},
{os: ubuntu-latest, container: alpine:3.19, target: Linux-musl},
{os: windows-latest},
{os: macos-15}
]

steps:
- name: Install build dependencies for Alpine Linux
if: ${{ startsWith(matrix.runner.container, 'alpine') }}
run: |
apk update
apk add bash build-base cmake curl-dev git powershell sudo tar wget
git config --global --add safe.directory $GITHUB_WORKSPACE

- name: Checkout
uses: actions/checkout@v4

Expand All @@ -30,14 +43,15 @@ jobs:
id: cache
with:
path: src/Sentry/Platforms/Native/sentry-native
key: sentry-native-${{ runner.os }}-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
key: sentry-native-${{ matrix.runner.target || runner.os }}-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
enableCrossOsArchive: true

- name: Remove unused applications
if: ${{ !matrix.runner.container }}
uses: ./.github/actions/freediskspace

- name: Install build dependencies
if: steps.cache.outputs.cache-hit != 'true' && runner.os == 'Linux'
if: steps.cache.outputs.cache-hit != 'true' && runner.os == 'Linux' && !matrix.runner.container
run: |
sudo apt update
sudo apt install libcurl4-openssl-dev
Expand All @@ -48,28 +62,46 @@ jobs:

build:
needs: build-sentry-native
name: .NET (${{ matrix.os }})
runs-on: ${{ matrix.os }}
name: .NET (${{ matrix.runner.container || matrix.runner.os }})
runs-on: ${{ matrix.runner.os }}
container: ${{ matrix.runner.container }}

strategy:
fail-fast: false
matrix:
# Pin ubuntu to ensure mono is installed
# Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
os: [ubuntu-22.04, windows-latest, macos-15]
runner: [
{os: ubuntu-22.04},
{os: ubuntu-latest, container: alpine:edge, target: Linux-musl},
{os: windows-latest},
{os: macos-15}
]

steps:
- name: Cancel Previous Runs
if: github.ref_name != 'main' && !startsWith(github.ref_name, 'release/')
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # Tag: 0.12.1

- name: Install build dependencies for Alpine Linux
if: ${{ startsWith(matrix.runner.container, 'alpine') }}
run: |
apk update
apk add bash build-base cmake curl-dev git icu mono openjdk11 powershell sudo tar wget
git config --global --add safe.directory $GITHUB_WORKSPACE
# Grpc.Tools protoc is prebuilt with glibc (https://github.com/grpc/grpc/issues/24188#issuecomment-1403435551)
apk add grpc-plugins
echo "PROTOBUF_PROTOC=/usr/bin/protoc" >> $GITHUB_ENV
echo "GRPC_PROTOC_PLUGIN=/usr/bin/grpc_csharp_plugin" >> $GITHUB_ENV

- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 2 # default is 1 and codecov needs > 1

- name: Remove unused applications
if: ${{ !matrix.runner.container }}
uses: ./.github/actions/freediskspace

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

- name: Download sentry-native (Linux)
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'Linux') }}
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'Linux' && !matrix.runner.container) }}
uses: actions/cache/restore@v4
with:
path: src/Sentry/Platforms/Native/sentry-native
key: sentry-native-Linux-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
fail-on-cache-miss: true

- name: Download sentry-native (Linux musl)
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (startsWith(matrix.runner.container, 'alpine')) }}
uses: actions/cache/restore@v4
with:
path: src/Sentry/Platforms/Native/sentry-native
key: sentry-native-Linux-musl-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
fail-on-cache-miss: true

- name: Download sentry-native (macOS)
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'macOS') }}
uses: actions/cache/restore@v4
Expand All @@ -106,24 +146,25 @@ jobs:
uses: ./.github/actions/environment

- name: Build Native Dependencies
if: ${{ ! matrix.runner.container }}
uses: ./.github/actions/buildnative

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

- name: Build
id: build
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
run: dotnet build Sentry-CI-Build-${{ matrix.runner.target || runner.os }}.slnf -c Release --no-restore --nologo -v:minimal -flp:logfile=build.log -p:CopyLocalLockFileAssemblies=true -bl:build.binlog

- name: Upload build logs
if: ${{ steps.build.outcome != 'skipped' }}
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-build-logs
name: ${{ matrix.runner.target || runner.os }}-build-logs
path: build.binlog

- name: Test
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"
run: dotnet test Sentry-CI-Build-${{ matrix.runner.target || runner.os }}.slnf -c Release --no-build --nologo -l GitHubActions -l "trx;LogFilePrefix=testresults_${{ runner.os }}" --collect "XPlat Code Coverage"

- name: Upload code coverage
uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d
Expand All @@ -132,14 +173,14 @@ jobs:
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-verify-test-results
name: ${{ matrix.runner.target || runner.os }}-verify-test-results
path: "**/*.received.*"

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

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

- name: Archive Nuget Packages
if: env.CI_PUBLISHING_BUILD == 'true'
Expand All @@ -153,17 +194,34 @@ jobs:

integration-test:
needs: build
name: Integration test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
name: Integration test (${{ matrix.runner.container || matrix.runner.os }})
runs-on: ${{ matrix.runner.os }}
container: ${{ matrix.runner.container }}

strategy:
fail-fast: false
matrix:
# Pin ubuntu to ensure mono is installed
# Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
os: [ubuntu-22.04, windows-latest, macos-15]
runner: [
{os: ubuntu-22.04},
{os: ubuntu-latest, container: alpine:edge, target: Linux-musl},
{os: windows-latest},
{os: macos-15}
]

steps:
- name: Install build dependencies for Alpine Linux
if: ${{ startsWith(matrix.runner.container, 'alpine') }}
run: |
apk update
apk add bash build-base cmake curl-dev git icu mono openjdk11 powershell sudo tar wget
git config --global --add safe.directory $GITHUB_WORKSPACE
# Grpc.Tools protoc is prebuilt with glibc (https://github.com/grpc/grpc/issues/24188#issuecomment-1403435551)
apk add grpc-plugins
echo "PROTOBUF_PROTOC=/usr/bin/protoc" >> $GITHUB_ENV
echo "GRPC_PROTOC_PLUGIN=/usr/bin/grpc_csharp_plugin" >> $GITHUB_ENV

- uses: actions/checkout@v4
with:
# We only check out what is absolutely necessary to reduce a chance of local files impacting
Expand All @@ -180,7 +238,7 @@ jobs:
path: src

- name: Install build dependencies
if: runner.os == 'Linux'
if: runner.os == 'Linux' && !matrix.runner.container
run: |
sudo apt update
sudo apt install libcurl4-openssl-dev
Expand Down
74 changes: 74 additions & 0 deletions Sentry-CI-Build-Linux-musl.slnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"solution": {
"path": ".generated.NoMobile.sln",
"projects": [
"benchmarks\\Sentry.Benchmarks\\Sentry.Benchmarks.csproj",
"samples\\Sentry.Samples.AspNetCore.Basic\\Sentry.Samples.AspNetCore.Basic.csproj",
"samples\\Sentry.Samples.AspNetCore.Blazor.Server\\Sentry.Samples.AspNetCore.Blazor.Server.csproj",
"samples\\Sentry.Samples.AspNetCore.Blazor.Wasm\\Sentry.Samples.AspNetCore.Blazor.Wasm.csproj",
"samples\\Sentry.Samples.AspNetCore.Grpc\\Sentry.Samples.AspNetCore.Grpc.csproj",
"samples\\Sentry.Samples.AspNetCore.Mvc\\Sentry.Samples.AspNetCore.Mvc.csproj",
"samples\\Sentry.Samples.AspNetCore.Serilog\\Sentry.Samples.AspNetCore.Serilog.csproj",
"samples\\Sentry.Samples.AspNetCore.WebAPI.Profiling\\Sentry.Samples.AspNetCore.WebAPI.Profiling.csproj",
"samples\\Sentry.Samples.Aws.Lambda.AspNetCoreServer\\Sentry.Samples.Aws.Lambda.AspNetCoreServer.csproj",
"samples\\Sentry.Samples.Azure.Functions.Worker\\Sentry.Samples.Azure.Functions.Worker.csproj",
"samples\\Sentry.Samples.Console.Basic\\Sentry.Samples.Console.Basic.csproj",
"samples\\Sentry.Samples.Console.Customized\\Sentry.Samples.Console.Customized.csproj",
"samples\\Sentry.Samples.Console.HeapDump\\Sentry.Samples.Console.HeapDump.csproj",
"samples\\Sentry.Samples.Console.Native\\Sentry.Samples.Console.Native.csproj",
"samples\\Sentry.Samples.Console.Profiling\\Sentry.Samples.Console.Profiling.csproj",
"samples\\Sentry.Samples.EntityFramework\\Sentry.Samples.EntityFramework.csproj",
"samples\\Sentry.Samples.GenericHost\\Sentry.Samples.GenericHost.csproj",
"samples\\Sentry.Samples.Google.Cloud.Functions\\Sentry.Samples.Google.Cloud.Functions.csproj",
"samples\\Sentry.Samples.GraphQL.Client.Http\\Sentry.Samples.GraphQL.Client.Http.csproj",
"samples\\Sentry.Samples.GraphQL.Server\\Sentry.Samples.GraphQL.Server.csproj",
"samples\\Sentry.Samples.Hangfire\\Sentry.Samples.Hangfire.csproj",
"samples\\Sentry.Samples.Log4Net\\Sentry.Samples.Log4Net.csproj",
"samples\\Sentry.Samples.ME.Logging\\Sentry.Samples.ME.Logging.csproj",
"samples\\Sentry.Samples.NLog\\Sentry.Samples.NLog.csproj",
"samples\\Sentry.Samples.OpenTelemetry.AspNetCore\\Sentry.Samples.OpenTelemetry.AspNetCore.csproj",
"samples\\Sentry.Samples.OpenTelemetry.Console\\Sentry.Samples.OpenTelemetry.Console.csproj",
"samples\\Sentry.Samples.Serilog\\Sentry.Samples.Serilog.csproj",
"src\\Sentry.Analyzers\\Sentry.Analyzers.csproj",
"src\\Sentry.AspNet\\Sentry.AspNet.csproj",
"src\\Sentry.AspNetCore.Blazor.WebAssembly\\Sentry.AspNetCore.Blazor.WebAssembly.csproj",
"src\\Sentry.AspNetCore.Grpc\\Sentry.AspNetCore.Grpc.csproj",
"src\\Sentry.AspNetCore\\Sentry.AspNetCore.csproj",
"src\\Sentry.Azure.Functions.Worker\\Sentry.Azure.Functions.Worker.csproj",
"src\\Sentry.DiagnosticSource\\Sentry.DiagnosticSource.csproj",
"src\\Sentry.EntityFramework\\Sentry.EntityFramework.csproj",
"src\\Sentry.Extensions.Logging\\Sentry.Extensions.Logging.csproj",
"src\\Sentry.Google.Cloud.Functions\\Sentry.Google.Cloud.Functions.csproj",
"src\\Sentry.Hangfire\\Sentry.Hangfire.csproj",
"src\\Sentry.Log4Net\\Sentry.Log4Net.csproj",
"src\\Sentry.NLog\\Sentry.NLog.csproj",
"src\\Sentry.OpenTelemetry\\Sentry.OpenTelemetry.csproj",
"src\\Sentry.Profiling\\Sentry.Profiling.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
"src\\Sentry.SourceGenerators\\Sentry.SourceGenerators.csproj",
"src\\Sentry\\Sentry.csproj",
"test\\Sentry.Analyzers.Tests\\Sentry.Analyzers.Tests.csproj",
"test\\Sentry.AspNet.Tests\\Sentry.AspNet.Tests.csproj",
"test\\Sentry.AspNetCore.Grpc.Tests\\Sentry.AspNetCore.Grpc.Tests.csproj",
"test\\Sentry.AspNetCore.Tests\\Sentry.AspNetCore.Tests.csproj",
"test\\Sentry.AspNetCore.TestUtils\\Sentry.AspNetCore.TestUtils.csproj",
"test\\Sentry.Azure.Functions.Worker.Tests\\Sentry.Azure.Functions.Worker.Tests.csproj",
"test\\Sentry.DiagnosticSource.IntegrationTests\\Sentry.DiagnosticSource.IntegrationTests.csproj",
"test\\Sentry.DiagnosticSource.Tests\\Sentry.DiagnosticSource.Tests.csproj",
"test\\Sentry.EntityFramework.Tests\\Sentry.EntityFramework.Tests.csproj",
"test\\Sentry.Extensions.Logging.Tests\\Sentry.Extensions.Logging.Tests.csproj",
"test\\Sentry.Google.Cloud.Functions.Tests\\Sentry.Google.Cloud.Functions.Tests.csproj",
"test\\Sentry.Hangfire.Tests\\Sentry.Hangfire.Tests.csproj",
"test\\Sentry.Log4Net.Tests\\Sentry.Log4Net.Tests.csproj",
"test\\Sentry.NLog.Tests\\Sentry.NLog.Tests.csproj",
"test\\Sentry.OpenTelemetry.Tests\\Sentry.OpenTelemetry.Tests.csproj",
"test\\Sentry.Profiling.Tests\\Sentry.Profiling.Tests.csproj",
"test\\Sentry.Serilog.Tests\\Sentry.Serilog.Tests.csproj",
"test\\Sentry.SourceGenerators.Tests\\Sentry.SourceGenerators.Tests.csproj",
"test\\Sentry.Testing.CrashableApp\\Sentry.Testing.CrashableApp.csproj",
"test\\Sentry.Testing\\Sentry.Testing.csproj",
"test\\Sentry.Tests\\Sentry.Tests.csproj",
"test\\SingleFileTestApp\\SingleFileTestApp.csproj"
]
}
}
9 changes: 8 additions & 1 deletion scripts/build-sentry-native.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ try
}
elseif ($IsLinux)
{
$outDir += '/linux-x64'
if ((ldd --version 2>&1) -match 'musl')
{
$outDir += '/linux-musl-x64'
}
else
{
$outDir += '/linux-x64'
}
}
else
{
Expand Down
17 changes: 17 additions & 0 deletions scripts/generate-solution-filters-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,20 @@ filterConfigs:
- "**/*Bindings*"
- "**/*DeviceTests*"
- "**/*TestApp*"

# WIP: SentryNoMobile.slnf minus *Mac* for testing Linux musl CI w/o Android
- outputPath: Sentry-CI-Build-Linux-musl.slnf
solution: .generated.NoMobile.sln
include:
groups:
- "allProjects"
exclude:
groups:
- "artefacts"
- "trimTests"
patterns:
- "**/*Bindings*.csproj"
- "**/*Android*.csproj"
- "**/*Ios*.csproj"
- "**/*Mac*.csproj"
- "**/*Maui*.csproj"
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
<NativeLibrary Include="Gdi32.lib" />
</ItemGroup>

<ItemGroup Condition="'$(FrameworkSupportsNative)' == 'true' and '$(RuntimeIdentifier)' == 'linux-x64'">
<ItemGroup Condition="'$(FrameworkSupportsNative)' == 'true' and ('$(RuntimeIdentifier)' == 'linux-x64' or '$(RuntimeIdentifier)' == 'linux-musl-x64')">
<DirectPInvoke Include="sentry-native" />
<NativeLibrary Include="$(MSBuildThisFileDirectory)..\sentry-native\linux-x64\libsentry-native.a" />
<NativeLibrary Include="$(MSBuildThisFileDirectory)..\sentry-native\$(RuntimeIdentifier)\libsentry-native.a" />
<!-- See: https://github.com/dotnet/runtime/issues/97414 -->
<NativeSystemLibrary Include="curl" />
</ItemGroup>
Expand Down