Skip to content

Commit c538c05

Browse files
feat: add support for automated BCR publication
1 parent 583eb78 commit c538c05

File tree

8 files changed

+145
-0
lines changed

8 files changed

+145
-0
lines changed

.bcr/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
moduleRoots:
2+
- "core"
3+
- "google_benchmark"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish to Bazel Central Registry
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
tag_name:
9+
description: 'Release tag to publish (e.g., v1.4.0)'
10+
required: true
11+
type: string
12+
test_mode:
13+
description: 'Test mode: open PR to your fork instead of upstream BCR'
14+
required: false
15+
type: boolean
16+
default: false
17+
18+
jobs:
19+
publish-to-bcr:
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: write
23+
id-token: write
24+
attestations: write
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
with:
29+
ref: ${{ github.event.release.tag_name || inputs.tag_name }}
30+
31+
- name: Publish modules to BCR
32+
uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v1
33+
with:
34+
tag_name: ${{ github.event.release.tag_name || inputs.tag_name }}
35+
registry_fork: CodSpeedHQ/bazel-central-registry
36+
# TODO: Change this back to bazel-central-registry when ready
37+
registry: CodSpeedHQ/bazel-central-registry
38+
attest: true
39+
secrets:
40+
publish_token: ${{ secrets.BCR_PUBLISH_TOKEN }}

core/.bcr/metadata.template.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"homepage": "https://codspeed.io",
3+
"maintainers": [
4+
{
5+
"name": "Arthur Pastel",
6+
"github": "art049"
7+
}
8+
],
9+
"repository": [
10+
"github:CodSpeedHQ/codspeed-cpp"
11+
],
12+
"versions": [],
13+
"yanked_versions": {}
14+
}

core/.bcr/presubmit.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
bcr_test_module:
2+
module_path: ""
3+
matrix:
4+
platform:
5+
- debian10
6+
- macos
7+
- ubuntu2004
8+
- windows
9+
bazel:
10+
- 7.x
11+
- 8.x
12+
tasks:
13+
verify_instrumentation:
14+
platform: ${{ platform }}
15+
bazel: ${{ bazel }}
16+
build_flags:
17+
- "--//:codspeed_mode=instrumentation"
18+
build_targets:
19+
- "//:codspeed"
20+
- "//:instrument_hooks"
21+
verify_walltime:
22+
platform: ${{ platform }}
23+
bazel: ${{ bazel }}
24+
build_flags:
25+
- "--//:codspeed_mode=walltime"
26+
build_targets:
27+
- "//:codspeed"
28+
- "//:instrument_hooks"
29+
verify_off:
30+
platform: ${{ platform }}
31+
bazel: ${{ bazel }}
32+
build_flags:
33+
- "--//:codspeed_mode=off"
34+
build_targets:
35+
- "//:codspeed"
36+
- "//:instrument_hooks"

core/.bcr/source.template.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/codspeed-cpp-{TAG}.tar.gz",
3+
"integrity": "{INTEGRITY}",
4+
"strip_prefix": "codspeed-cpp-{TAG}/core"
5+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"homepage": "https://codspeed.io",
3+
"maintainers": [
4+
{
5+
"name": "Arthur Pastel",
6+
"github": "art049"
7+
}
8+
],
9+
"repository": [
10+
"github:CodSpeedHQ/codspeed-cpp"
11+
],
12+
"versions": [],
13+
"yanked_versions": {}
14+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
bcr_test_module:
2+
module_path: ""
3+
matrix:
4+
platform:
5+
- debian10
6+
- macos
7+
- ubuntu2004
8+
- windows
9+
bazel:
10+
- 7.x
11+
- 8.x
12+
tasks:
13+
verify_instrumentation:
14+
platform: ${{ platform }}
15+
bazel: ${{ bazel }}
16+
build_flags:
17+
- "--@codspeed_core//:codspeed_mode=instrumentation"
18+
build_targets:
19+
- "//:benchmark"
20+
- "//:benchmark_main"
21+
verify_walltime:
22+
platform: ${{ platform }}
23+
bazel: ${{ bazel }}
24+
build_flags:
25+
- "--@codspeed_core//:codspeed_mode=walltime"
26+
build_targets:
27+
- "//:benchmark"
28+
- "//:benchmark_main"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/codspeed-cpp-{TAG}.tar.gz",
3+
"integrity": "{INTEGRITY}",
4+
"strip_prefix": "codspeed-cpp-{TAG}/google_benchmark"
5+
}

0 commit comments

Comments
 (0)