Skip to content

Benchmarks

Benchmarks #105

Workflow file for this run

name: Benchmarks
on:
workflow_dispatch:
inputs:
benchmark_name:
description: 'Benchmark name'
default: '*'
required: false
jobs:
benchmark:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
fail-fast: false
env:
DOTNET_VERSION: 8.0.x
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_TieredPGO: 1
DOTNET_ReadyToRun: 0
DOTNET_TC_QuickJitForLoops: 1
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Nuget cache
uses: actions/cache@v3
with:
path:
~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Build
run: dotnet build -c Release
- name: Run ${{ github.event.inputs.benchmark_name }} benchmark
if: matrix.os == 'windows-latest'
run: dotnet run -c Release --no-build --filter '${{ github.event.inputs.benchmark_name }}'
working-directory: ./src/Lynx.Benchmark
- name: Run ${{ github.event.inputs.benchmark_name }} benchmark with sudo
if: matrix.os != 'windows-latest'
run: sudo dotnet run -c Release --no-build --filter '${{ github.event.inputs.benchmark_name }}'
working-directory: ./src/Lynx.Benchmark
- name: 'Upload ${{ matrix.os }} artifacts'
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ matrix.os }}-${{ github.run_number }}
# Can't include 'github.event.inputs.benchmark_name' in the name, since * is an invalid character
path: ./src/Lynx.Benchmark/BenchmarkDotNet.Artifacts/results/
if-no-files-found: error