Skip to content

Commit dfd13d4

Browse files
authored
feat: implement bench CLI tool
Go CLI that manages benchmark results: runs benchmarks (wrapping go test), persists history to .benchmarks.yaml, and generates markdown reports. Commands: run, sync, render, init. Supports flexible targeting (all, package, single benchmark, recursive), multiple output formats (table, json, raw), configurable templates, and per-repo/global config merging. 8 internal packages, 35 tests, golangci-lint v2 zero issues, CI green on ubuntu/windows/macos with Go 1.22-1.24.
1 parent 322398c commit dfd13d4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2998
-414
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Global code owners - all files require review from @bold-minds
2+
* @bold-minds
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: '[BUG] '
5+
labels: 'bug'
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Run '...'
16+
2. See error
17+
18+
**Expected behavior**
19+
A clear and concise description of what you expected to happen.
20+
21+
**Code Example**
22+
If applicable, add a minimal code example to help explain your problem.
23+
24+
```go
25+
// Your code here
26+
```
27+
28+
**Environment (please complete the following information):**
29+
- OS: [e.g. Linux, macOS, Windows]
30+
- Go version: [e.g. 1.22.0]
31+
- bench version: [e.g. v0.1.0]
32+
33+
**Additional context**
34+
Add any other context about the problem here.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: '[FEATURE] '
5+
labels: 'enhancement'
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Proposed API (if applicable)**
20+
If this feature would involve API changes, please provide a code example of how it would work:
21+
22+
```go
23+
// Your proposed API here
24+
```
25+
26+
**Additional context**
27+
Add any other context or screenshots about the feature request here.
28+
29+
**Backward Compatibility**
30+
- [ ] This feature maintains backward compatibility
31+
- [ ] This feature introduces breaking changes (please explain above)

.github/dependabot.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
version: 2
2+
updates:
3+
# Enable version updates for Go modules
4+
- package-ecosystem: "gomod"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
day: "monday"
9+
time: "09:00"
10+
timezone: "America/Los_Angeles"
11+
open-pull-requests-limit: 5
12+
assignees:
13+
- "bold-minds"
14+
commit-message:
15+
prefix: "deps"
16+
include: "scope"
17+
labels:
18+
- "dependencies"
19+
- "go"
20+
# Group minor and patch updates together
21+
groups:
22+
go-dependencies:
23+
patterns:
24+
- "*"
25+
update-types:
26+
- "minor"
27+
- "patch"
28+
29+
# Enable security updates for GitHub Actions
30+
- package-ecosystem: "github-actions"
31+
directory: "/"
32+
schedule:
33+
interval: "weekly"
34+
day: "monday"
35+
time: "09:00"
36+
timezone: "America/Los_Angeles"
37+
open-pull-requests-limit: 3
38+
assignees:
39+
- "bold-minds"
40+
commit-message:
41+
prefix: "ci"
42+
include: "scope"
43+
labels:
44+
- "dependencies"
45+
- "github-actions"

.github/workflows/test.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
include:
18+
- go-version: '1.24'
19+
os: ubuntu-latest
20+
- go-version: '1.24'
21+
os: windows-latest
22+
- go-version: '1.24'
23+
os: macos-latest
24+
- go-version: '1.22'
25+
os: ubuntu-latest
26+
- go-version: '1.23'
27+
os: ubuntu-latest
28+
runs-on: ${{ matrix.os }}
29+
steps:
30+
- uses: actions/checkout@v4
31+
with:
32+
persist-credentials: false
33+
34+
- name: Setup Go
35+
uses: actions/setup-go@v5
36+
with:
37+
go-version: ${{ matrix.go-version }}
38+
39+
- name: Install dependencies
40+
run: go mod download
41+
42+
- name: Build validation
43+
shell: bash
44+
run: |
45+
go build ./...
46+
go mod tidy
47+
git diff --exit-code go.mod go.sum
48+
49+
- name: Run tests (Unix)
50+
if: runner.os != 'Windows'
51+
run: go test -v -race -coverprofile=coverage.out ./...
52+
53+
- name: Run tests (Windows)
54+
if: runner.os == 'Windows'
55+
run: go test -v -coverprofile="coverage.out" ./...
56+
57+
- name: Run benchmarks
58+
if: runner.os != 'Windows'
59+
run: go test -bench=. -benchmem ./cmd/... ./internal/...

.gitignore

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# If you prefer the allow list template instead of the deny list, see community template:
2-
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3-
#
41
# Binaries for programs and plugins
52
*.exe
63
*.exe~
@@ -11,22 +8,41 @@
118
# Test binary, built with `go test -c`
129
*.test
1310

14-
# Code coverage profiles and other test artifacts
11+
# Output of the go coverage tool, specifically when used with LiteIDE
1512
*.out
16-
coverage.*
17-
*.coverprofile
18-
profile.cov
1913

2014
# Dependency directories (remove the comment below to include it)
2115
# vendor/
2216

2317
# Go workspace file
2418
go.work
25-
go.work.sum
2619

27-
# env file
28-
.env
20+
# IDE files
21+
.idea/
22+
*.swp
23+
*.swo
24+
*~
2925

30-
# Editor/IDE
31-
# .idea/
32-
# .vscode/
26+
# OS generated files
27+
.DS_Store
28+
.DS_Store?
29+
._*
30+
.Spotlight-V100
31+
.Trashes
32+
ehthumbs.db
33+
Thumbs.db
34+
35+
# Coverage reports
36+
coverage.out
37+
coverage.html
38+
39+
# Build artifacts
40+
dist/
41+
build/
42+
43+
# Temporary files
44+
*.tmp
45+
*.temp
46+
47+
# Log files
48+
*.log

.golangci.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
version: "2"
2+
run:
3+
relative-path-mode: wd
4+
linters:
5+
default: none
6+
enable:
7+
- depguard
8+
- errcheck
9+
- godox
10+
- gosec
11+
- govet
12+
- ineffassign
13+
- staticcheck
14+
- unused
15+
settings:
16+
depguard:
17+
rules:
18+
main:
19+
files:
20+
- $all
21+
- "!$test"
22+
allow:
23+
- $gostd
24+
- gopkg.in/yaml.v3
25+
- github.com/spf13/cobra
26+
- github.com/spf13/pflag
27+
- github.com/bold-minds/bench
28+
tests:
29+
files:
30+
- $test
31+
allow:
32+
- $gostd
33+
- gopkg.in/yaml.v3
34+
- github.com/bold-minds/bench
35+
errcheck:
36+
check-type-assertions: true
37+
govet:
38+
disable:
39+
- fieldalignment
40+
enable-all: true
41+
settings:
42+
shadow:
43+
strict: true
44+
exclusions:
45+
generated: lax
46+
presets:
47+
- comments
48+
- common-false-positives
49+
- legacy
50+
- std-error-handling
51+
rules:
52+
- linters:
53+
- gosec
54+
- errcheck
55+
path: _test\.go
56+
issues:
57+
max-same-issues: 50
58+
formatters:
59+
exclusions:
60+
generated: lax

CODE_OF_CONDUCT.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, caste, color, religion, or sexual
10+
identity and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the overall
26+
community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or advances of
31+
any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email address,
35+
without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement through GitHub
63+
issues or direct contact with project maintainers.
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Attribution
70+
71+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
72+
version 2.1, available at
73+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
74+
75+
[homepage]: https://www.contributor-covenant.org
76+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html

0 commit comments

Comments
 (0)