diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml new file mode 100644 index 0000000..69bc533 --- /dev/null +++ b/.github/workflows/benchmarks.yml @@ -0,0 +1,58 @@ +--- +name: Benchmarks + +on: + workflow_dispatch: {} # Allow manual triggering + push: + branches: [develop, master] + pull_request: + branches: [develop, master] + +jobs: + benchmark: + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET Core 2.1 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '2.1.x' + + - name: Setup .NET 8.0 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Disable broken NuGet source + run: > + dotnet nuget disable source gitversiontemp + --configfile src/NuGet.Config + + - name: Restore dependencies + run: > + dotnet restore + ./src/DotNet.Glob.Benchmarks/DotNet.Glob.Benchmarks.csproj + + - name: Build benchmarks + run: > + dotnet build + ./src/DotNet.Glob.Benchmarks/DotNet.Glob.Benchmarks.csproj + -c Release --no-restore -p:SignAssembly=false + + - name: Run benchmarks + run: > + dotnet run + --project ./src/DotNet.Glob.Benchmarks/DotNet.Glob.Benchmarks.csproj + -c Release --no-build -p:SignAssembly=false + --framework netcoreapp2.1 + + - name: Upload benchmark results + uses: actions/upload-artifact@v4 + if: always() + with: + name: benchmark-results + path: BenchmarkDotNet.Artifacts/**/* diff --git a/src/DotNet.Glob.Benchmarks/Program.cs b/src/DotNet.Glob.Benchmarks/Program.cs index 4971992..0332e30 100644 --- a/src/DotNet.Glob.Benchmarks/Program.cs +++ b/src/DotNet.Glob.Benchmarks/Program.cs @@ -1,4 +1,7 @@ using BenchmarkDotNet.Running; +using BenchmarkDotNet.Configs; +using BenchmarkDotNet.Exporters; +using BenchmarkDotNet.Exporters.Csv; namespace DotNet.Glob.Benchmarks { @@ -6,9 +9,13 @@ public class Program { public static void Main(string[] args) { - BenchmarkRunner.Run(); - BenchmarkRunner.Run(); - BenchmarkRunner.Run(); + var config = DefaultConfig.Instance + .With(HtmlExporter.Default) + .With(CsvExporter.Default); + + BenchmarkRunner.Run(config); + BenchmarkRunner.Run(config); + BenchmarkRunner.Run(config); //BenchmarkRunner.Run(); } }