Skip to content

Commit

Permalink
nuget package info, github action
Browse files Browse the repository at this point in the history
  • Loading branch information
migajek committed Jan 5, 2024
1 parent 0a78bef commit 9b3e315
Show file tree
Hide file tree
Showing 11 changed files with 137 additions and 2 deletions.
File renamed without changes.
45 changes: 45 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: .NET

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:


jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore ./src/
- name: Build
run: dotnet build ./src/ --no-restore
- name: Test
run: dotnet test ./src/ --no-build --verbosity normal

publish:
needs: build
runs-on: ubuntu-latest
environment: nuget
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
- name: Build
run: dotnet pack --configuration Release ./src/ -o ./
- name: Publish
env:
API_KEY: ${{ secrets.NUGET_API_KEY }}
run: dotnet nuget push --api-key $API_KEY --source https://api.nuget.org/v3/index.json *.nupkg

File renamed without changes.
Empty file added readme.md
Empty file.
14 changes: 14 additions & 0 deletions samples/PicoSampleApp/PicoSampleApp.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\PicoProfiler\PicoProfiler.csproj" />
</ItemGroup>

</Project>
37 changes: 37 additions & 0 deletions samples/PicoSampleApp/PicoSampleApp.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34322.80
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PicoSampleApp", "PicoSampleApp.csproj", "{CAB0DF19-22C1-4D00-AFF3-8B289B0880BF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PicoProfiler.Logging", "..\..\src\PicoProfiler.Logging\PicoProfiler.Logging.csproj", "{BEECD099-7C81-4133-8FCE-1C56B1BDED88}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PicoProfiler", "..\..\src\PicoProfiler\PicoProfiler.csproj", "{F56EF65C-0B2B-4364-9ADB-092FD1BDF715}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CAB0DF19-22C1-4D00-AFF3-8B289B0880BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CAB0DF19-22C1-4D00-AFF3-8B289B0880BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CAB0DF19-22C1-4D00-AFF3-8B289B0880BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CAB0DF19-22C1-4D00-AFF3-8B289B0880BF}.Release|Any CPU.Build.0 = Release|Any CPU
{BEECD099-7C81-4133-8FCE-1C56B1BDED88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BEECD099-7C81-4133-8FCE-1C56B1BDED88}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BEECD099-7C81-4133-8FCE-1C56B1BDED88}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BEECD099-7C81-4133-8FCE-1C56B1BDED88}.Release|Any CPU.Build.0 = Release|Any CPU
{F56EF65C-0B2B-4364-9ADB-092FD1BDF715}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F56EF65C-0B2B-4364-9ADB-092FD1BDF715}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F56EF65C-0B2B-4364-9ADB-092FD1BDF715}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F56EF65C-0B2B-4364-9ADB-092FD1BDF715}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CF720C8F-3DB6-475E-81AE-D9567D54D46D}
EndGlobalSection
EndGlobal
19 changes: 19 additions & 0 deletions samples/PicoSampleApp/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using PicoProfiler.ConsoleOutput;

namespace PicoSampleApp;

internal class Program
{
static async Task Main(string[] args)
{
await RunConsoleSample();
}

private static async Task RunConsoleSample()
{
using var _ = PicoProfilerConsoleOutput.Start();
await MyTimeConsumingWork();
}

private static async Task MyTimeConsumingWork() => await Task.Delay(TimeSpan.FromMilliseconds(374));
}
6 changes: 6 additions & 0 deletions src/PicoProfiler.Logging/PicoProfiler.Logging.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<PackageId>PicoProfiler.Logging</PackageId>
<PackageTags>PicoProfiler;Profiler;Pico;Logging;Micro;Profiling;Lightweight;Performance</PackageTags>
<PackageProjectUrl>https://github.com/migajek/PicoProfiler</PackageProjectUrl>
<Description>Integrates PicoProfiler with Microsoft.Extensions.Logging</Description>
<Version>0.2.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ private ConsoleOutputConfiguration()
}

public ConsoleMessageFactoryWithActionName DefaultMessageFactory { get; set; }
= (actionName, elapsedTime) => "";
= (actionName, elapsedTime) => $"{actionName} finished in {elapsedTime.TotalMilliseconds:.##} ms";
}
8 changes: 8 additions & 0 deletions src/PicoProfiler/ConsoleOutput/PicoProfilerConsoleOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,12 @@ public static IPicoProfiler Create([CallerMemberName] string actionName = null,

return Profiler.Create(time => Console.WriteLine(factory(actionName, time)));
}

public static IPicoProfiler Start([CallerMemberName] string actionName = null,

Check warning on line 15 in src/PicoProfiler/ConsoleOutput/PicoProfilerConsoleOutput.cs

View workflow job for this annotation

GitHub Actions / build

Cannot convert null literal to non-nullable reference type.

Check warning on line 15 in src/PicoProfiler/ConsoleOutput/PicoProfilerConsoleOutput.cs

View workflow job for this annotation

GitHub Actions / build

Cannot convert null literal to non-nullable reference type.

Check warning on line 15 in src/PicoProfiler/ConsoleOutput/PicoProfilerConsoleOutput.cs

View workflow job for this annotation

GitHub Actions / publish

Cannot convert null literal to non-nullable reference type.
ConsoleMessageFactoryWithActionName? messageFactory = null)
{
var profiler = Create(actionName, messageFactory);
profiler.Start();
return profiler;
}
}
8 changes: 7 additions & 1 deletion src/PicoProfiler/PicoProfiler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<PackageId>PicoProfiler</PackageId>
<PackageTags>PicoProfiler;Profiler;Pico;Micro;Profiling;Lightweight;Peformance</PackageTags>
<PackageProjectUrl>https://github.com/migajek/PicoProfiler</PackageProjectUrl>
<Description>Tiny abstraction layer over Stopwatch, leveraging IDisposable and enabling using pattern usage</Description>
<Version>0.2.0</Version>
</PropertyGroup>

</Project>
</Project>

0 comments on commit 9b3e315

Please sign in to comment.