Skip to content

feat: build golang tests with codspeed instrumentation #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: cod-1172-create-codspeed-go-repository-with-the-compat-layer
Choose a base branch
from

Conversation

not-matthias
Copy link
Member

@not-matthias not-matthias commented Jul 30, 2025

The process is split into multiple parts:

  • Discovery: Finds all the test packages for a project, filters out packages without benchmarks.
    • Verifier: Walks the AST of a source file to ensure the t *testing.B parameter isn't passed to a function.
  • Templater: Copies the project to a tmp folder, creates a new cli/runner.go main file with the benchmarks.
    • Patcher: Patches the imports from testing to our codspeed compat package
  • Runner: Builds the cli/runner.go and outputs the binary.

@not-matthias not-matthias changed the base branch from main to cod-1172-create-codspeed-go-repository-with-the-compat-layer July 30, 2025 13:19
@not-matthias not-matthias force-pushed the cod-1173-build-golang-tests-with-codspeed-instrumentation-in-runner branch 2 times, most recently from a07be40 to 2a8aeb7 Compare July 30, 2025 16:16
Copy link

codspeed-hq bot commented Jul 30, 2025

CodSpeed Performance Report

Congrats! CodSpeed is installed 🎉

🆕 11 new benchmarks were detected.

You will start to see performance impacts in the reports once the benchmarks are run from your default branch.

Detected benchmarks

  • BenchmarkFibonacci20_Loop (68.6 µs)
  • BenchmarkFibonacci20_bN (69.9 µs)
  • BenchmarkSleep100ns (226 ns)
  • BenchmarkSleep100us (100.1 µs)
  • BenchmarkSleep10ms (10 ms)
  • BenchmarkSleep10us (10.1 µs)
  • BenchmarkSleep1ms (1 ms)
  • BenchmarkSleep1us (1.1 µs)
  • BenchmarkSleep50ms (50 ms)
  • fibonacci(10) (557 ns)
  • fibonacci(30) (8.7 ms)

@not-matthias not-matthias requested a review from Copilot July 30, 2025 17:38
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces comprehensive support for building and running Golang benchmarks with CodSpeed instrumentation. The implementation includes benchmark discovery, Go source patching, template generation, and walltime results collection for performance measurement integration.

Key Changes

  • Implements a Rust-based Go benchmark runner with build and run commands
  • Adds benchmark discovery and verification for Go test packages
  • Creates source patching to replace standard testing imports with CodSpeed compatibility layer

Reviewed Changes

Copilot reviewed 51 out of 55 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
go-runner/src/*.rs Core Rust implementation for Go benchmark runner with discovery, templating, and results collection
go-runner/testdata/* Test data files including benchmark samples, raw results, and project submodules
example/* Example Go project with benchmark tests and module configuration
.github/workflows/ci.yml CI pipeline configuration for testing and integration
.gitmodules Git submodule configuration for test projects

@not-matthias not-matthias force-pushed the cod-1173-build-golang-tests-with-codspeed-instrumentation-in-runner branch from dcf15e8 to f7f1704 Compare July 30, 2025 17:53
@not-matthias not-matthias force-pushed the cod-1172-create-codspeed-go-repository-with-the-compat-layer branch from b42e942 to 67724e3 Compare July 31, 2025 13:37
@not-matthias not-matthias force-pushed the cod-1173-build-golang-tests-with-codspeed-instrumentation-in-runner branch 4 times, most recently from 2489402 to 38eeb58 Compare August 1, 2025 09:42
@not-matthias not-matthias requested a review from art049 August 1, 2025 09:48
@not-matthias not-matthias force-pushed the cod-1173-build-golang-tests-with-codspeed-instrumentation-in-runner branch 2 times, most recently from eb105da to a6120d0 Compare August 4, 2025 17:40
@not-matthias not-matthias force-pushed the cod-1172-create-codspeed-go-repository-with-the-compat-layer branch from 0732b10 to 09c7fbe Compare August 4, 2025 17:43
@not-matthias not-matthias force-pushed the cod-1173-build-golang-tests-with-codspeed-instrumentation-in-runner branch 3 times, most recently from 3b94c33 to ff3fe96 Compare August 5, 2025 09:24
@not-matthias not-matthias force-pushed the cod-1172-create-codspeed-go-repository-with-the-compat-layer branch 2 times, most recently from b3157b1 to ad38705 Compare August 5, 2025 09:32
@not-matthias not-matthias force-pushed the cod-1173-build-golang-tests-with-codspeed-instrumentation-in-runner branch 2 times, most recently from c82233c to b6b8e62 Compare August 5, 2025 09:41
@not-matthias not-matthias force-pushed the cod-1172-create-codspeed-go-repository-with-the-compat-layer branch from ad38705 to db00ce3 Compare August 5, 2025 13:14
@not-matthias not-matthias force-pushed the cod-1173-build-golang-tests-with-codspeed-instrumentation-in-runner branch from b6b8e62 to de1e231 Compare August 5, 2025 13:17
@not-matthias not-matthias marked this pull request as ready for review August 5, 2025 13:17
@not-matthias not-matthias force-pushed the cod-1173-build-golang-tests-with-codspeed-instrumentation-in-runner branch 2 times, most recently from d6f5b20 to 19b4e2a Compare August 5, 2025 13:20
@not-matthias not-matthias force-pushed the cod-1173-build-golang-tests-with-codspeed-instrumentation-in-runner branch from 19b4e2a to 3256718 Compare August 8, 2025 10:24
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.

1 participant