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
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
build --//core:codspeed_mode=instrumentation
build --@codspeed_core//:codspeed_mode=simulation
build --compilation_mode=dbg
build --copt=-O2

Expand Down
3 changes: 3 additions & 0 deletions .bcr/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
moduleRoots:
- "core"
- "google_benchmark"
15 changes: 15 additions & 0 deletions .bcr/core/metadata.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"homepage": "https://codspeed.io",
"maintainers": [
{
"name": "Arthur Pastel",
"email": "[email protected]",
"github": "art049"
}
],
"repository": [
"github:CodSpeedHQ/codspeed-cpp"
],
"versions": [],
"yanked_versions": {}
}
44 changes: 44 additions & 0 deletions .bcr/core/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
bcr_test_module:
module_path: ""
matrix:
platform:
- debian10
- macos
- ubuntu2004
- windows
bazel:
- 7.x
- 8.x
tasks:
verify_instrumentation:
platform: ${{ platform }}
bazel: ${{ bazel }}
build_flags:
- "--//:codspeed_mode=instrumentation"
build_targets:
- "//:codspeed"
- "//:instrument_hooks"
verify_simulation:
platform: ${{ platform }}
bazel: ${{ bazel }}
build_flags:
- "--//:codspeed_mode=simulation"
build_targets:
- "//:codspeed"
- "//:instrument_hooks"
verify_walltime:
platform: ${{ platform }}
bazel: ${{ bazel }}
build_flags:
- "--//:codspeed_mode=walltime"
build_targets:
- "//:codspeed"
- "//:instrument_hooks"
verify_off:
platform: ${{ platform }}
bazel: ${{ bazel }}
build_flags:
- "--//:codspeed_mode=off"
build_targets:
- "//:codspeed"
- "//:instrument_hooks"
5 changes: 5 additions & 0 deletions .bcr/core/source.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/codspeed-cpp-{TAG}.tar.gz",
"integrity": "{INTEGRITY}",
"strip_prefix": "codspeed-cpp-{TAG}/core"
}
15 changes: 15 additions & 0 deletions .bcr/google_benchmark/metadata.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"homepage": "https://codspeed.io",
"maintainers": [
{
"name": "Arthur Pastel",
"email": "[email protected]",
"github": "art049"
}
],
"repository": [
"github:CodSpeedHQ/codspeed-cpp"
],
"versions": [],
"yanked_versions": {}
}
44 changes: 44 additions & 0 deletions .bcr/google_benchmark/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
bcr_test_module:
module_path: ""
matrix:
platform:
- debian10
- macos
- ubuntu2004
- windows
bazel:
- 7.x
- 8.x
tasks:
verify_instrumentation:
platform: ${{ platform }}
bazel: ${{ bazel }}
build_flags:
- "--@codspeed_core//:codspeed_mode=instrumentation"
build_targets:
- "//:benchmark"
- "//:benchmark_main"
verify_simulation:
platform: ${{ platform }}
bazel: ${{ bazel }}
build_flags:
- "--@codspeed_core//:codspeed_mode=simulation"
build_targets:
- "//:benchmark"
- "//:benchmark_main"
verify_walltime:
platform: ${{ platform }}
bazel: ${{ bazel }}
build_flags:
- "--@codspeed_core//:codspeed_mode=walltime"
build_targets:
- "//:benchmark"
- "//:benchmark_main"
verify_off:
platform: ${{ platform }}
bazel: ${{ bazel }}
build_flags:
- "--@codspeed_core//:codspeed_mode=off"
build_targets:
- "//:benchmark"
- "//:benchmark_main"
5 changes: 5 additions & 0 deletions .bcr/google_benchmark/source.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/codspeed-cpp-{TAG}.tar.gz",
"integrity": "{INTEGRITY}",
"strip_prefix": "codspeed-cpp-{TAG}/google_benchmark"
}
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ jobs:

- name: Build benchmark example
run: |
bazel build //examples/google_benchmark_bazel:my_benchmark --//core:codspeed_mode=${{ matrix.codspeed-mode }} --//core:strict_warnings=on
bazel build //examples/google_benchmark_bazel:my_benchmark --@codspeed_core//:codspeed_mode=${{ matrix.codspeed-mode }} --@codspeed_core//:strict_warnings=on

