Skip to content

Commit 0c17634

Browse files
Improve CI for NuGet packages (#114)
* Improve CI for NuGet packages - Bump actions/setup-dotnet to v4. - Install SDK version from global.json in CI. - Build with the .NET 8 SDK. - Enable deterministic builds. - Include source link and symbols. - Add NuGet package metadata (tags, URLs, release notes etc.). - Use `Directory.Build.props` to simplify CI. - Use Artifacts Output. - Add package README for Pyroscope. - Add package logo. - Fix markdownlint warnings in package READMEs. * Publish artifacts in CI Publish the NuGet packages produced by the CI builds as workflow artifacts. * Disable fail-fast Run all matrix values if any fail. * Remove redundant comment .NET 7 isn't in support anymore anyway. * Fix integration tests Fix missing files into compilation in Dockerfile. * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent cc7ab39 commit 0c17634

16 files changed

+118
-58
lines changed

.github/workflows/build_managed_helper.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ jobs:
2020
with:
2121
submodules: 'true'
2222
persist-credentials: false
23-
- uses: actions/setup-dotnet@v3
24-
with:
25-
dotnet-version: '6.0'
23+
- uses: actions/setup-dotnet@v4
2624
- run: dotnet build -c Release
2725
working-directory: Pyroscope
26+
- name: Publish NuGet packages
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: packages
30+
path: ./Pyroscope/artifacts/package/release
31+
if-no-files-found: error

.github/workflows/build_tracing_packages.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@ jobs:
1919
with:
2020
submodules: 'true'
2121
persist-credentials: false
22-
- uses: actions/setup-dotnet@v3
23-
with:
24-
dotnet-version: '6.0'
22+
- uses: actions/setup-dotnet@v4
2523
- run: dotnet build -c Release
2624
working-directory: Pyroscope/Pyroscope.OpenTracing
25+
- name: Publish NuGet packages
26+
uses: actions/upload-artifact@v4
27+
with:
28+
name: packages-OpenTracing
29+
path: ./Pyroscope/artifacts/package/release
30+
if-no-files-found: error
2731
build-opentelemetry-lib:
2832
runs-on: ubuntu-latest
2933
steps:
@@ -32,8 +36,12 @@ jobs:
3236
with:
3337
submodules: 'true'
3438
persist-credentials: false
35-
- uses: actions/setup-dotnet@v3
36-
with:
37-
dotnet-version: '6.0'
39+
- uses: actions/setup-dotnet@v4
3840
- run: dotnet build -c Release
3941
working-directory: Pyroscope/Pyroscope.OpenTelemetry
42+
- name: Publish NuGet packages
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: packages-OpenTelemetry
46+
path: ./Pyroscope/artifacts/package/release
47+
if-no-files-found: error

.github/workflows/integration_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ jobs:
4141
needs: build-profiler-images
4242
runs-on: ubuntu-latest
4343
strategy:
44+
fail-fast: false
4445
matrix:
4546
dotnet_version:
4647
- '8.0'
47-
# - '7.0' # this does not work at the moment
4848
- '6.0'
4949
flavour:
5050
- glibc

.github/workflows/tag_managed_helper.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,28 @@ jobs:
2222
with:
2323
submodules: 'true'
2424
persist-credentials: false
25-
- uses: actions/setup-dotnet@v3
26-
with:
27-
dotnet-version: '6.0'
25+
- uses: actions/setup-dotnet@v4
2826
- run: make bump_version && git diff --exit-code
2927
- run: dotnet build -c Release
3028
working-directory: Pyroscope
29+
- name: Publish NuGet packages
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: packages
33+
path: ./Pyroscope/artifacts/package/release
34+
if-no-files-found: error
3135
- uses: grafana/shared-workflows/actions/get-vault-secrets@28361cdb22223e5f1e34358c86c20908e7248760
3236
with:
3337
repo_secrets: |
3438
NUGET_API_KEY=nuget:api_key
3539
- name: Publish the package to nuget.org
36-
run: dotnet nuget push Pyroscope/bin/Release/*.nupkg -k "${NUGET_API_KEY}" -s https://api.nuget.org/v3/index.json
37-
working-directory: Pyroscope
40+
run: dotnet nuget push ./Pyroscope/artifacts/package/release/*.nupkg -k "${NUGET_API_KEY}" -s https://api.nuget.org/v3/index.json
3841
env:
3942
NUGET_API_KEY: ${{ env.NUGET_API_KEY }}
4043
- name: Release
4144
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
4245
if: startsWith(github.ref, 'refs/tags/')
4346
with:
4447
files: |
45-
./Pyroscope/Pyroscope/bin/Release/net6.0/Pyroscope.dll
46-
./Pyroscope/Pyroscope/bin/Release/Pyroscope*.nupkg
48+
./Pyroscope/artifacts/bin/Pyroscope/release/Pyroscope.dll
49+
./Pyroscope/artifacts/package/release/Pyroscope*.nupkg

.github/workflows/tag_tracing_opentelemetry_helper.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,27 @@ jobs:
1818
with:
1919
submodules: 'true'
2020
persist-credentials: false
21-
- uses: actions/setup-dotnet@v3
22-
with:
23-
dotnet-version: '6.0'
21+
- uses: actions/setup-dotnet@v4
2422
- run: dotnet build -c Release
2523
working-directory: Pyroscope/Pyroscope.OpenTelemetry
24+
- name: Publish NuGet packages
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: packages
28+
path: ./Pyroscope/artifacts/package/release
29+
if-no-files-found: error
2630
- uses: grafana/shared-workflows/actions/get-vault-secrets@28361cdb22223e5f1e34358c86c20908e7248760
2731
with:
2832
repo_secrets: |
2933
NUGET_API_KEY=nuget:api_key
3034
- name: Publish the package to nuget.org
31-
run: dotnet nuget push bin/Release/*.nupkg -k "${NUGET_API_KEY}" -s https://api.nuget.org/v3/index.json
32-
working-directory: Pyroscope/Pyroscope.OpenTelemetry
35+
run: dotnet nuget push ./Pyroscope/artifacts/package/release/*.nupkg -k "${NUGET_API_KEY}" -s https://api.nuget.org/v3/index.json
3336
env:
3437
NUGET_API_KEY: ${{ env.NUGET_API_KEY }}
3538
- name: Release
3639
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
3740
if: startsWith(github.ref, 'refs/tags/')
3841
with:
3942
files: |
40-
./Pyroscope/Pyroscope.OpenTelemetry/bin/Release/net6.0/Pyroscope.OpenTelemetry.dll
41-
./Pyroscope/Pyroscope.OpenTelemetry/bin/Release/Pyroscope.OpenTelemetry*.nupkg
43+
./Pyroscope/artifacts/bin/Pyroscope.OpenTelemetry/release/Pyroscope.OpenTelemetry.dll
44+
./Pyroscope/artifacts/package/release/Pyroscope.OpenTelemetry*.nupkg

.github/workflows/tag_tracing_opentracing_helper.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,27 @@ jobs:
1818
with:
1919
submodules: 'true'
2020
persist-credentials: false
21-
- uses: actions/setup-dotnet@v3
22-
with:
23-
dotnet-version: '6.0'
21+
- uses: actions/setup-dotnet@v4
2422
- run: dotnet build -c Release
2523
working-directory: Pyroscope/Pyroscope.OpenTracing
24+
- name: Publish NuGet packages
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: packages
28+
path: ./Pyroscope/artifacts/package/release
29+
if-no-files-found: error
2630
- uses: grafana/shared-workflows/actions/get-vault-secrets@28361cdb22223e5f1e34358c86c20908e7248760
2731
with:
2832
repo_secrets: |
2933
NUGET_API_KEY=nuget:api_key
3034
- name: Publish the package to nuget.org
31-
run: dotnet nuget push bin/Release/*.nupkg -k "${NUGET_API_KEY}" -s https://api.nuget.org/v3/index.json
32-
working-directory: Pyroscope/Pyroscope.OpenTracing
35+
run: dotnet nuget push ./Pyroscope/artifacts/package/release/*.nupkg -k "${NUGET_API_KEY}" -s https://api.nuget.org/v3/index.json
3336
env:
3437
NUGET_API_KEY: ${{ env.NUGET_API_KEY }}
3538
- name: Release
3639
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
3740
if: startsWith(github.ref, 'refs/tags/')
3841
with:
3942
files: |
40-
./Pyroscope/Pyroscope.OpenTracing/bin/Release/net6.0/Pyroscope.OpenTracing.dll
41-
./Pyroscope/Pyroscope.OpenTracing/bin/Release/Pyroscope.OpenTracing*.nupkg
43+
./Pyroscope/artifacts/bin/Pyroscope.OpenTracing/release/Pyroscope.OpenTracing.dll
44+
./Pyroscope/artifacts/package/release/Pyroscope.OpenTracing*.nupkg

Pyroscope/Directory.Build.props

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<Project>
2+
<PropertyGroup>
3+
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
4+
<Authors>Grafana Labs</Authors>
5+
<ChecksumAlgorithm>SHA256</ChecksumAlgorithm>
6+
<Company>Grafana Labs</Company>
7+
<ContinuousIntegrationBuild Condition=" '$(CI)' != '' ">true</ContinuousIntegrationBuild>
8+
<Copyright>Copyright (c) Grafana Labs</Copyright>
9+
<Deterministic>true</Deterministic>
10+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
11+
<GenerateDocumentationFile>false</GenerateDocumentationFile>
12+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
13+
<ImplicitUsings>enable</ImplicitUsings>
14+
<LangVersion>10</LangVersion>
15+
<NeutralLanguage>en-US</NeutralLanguage>
16+
<Nullable>enable</Nullable>
17+
<PackageIcon>package-logo.png</PackageIcon>
18+
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
19+
<PackageProjectUrl>https://grafana.com/docs/pyroscope/latest/configure-client/language-sdks/dotnet/</PackageProjectUrl>
20+
<PackageReleaseNotes>https://github.com/grafana/pyroscope-dotnet/releases</PackageReleaseNotes>
21+
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
22+
<PackageTags>Grafana;Profiles;Pyroscope</PackageTags>
23+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
24+
<RepositoryType>git</RepositoryType>
25+
<RepositoryUrl>https://github.com/grafana/pyroscope-dotnet</RepositoryUrl>
26+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
27+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
28+
<UseArtifactsOutput>true</UseArtifactsOutput>
29+
</PropertyGroup>
30+
<ItemGroup>
31+
<None Include="$(MSBuildThisFileDirectory)/$(PackageIcon)" Pack="true" PackagePath="" />
32+
</ItemGroup>
33+
</Project>

Pyroscope/Pyroscope.OpenTelemetry/Pyroscope.OpenTelemetry.csproj

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@
22

33
<PropertyGroup>
44
<TargetFramework>net6.0</TargetFramework>
5-
<ImplicitUsings>enable</ImplicitUsings>
6-
<Nullable>enable</Nullable>
7-
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
85
<PackageVersion>0.3.0</PackageVersion>
96
<AssemblyVersion>0.3.0</AssemblyVersion>
107
<FileVersion>0.3.0</FileVersion>
11-
<LangVersion>10</LangVersion>
128
<PackageReadmeFile>README.md</PackageReadmeFile>
13-
</PropertyGroup>
9+
<PackageTags>Grafana;OpenTelemetry;Profiles;Pyroscope</PackageTags>
10+
</PropertyGroup>
1411

1512
<ItemGroup>
1613
<PackageReference Include="OpenTelemetry" Version="1.8.0" />
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
## Span profiles for OpenTelemetry
1+
# Span profiles for OpenTelemetry
22

33
This package enables applications that already rely on [OpenTelemetry](https://opentelemetry.io/docs/instrumentation/net/getting-started/) for distributed tracing and Pyroscope for continuous profiling to link the tracing and profiling data together.
44

5-
See https://grafana.com/docs/pyroscope/latest/configure-client/trace-span-profiles/ for more information.
5+
See [Link tracing and profiling with Span Profiles](https://grafana.com/docs/pyroscope/latest/configure-client/trace-span-profiles/) for more information.
6+
7+
## Prerequisites
68

7-
### Prerequisites
89
- Your .NET application is instrumented with [Pyroscope's profiler](https://grafana.com/docs/pyroscope/latest/configure-client/language-sdks/dotnet/)
910
- Your .NET application is instrumented (manually) with [OpenTelemetry](https://opentelemetry.io/docs/instrumentation/net/getting-started/)
1011

11-
### Integration
12+
## Integration
1213

1314
Add the following package to your project:
1415

@@ -19,7 +20,6 @@ dotnet add package Pyroscope.OpenTelemetry
1920
Register the `PyroscopeSpanProcessor` in your OpenTelemetry integration:
2021

2122
```csharp
22-
2323
builder.Services.AddOpenTelemetry()
2424
.WithTracing(b =>
2525
{
@@ -29,5 +29,4 @@ builder.Services.AddOpenTelemetry()
2929
.AddOtlpExporter()
3030
.AddProcessor(new Pyroscope.OpenTelemetry.PyroscopeSpanProcessor());
3131
});
32-
3332
```

Pyroscope/Pyroscope.OpenTracing/Pyroscope.OpenTracing.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22

33
<PropertyGroup>
44
<TargetFramework>net6.0</TargetFramework>
5-
<ImplicitUsings>enable</ImplicitUsings>
6-
<Nullable>enable</Nullable>
7-
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
85
<PackageVersion>0.3.0</PackageVersion>
96
<AssemblyVersion>0.3.0</AssemblyVersion>
107
<FileVersion>0.3.0</FileVersion>
11-
<LangVersion>10</LangVersion>
128
<PackageReadmeFile>README.md</PackageReadmeFile>
9+
<PackageTags>Grafana;OpenTracing;Profiles;Pyroscope</PackageTags>
1310
</PropertyGroup>
1411

1512
<ItemGroup>

0 commit comments

Comments
 (0)