From 5251c3cd7924f6f8f4f8bbf11dcde02d3c88693c Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Sun, 23 Nov 2025 08:41:07 +0100 Subject: [PATCH 1/2] Add BCR publishing configuration for brotli and brotli_go modules Signed-off-by: Matthieu MOREL --- .bcr/README.md | 69 +++++++++++++++++++++++++++ .bcr/config.yml | 8 ++++ .bcr/go/metadata.template.json | 14 ++++++ .bcr/go/presubmit.yml | 19 ++++++++ .bcr/go/source.template.json | 5 ++ .bcr/metadata.template.json | 14 ++++++ .bcr/presubmit.yml | 21 ++++++++ .bcr/source.template.json | 5 ++ .github/workflows/publish_to_bcr.yaml | 29 +++++++++++ 9 files changed, 184 insertions(+) create mode 100644 .bcr/README.md create mode 100644 .bcr/config.yml create mode 100644 .bcr/go/metadata.template.json create mode 100644 .bcr/go/presubmit.yml create mode 100644 .bcr/go/source.template.json create mode 100644 .bcr/metadata.template.json create mode 100644 .bcr/presubmit.yml create mode 100644 .bcr/source.template.json create mode 100644 .github/workflows/publish_to_bcr.yaml diff --git a/.bcr/README.md b/.bcr/README.md new file mode 100644 index 000000000..2b25d480b --- /dev/null +++ b/.bcr/README.md @@ -0,0 +1,69 @@ +# Bazel Central Registry Publishing Configuration + +This directory contains the configuration files for publishing brotli modules to the Bazel Central Registry (BCR). + +## Modules + +This repository publishes two modules to BCR: + +1. **brotli** (root) - The main Brotli C library +2. **brotli_go** (go/) - Go bindings for Brotli + +Each module has its own set of template files under `.bcr` and `.bcr/go` respectively. + +## Files + +### Root module (brotli) +- **metadata.template.json**: Metadata about the brotli module including homepage, maintainers, and repository location +- **source.template.json**: Template for generating source archive URLs for releases +- **presubmit.yml**: BCR CI configuration that defines build and test tasks to validate the module + +### Go module (brotli_go) +- **go/metadata.template.json**: Metadata for the brotli_go module +- **go/source.template.json**: Source configuration with path to the go subdirectory +- **go/presubmit.yml**: BCR CI configuration for the Go module + +### Shared +- **config.yml**: Configuration specifying both modules via moduleRoots +- **README.md**: This file + +## Setup (One-time) + +Before you can publish to BCR, you need to set up the following: + +1. **Fork the Bazel Central Registry** + - Fork https://github.com/bazelbuild/bazel-central-registry to your GitHub account + +2. **Create a Personal Access Token** + - Go to GitHub Settings > Developer settings > Personal access tokens > Tokens (classic) + - Click "Generate new token (classic)" + - Select scopes: `repo` and `workflow` + - Generate the token and copy it + +3. **Add the token to repository secrets** + - Go to the brotli repository Settings > Secrets and variables > Actions + - Click "New repository secret" + - Name: `BCR_PUBLISH_TOKEN` + - Value: Paste the token from step 2 + - Click "Add secret" + +## Publishing Process + +To publish new versions of both modules to BCR: + +1. Create a GitHub release with a tag (e.g., `v1.2.1`) +2. Go to the Actions tab in GitHub +3. Select the "Publish to BCR" workflow +4. Click "Run workflow" +5. Enter the release tag name (e.g., `v1.2.1`) +6. Enter your BCR fork (e.g., `yourusername/bazel-central-registry`) +7. Click "Run workflow" + +The workflow will automatically create pull requests to the Bazel Central Registry for both modules. + +## References + +- [Bazel Central Registry](https://github.com/bazelbuild/bazel-central-registry) +- [publish-to-bcr Documentation](https://github.com/bazel-contrib/publish-to-bcr) +- [Bzlmod User Guide](https://bazel.build/external/module) +- [Multi-module Publishing](https://github.com/bazel-contrib/publish-to-bcr/tree/main/templates#optional-configyml) diff --git a/.bcr/config.yml b/.bcr/config.yml new file mode 100644 index 000000000..f395e5ad1 --- /dev/null +++ b/.bcr/config.yml @@ -0,0 +1,8 @@ +# BCR configuration file for publish-to-bcr +fixedReleaser: + login: eustas + email: eustas@google.com +# Publish both the main brotli module and the Go bindings module +moduleRoots: + - "." + - "go" diff --git a/.bcr/go/metadata.template.json b/.bcr/go/metadata.template.json new file mode 100644 index 000000000..df42141f7 --- /dev/null +++ b/.bcr/go/metadata.template.json @@ -0,0 +1,14 @@ +{ + "homepage": "https://github.com/google/brotli", + "maintainers": [ + { + "email": "eustas@google.com", + "github": "eustas", + "name": "Evgenii Kliuchnikov", + "github_user_id": 203457 + } + ], + "repository": ["github:google/brotli"], + "versions": [], + "yanked_versions": {} +} diff --git a/.bcr/go/presubmit.yml b/.bcr/go/presubmit.yml new file mode 100644 index 000000000..2ec2e8692 --- /dev/null +++ b/.bcr/go/presubmit.yml @@ -0,0 +1,19 @@ +matrix: + platform: + - debian10 + - ubuntu2004 + - macos + - macos_arm64 + bazel: + - 8.x + - 7.x + - 6.x +tasks: + verify_targets: + name: Verify build targets + platform: ${{ platform }} + bazel: ${{ bazel }} + build_targets: + - '@brotli_go//cbrotli' + test_targets: + - '@brotli_go//cbrotli:cbrotli_test' diff --git a/.bcr/go/source.template.json b/.bcr/go/source.template.json new file mode 100644 index 000000000..362d6df1a --- /dev/null +++ b/.bcr/go/source.template.json @@ -0,0 +1,5 @@ +{ + "integrity": "", + "strip_prefix": "{REPO}-{VERSION}/go", + "url": "https://github.com/{OWNER}/{REPO}/archive/refs/tags/{TAG}.tar.gz" +} diff --git a/.bcr/metadata.template.json b/.bcr/metadata.template.json new file mode 100644 index 000000000..df42141f7 --- /dev/null +++ b/.bcr/metadata.template.json @@ -0,0 +1,14 @@ +{ + "homepage": "https://github.com/google/brotli", + "maintainers": [ + { + "email": "eustas@google.com", + "github": "eustas", + "name": "Evgenii Kliuchnikov", + "github_user_id": 203457 + } + ], + "repository": ["github:google/brotli"], + "versions": [], + "yanked_versions": {} +} diff --git a/.bcr/presubmit.yml b/.bcr/presubmit.yml new file mode 100644 index 000000000..318a904d8 --- /dev/null +++ b/.bcr/presubmit.yml @@ -0,0 +1,21 @@ +matrix: + platform: + - debian10 + - ubuntu2004 + - macos + - macos_arm64 + - windows + bazel: + - 8.x + - 7.x + - 6.x +tasks: + verify_targets: + name: Verify build targets + platform: ${{ platform }} + bazel: ${{ bazel }} + build_targets: + - '@brotli//:brotli' + - '@brotli//:brotlicommon' + - '@brotli//:brotlidec' + - '@brotli//:brotlienc' diff --git a/.bcr/source.template.json b/.bcr/source.template.json new file mode 100644 index 000000000..4f1481990 --- /dev/null +++ b/.bcr/source.template.json @@ -0,0 +1,5 @@ +{ + "integrity": "", + "strip_prefix": "{REPO}-{VERSION}", + "url": "https://github.com/{OWNER}/{REPO}/archive/refs/tags/{TAG}.tar.gz" +} diff --git a/.github/workflows/publish_to_bcr.yaml b/.github/workflows/publish_to_bcr.yaml new file mode 100644 index 000000000..a0d9ef593 --- /dev/null +++ b/.github/workflows/publish_to_bcr.yaml @@ -0,0 +1,29 @@ +name: Publish to BCR + +on: + # Manually trigger the publish workflow + workflow_dispatch: + inputs: + tag_name: + description: Release tag to publish to the Bazel Central Registry + required: true + type: string + registry_fork: + description: Registry fork to push to (e.g., username/bazel-central-registry) + required: true + type: string + +jobs: + publish: + permissions: + contents: write + id-token: write + attestations: write + uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v2 + with: + tag_name: ${{ inputs.tag_name }} + registry_fork: ${{ inputs.registry_fork }} + # Set to false since not using the release_ruleset workflow + attest: false + secrets: + publish_token: ${{ secrets.BCR_PUBLISH_TOKEN }} From eff4cbb0f11290ff13f26f2f79afefbe3d0aa90b Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Sun, 23 Nov 2025 08:41:07 +0100 Subject: [PATCH 2/2] Add BCR publishing configuration for brotli and brotli_go modules Signed-off-by: Matthieu MOREL --- .bcr/go/presubmit.yml | 15 ++++++++++++++- .bcr/presubmit.yml | 34 +++++++++++++++++++++++++++------- 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/.bcr/go/presubmit.yml b/.bcr/go/presubmit.yml index 2ec2e8692..3e3aa53dd 100644 --- a/.bcr/go/presubmit.yml +++ b/.bcr/go/presubmit.yml @@ -7,7 +7,6 @@ matrix: bazel: - 8.x - 7.x - - 6.x tasks: verify_targets: name: Verify build targets @@ -15,5 +14,19 @@ tasks: bazel: ${{ bazel }} build_targets: - '@brotli_go//cbrotli' + build_flags: + - "--conlyopt=-Wno-error=conversion" + - "--conlyopt=-Wno-error=sign-conversion" + - "--copt=-Wno-error=conversion" + - "--copt=-Wno-error=sign-conversion" + - "--host_conlyopt=-Wno-error=conversion" + - "--host_copt=-Wno-error=conversion" test_targets: - '@brotli_go//cbrotli:cbrotli_test' + test_flags: + - "--conlyopt=-Wno-error=conversion" + - "--conlyopt=-Wno-error=sign-conversion" + - "--copt=-Wno-error=conversion" + - "--copt=-Wno-error=sign-conversion" + - "--host_conlyopt=-Wno-error=conversion" + - "--host_copt=-Wno-error=conversion" \ No newline at end of file diff --git a/.bcr/presubmit.yml b/.bcr/presubmit.yml index 318a904d8..9e53079e1 100644 --- a/.bcr/presubmit.yml +++ b/.bcr/presubmit.yml @@ -4,18 +4,38 @@ matrix: - ubuntu2004 - macos - macos_arm64 - - windows bazel: - - 8.x - 7.x - - 6.x + - 8.x tasks: verify_targets: name: Verify build targets platform: ${{ platform }} bazel: ${{ bazel }} build_targets: - - '@brotli//:brotli' - - '@brotli//:brotlicommon' - - '@brotli//:brotlidec' - - '@brotli//:brotlienc' + - '@brotli//:brotli' + - '@brotli//:brotlicommon' + - '@brotli//:brotlidec' + - '@brotli//:brotlienc' + build_flags: + - "--cxxopt=-std=c++17" + - "--conlyopt=-Wno-error=conversion" + - "--conlyopt=-Wno-error=sign-conversion" + - "--copt=-Wno-error=conversion" + - "--copt=-Wno-error=sign-conversion" + - "--host_conlyopt=-Wno-error=conversion" + - "--host_copt=-Wno-error=conversion" + verify_targets_windows: + name: Verify build targets + platform: windows + bazel: ${{ bazel }} + build_flags: + - "--cxxopt=/std:c++17" + - "--cxxopt=/D_WIN32_WINNT=0x0602" + - "--cxxopt=/DWINVER=0x0602" + - "--host_cxxopt=/std:c++17" + build_targets: + - '@brotli//:brotli' + - '@brotli//:brotlicommon' + - '@brotli//:brotlidec' + - '@brotli//:brotlienc' \ No newline at end of file