- name: Run the benchmarks
uses: CodSpeedHQ/action@main
if: matrix.codspeed-mode != 'off'
with:
mode: ${{ matrix.codspeed-mode }}
run: bazel run //examples/google_benchmark_bazel:my_benchmark --//core:codspeed_mode=${{ matrix.codspeed-mode }} --//core:strict_warnings=on
run: bazel run //examples/google_benchmark_bazel:my_benchmark --@codspeed_core//:codspeed_mode=${{ matrix.codspeed-mode }} --@codspeed_core//:strict_warnings=on
token: ${{ secrets.CODSPEED_TOKEN }}

cmake-build:
Expand Down Expand Up @@ -193,4 +193,4 @@ jobs:

- name: Build benchmark example
run: |
bazel build //examples/google_benchmark_bazel:my_benchmark --//core:codspeed_mode=${{ matrix.codspeed-mode }} --//core:strict_warnings=on
bazel build //examples/google_benchmark_bazel:my_benchmark --@codspeed_core//:codspeed_mode=${{ matrix.codspeed-mode }} --@codspeed_core//:strict_warnings=on
25 changes: 25 additions & 0 deletions .github/workflows/publish-to-bcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish to Bazel Central Registry

on:
release:
types: [published]
workflow_dispatch:
inputs:
tag_name:
description: 'Release tag to publish (e.g., v1.4.0)'
required: true
type: string

jobs:
publish-to-bcr:
uses: bazel-contrib/publish-to-bcr/.github/workflows/[email protected]
with:
tag_name: ${{ github.event.release.tag_name || inputs.tag_name }}
registry_fork: CodSpeedHQ/bazel-central-registry
# TODO: Change this back to bazel-central-registry when initial submission has been approved
registry: CodSpeedHQ/bazel-central-registry
# If we need this, because it requries tweaking permissions on the BCR_PUBLISH_TOKEN secret
# Currently it only has access to the bazel-central-registry repo
attest: false
secrets:
publish_token: ${{ secrets.BCR_PUBLISH_TOKEN }}
11 changes: 8 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Release

For now, releasing is done manually, by tagging a git rev with vX.Y.Z.

When releasing a new version, please make sure the version is updated in the [`core/CMakeLists.txt`](https://github.com/CodSpeedHQ/codspeed-cpp/blob/main/core/CMakeLists.txt#L3) and [`core/BUILD`](https://github.com/CodSpeedHQ/codspeed-cpp/blob/main/core/BUILD#L4) files to match the pushed version
To create a release, run `scripts/release.sh <new_version>` from the main branch. This script will:
1. Automatically update the version in all relevant files:
- [`core/CMakeLists.txt`](https://github.com/CodSpeedHQ/codspeed-cpp/blob/main/core/CMakeLists.txt#L3)
- [`core/MODULE.bazel`](https://github.com/CodSpeedHQ/codspeed-cpp/blob/main/core/MODULE.bazel#L3)
- [`google_benchmark/MODULE.bazel`](https://github.com/CodSpeedHQ/codspeed-cpp/blob/main/google_benchmark/MODULE.bazel)
2. Create a commit with the version changes
3. Generate the CHANGELOG
4. Tag and create the release on GitHub
20 changes: 15 additions & 5 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
# This MODULE.bazel is for local development in the monorepo.
# Individual modules have their own MODULE.bazel files.

bazel_dep(name = "rules_cc", version = "0.0.17")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "instrument_hooks", version = "1.0.0")

git_override(
module_name = "instrument_hooks",
commit = "42ed74076c697c2f06c5ac81a84ccee983d7f140",
remote = "https://github.com/CodSpeedHQ/instrument-hooks",
# Local path overrides for development - these point to the subdirectories
# When published to BCR, users will get the published versions instead
bazel_dep(name = "codspeed_core")
local_path_override(
module_name = "codspeed_core",
path = "core",
)

bazel_dep(name = "codspeed_google_benchmark_compat")
local_path_override(
module_name = "codspeed_google_benchmark_compat",
path = "google_benchmark",
)
Loading
Loading