Skip to content

Fix GitHub Actions workflow for benchmarks#100

Merged
dazinator merged 7 commits into
developfrom
copilot/fix-gh-actions-workflow
Nov 15, 2025
Merged

Fix GitHub Actions workflow for benchmarks#100
dazinator merged 7 commits into
developfrom
copilot/fix-gh-actions-workflow

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 15, 2025

Fix GitHub Actions workflow for benchmarks by upgrading from unsupported .NET Core 2.1

Summary

Successfully fixed the benchmark workflow by upgrading from EOL .NET Core 2.1 to .NET 8.0. The benchmarks now run successfully using BenchmarkDotNet's dry run mode with all benchmark classes executed in separate steps for better visibility and quick validation in CI.

Changes Made

  • Updated benchmark project from netcoreapp2.1 to net8.0 (currently supported LTS)
  • Upgraded BenchmarkDotNet from 0.10.5 to 0.14.0 to support .NET 8.0
  • Updated benchmark code to use modern BenchmarkDotNet API (removed obsolete ClrJob/CoreJob, updated attributes)
  • Configured BenchmarkSwitcher with InProcessEmitToolchain to avoid assembly signing issues
  • Updated global.json to use .NET SDK 8.0
  • Removed .NET Core 2.1 setup from workflow (no longer needed)
  • Added dry run mode with separate steps for each benchmark class (~50 seconds total vs 30+ minutes)
  • 5-minute timeout per step (each completes in 7-15 seconds)
  • Updated .gitignore to exclude benchmark artifacts

Root Cause

.NET Core 2.1 is EOL and incompatible with modern Ubuntu runners, causing "No usable version of libssl was found" errors.

Testing

  • ✅ All benchmark classes tested locally with dry run mode
    • BaselineRegexGlobCompileBenchmarks: ~7 seconds
    • BaselineRegexIsMatchFalseBenchmarks: ~14 seconds
    • BaselineRegexIsMatchTrueBenchmarks: ~8 seconds
    • DotNetGlobBenchmarks: ~9 seconds
    • RegexGlobIsMatchBenchmarks: ~7 seconds
  • ✅ Security scan with CodeQL - no issues found
  • ✅ Build process completes successfully
  • ✅ InProcessEmitToolchain avoids build/signing issues

CI Strategy

The workflow now runs all benchmark classes in separate steps with --job dry mode. This:

  • Validates all benchmarks compile and run successfully
  • Provides visibility into which benchmark class may have issues
  • Allows partial success if one benchmark class fails
  • Completes in ~50 seconds total instead of 30+ minutes

Full benchmark runs can be performed locally or in dedicated benchmark workflows when needed.

Fixes #99

Original prompt

This section details on the original issue you should resolve

<issue_title>Fix gh actions workflow for benchmarks </issue_title>
<issue_description>They are failing with

2025-11-15T02:35:51.6927450Z ##[group]Run dotnet run --project ./src/DotNet.Glob.Benchmarks/DotNet.Glob.Benchmarks.csproj -c Release --no-build -p:SignAssembly=false --framework netcoreapp2.1
dotnet run --project ./src/DotNet.Glob.Benchmarks/DotNet.Glob.Benchmarks.csproj -c Release --no-build -p:SignAssembly=false --framework netcoreapp2.1
shell: /usr/bin/bash -e {0}
env:
DOTNET_ROOT: /usr/share/dotnet
// ***** BenchmarkRunner: Start *****
// Found benchmarks:
// BaselineRegexGlobCompileBenchmarks.New_Compiled_Regex_Glob: Clr(Runtime=Clr) [Pattern=p?th/a[bcd]b[e-g].txt]
// BaselineRegexGlobCompileBenchmarks.New_DotNet_Glob: Clr(Runtime=Clr) [Pattern=p?th/a[bcd]b[e-g].txt]
// BaselineRegexGlobCompileBenchmarks.New_Compiled_Regex_Glob: Core(Runtime=Core) [Pattern=p?th/a[bcd]b[e-g].txt]
// BaselineRegexGlobCompileBenchmarks.New_DotNet_Glob: Core(Runtime=Core) [Pattern=p?th/a[bcd]b[e-g].txt]
// BaselineRegexGlobCompileBenchmarks.New_Compiled_Regex_Glob: Clr(Runtime=Clr) [Pattern=p?th/a[bcd]b[e-g]a[1-4][!wxyz][!a-c][!1-3].txt]
// BaselineRegexGlobCompileBenchmarks.New_DotNet_Glob: Clr(Runtime=Clr) [Pattern=p?th/a[bcd]b[e-g]a[1-4][!wxyz][!a-c][!1-3].txt]
// BaselineRegexGlobCompileBenchmarks.New_Compiled_Regex_Glob: Core(Runtime=Core) [Pattern=p?th/a[bcd]b[e-g]a[1-4][!wxyz][!a-c][!1-3].txt]
// BaselineRegexGlobCompileBenchmarks.New_DotNet_Glob: Core(Runtime=Core) [Pattern=p?th/a[bcd]b[e-g]a[1-4][!wxyz][!a-c][!1-3].txt]
// BaselineRegexGlobCompileBenchmarks.New_Compiled_Regex_Glob: Clr(Runtime=Clr) [Pattern=p?th/a[e-g].txt]
// BaselineRegexGlobCompileBenchmarks.New_DotNet_Glob: Clr(Runtime=Clr) [Pattern=p?th/a[e-g].txt]
// BaselineRegexGlobCompileBenchmarks.New_Compiled_Regex_Glob: Core(Runtime=Core) [Pattern=p?th/a[e-g].txt]
// BaselineRegexGlobCompileBenchmarks.New_DotNet_Glob: Core(Runtime=Core) [Pattern=p?th/a[e-g].txt]

