Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: CI

on:
pull_request:
push:
branches:
- main

permissions:
contents: read

jobs:
build-test:
name: build, vet & test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version: "1.26.5"
cache: true

- name: go build
run: go build ./...

- name: go vet
run: go vet ./...

- name: go test
run: go test -race ./...

- name: gofmt
run: |
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "these files need gofmt:" >&2
echo "$unformatted" >&2
exit 1
fi

dashboard:
# Guard against drift between the web/ source and the vendored bundle that
# the Go binary embeds (internal/dashboard/assets/index.html). Rebuild the
# dashboard from source and fail if the committed bundle differs — the build
# is byte-reproducible (deps pinned via yarn.lock), so a mismatch means
# someone edited web/ without re-vendoring.
name: dashboard bundle up to date
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: "26"

- name: Enable corepack (pinned yarn from packageManager)
run: npm install -g corepack@latest && corepack enable

- name: Install dashboard deps
working-directory: web
run: yarn install --immutable

- name: Build dashboard
working-directory: web
run: yarn build

- name: Verify vendored bundle matches source
run: |
cp web/dist/index.html internal/dashboard/assets/index.html
if ! git diff --quiet -- internal/dashboard/assets/index.html; then
echo "::error file=internal/dashboard/assets/index.html::vendored dashboard bundle is stale — rebuild and commit it"
echo "Fix locally with:" >&2
echo " yarn --cwd web build && cp web/dist/index.html internal/dashboard/assets/index.html" >&2
git --no-pager diff --stat -- internal/dashboard/assets/index.html
exit 1
fi
echo "dashboard bundle matches source ✓"
49 changes: 49 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Release

on:
push:
tags:
- "v*.*.*"

permissions:
contents: write

jobs:
build-test:
name: build & test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version: "1.26.5"
cache: true

- name: go build
run: go build ./...

- name: go test
run: go test -race ./...

goreleaser:
name: goreleaser
needs: build-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0

- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version: "1.26.5"
cache: true

- name: Run goreleaser
uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7
with:
version: "~> v2"
args: release --clean --parallelism 1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Build output
/cubit
/dist/
*.exe

# Go
*.test
*.out
coverage.txt

# Web dashboard build (the built asset is vendored at
# internal/dashboard/assets/index.html; the raw dist/ and deps are not tracked)
/web/node_modules/
/web/dist/
/web/.yarn/

# Editor / OS
.DS_Store
76 changes: 76 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# goreleaser configuration for cubit.
#
# Builds a single binary, `cubit`, from ./cmd/cubit. It runs both as a local
# developer tool (self-updates via `cubit update`) and inside CI via the
# composite action in this repo, so it ships for both linux and darwin.
version: 2

before:
hooks:
- go mod tidy

builds:
- id: cubit
main: ./cmd/cubit
binary: cubit
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
goarch:
- amd64
- arm64
ldflags:
- -s -w -X main.version={{ .Version }}

# One archive so consumers get everything, plus a raw uncompressed binary for
# curl-and-run / CI usage that doesn't want an extraction step.
archives:
- id: cubit
ids:
- cubit
name_template: >-
cubit_{{ .Version }}_{{ .Os }}_{{ .Arch }}

- id: raw
ids:
- cubit
formats:
- binary
name_template: >-
{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}

checksum:
name_template: checksums.txt

snapshot:
version_template: "{{ incpatch .Version }}-snapshot"

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
- "^chore:"

release:
github:
owner: wardnet
name: cubit
extra_files:
- glob: scripts/install.sh
header: |
## cubit

Continuous benchmarking and performance-regression tracking — records
baselines in a git branch and posts non-blocking baseline-vs-PR comparisons.

**Install / update**

```sh
curl -fsSL https://github.com/wardnet/cubit/releases/latest/download/install.sh | sh
```

`cubit update` self-updates the CLI in place.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 wardnet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
54 changes: 53 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,54 @@
<img src="assets/cubit-logo.png" alt="cubit" width="64" align="right">

# cubit
Continuous benchmarking and performance-regression tracking — runs benchmarks, records baselines in a git branch, renders trend dashboards, and posts non-blocking baseline-vs-PR comparisons.

Continuous benchmarking and performance-regression tracking.

`cubit` runs your benchmarks, records baselines in a git branch, and reports how
a change moves performance — locally for a developer, or as a **non-blocking PR
comment** in CI. It is a *light gate*: the numbers and the trend dashboard inform
a human go/no-go, nothing hard-fails.

Sibling to [bulwark](https://github.com/wardnet/bulwark) (code-quality scanning),
built for the [wardnet](https://github.com/wardnet) daemon's benchmarks.

## How it works

1. Your CI runs the benchmarks (today: Rust [criterion](https://github.com/bheisler/criterion.rs)).
2. `cubit compare` ingests the output, diffs it against the baseline recorded on
the `cubit-state` branch, and posts a Markdown table (baseline vs current, Δ%)
plus a link to a trend dashboard.
3. On the default branch, `cubit record` updates the baseline — keyed by commit
SHA — for the next PR to compare against.

Baselines and history live in an orphan git branch (no database, no hosted
service). The dashboard renders from that branch as a CI artifact and via a local
`cubit serve`, so it works on private repos and repos whose GitHub Pages slot is
already taken.

## Commands

| Command | Purpose |
|---|---|
| `cubit compare` | Ingest a run, diff against a baseline, render the report |
| `cubit record` | Ingest a run and write it as a baseline record (SHA-keyed) |
| `cubit update` | Self-update to the latest release |
| `cubit version` | Print the version |

## Install

```sh
curl -fsSL https://github.com/wardnet/cubit/releases/latest/download/install.sh | sh
```

`cubit update` self-updates the CLI in place.

## Status

Early. The ingest → compare → report spine works; baseline persistence
(`cubit-state` branch), the release/action plumbing, and the React trend
dashboard are in progress.

## License

MIT — see [LICENSE](LICENSE).
Loading
Loading