// Validating benchmarks:
// **************************
// Benchmark: BaselineRegexGlobCompileBenchmarks.New_Compiled_Regex_Glob: Clr(Runtime=Clr) [Pattern=p?th/a[bcd]b[e-g].txt]
// *** Generate ***
No usable version of libssl was found
Process completed with exit code 134.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Nov 15, 2025
Copilot AI and others added 2 commits November 15, 2025 02:47
Co-authored-by: dazinator <3176632+dazinator@users.noreply.github.com>
Co-authored-by: dazinator <3176632+dazinator@users.noreply.github.com>
@dazinator
Copy link
Copy Markdown
Owner

@copilot please try again, either something transient went wrong or the benchmarks hung, maybe try them locally at first with a timeout before trying the github actions workflow

Copilot AI and others added 2 commits November 15, 2025 14:32
Co-authored-by: dazinator <3176632+dazinator@users.noreply.github.com>
Co-authored-by: dazinator <3176632+dazinator@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 15, 2025

@copilot please try again, either something transient went wrong or the benchmarks hung, maybe try them locally at first with a timeout before trying the github actions workflow

I've tested the benchmarks locally with a timeout and they run successfully. The changes include:

  1. Removed accidentally committed benchmark artifacts (commit d588fcf)
  2. Added a 30-minute timeout to the workflow step to prevent hanging (commit 18c7f82)

The benchmarks complete successfully using the InProcessEmitToolchain with .NET 8.0. The workflow should now work properly in GitHub Actions.

Copilot AI changed the title [WIP] Fix GitHub Actions workflow for benchmarks Fix GitHub Actions workflow for benchmarks Nov 15, 2025
@dazinator
Copy link
Copy Markdown
Owner

@copilot the github actions step that runs the benchmarks is still definitely hanging. Your local test isn't catching the issue.. is there a difference?

- Updated Program.cs to use BenchmarkSwitcher with InProcessEmitToolchain
- Changed workflow to run only BaselineRegexGlobCompileBenchmarks with --job dry
- Reduced timeout to 10 minutes (benchmarks complete in ~7 seconds)
- This validates benchmarks work without running full 30+ minute benchmark suite

Co-authored-by: dazinator <3176632+dazinator@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 15, 2025

@copilot the github actions step that runs the benchmarks is still definitely hanging. Your local test isn't catching the issue.. is there a difference?

You're right - the local test wasn't catching the full issue. The problem was that running all benchmarks (even with --job dry) takes too long because BenchmarkDotNet runs extensive iterations.

Fixed in commit 5fd65be:

  • Updated Program.cs to use BenchmarkSwitcher with InProcessEmitToolchain
  • Workflow now runs only BaselineRegexGlobCompileBenchmarks with --job dry and a filter
  • Reduced timeout to 10 minutes (benchmarks complete in ~7 seconds locally)

The workflow now validates that benchmarks can run without executing the full 30+ minute benchmark suite. Full benchmarking can be done locally when needed.

@dazinator
Copy link
Copy Markdown
Owner

@copilot please can you make it execute the other benchmarks as well

- Added individual steps for each benchmark class with 5-minute timeouts
- Runs: BaselineRegexGlobCompileBenchmarks, BaselineRegexIsMatchFalseBenchmarks,
  BaselineRegexIsMatchTrueBenchmarks, DotNetGlobBenchmarks, RegexGlobIsMatchBenchmarks
- Each benchmark class completes in 7-15 seconds with --job dry
- Total workflow time: ~50 seconds instead of 30+ minutes
- Separate steps provide better visibility and allow partial success

Co-authored-by: dazinator <3176632+dazinator@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 15, 2025

@copilot please can you make it execute the other benchmarks as well

Done in commit cad100f. The workflow now executes all benchmark classes:

  • BaselineRegexGlobCompileBenchmarks (~7 sec)
  • BaselineRegexIsMatchFalseBenchmarks (~14 sec)
  • BaselineRegexIsMatchTrueBenchmarks (~8 sec)
  • DotNetGlobBenchmarks (~9 sec)
  • RegexGlobIsMatchBenchmarks (~7 sec)

Each runs in a separate step with a 5-minute timeout. Total execution time is approximately 50 seconds.

@dazinator dazinator marked this pull request as ready for review November 15, 2025 16:02
@dazinator dazinator merged commit 60491af into develop Nov 15, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix gh actions workflow for benchmarks

2 participants