Skip to content

Commit fcbf712

Browse files
committed
Update workflows and bcr metadata
1 parent 53ed55f commit fcbf712

9 files changed

Lines changed: 373 additions & 34 deletions

File tree

.bcr/config.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.bcr/metadata.template.json

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,15 @@
11
{
2-
"homepage": "https://github.com/bazelbuild/rules_closure",
2+
"homepage": "https://github.com/stackb/rules_closure",
33
"maintainers": [
44
{
5-
"name": "Goktug Gokdogan",
6-
"email": "goktug@google.com",
7-
"github": "gkdn"
8-
},
9-
{
10-
"name": "Julien Dramaix",
11-
"email": "dramaix@google.com",
12-
"github": "jDramaix"
13-
},
14-
{
15-
"name": "Yuan Tian",
16-
"email": "mollyibot@google.com",
17-
"github": "mollyibot"
5+
"name": "Paul Cody",
6+
"email": "pcj@stack.build",
7+
"github": "pcj"
188
}
199
],
2010
"repository": [
21-
"github:bazelbuild/rules_closure"
11+
"github:stackb/rules_closure"
2212
],
2313
"versions": [],
2414
"yanked_versions": {}
25-
}
15+
}

.bcr/presubmit.yml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
matrix:
2-
platform:
3-
- macos
4-
- ubuntu2004
5-
bazel:
6-
- "7.x"
7-
- "8.x"
8-
tasks:
9-
run_tests:
10-
bazel: ${{ bazel }}
11-
platform: ${{ platform }}
12-
build_targets:
13-
- "..."
14-
test_targets:
15-
- "..."
1+
bcr_test_module:
2+
module_path: "."
3+
matrix:
4+
platform: ["debian11", "ubuntu2404", "macos"]
5+
bazel: [7.x, 8.x]
6+
tasks:
7+
run_tests:
8+
name: "Build module"
9+
platform: ${{ platform }}
10+
bazel: ${{ bazel }}
11+
test_targets:
12+
- "//..."

.github/workflows/ci.bazelrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Debug where options came from
2+
build --announce_rc
3+
4+
# Don't rely on test logs being easily accessible from the test runner,
5+
# though it makes the log noisier.
6+
test --test_output=errors
7+
8+
# This directory is configured in GitHub actions to be persisted between runs.
9+
build --disk_cache=$HOME/.cache/bazel
10+
build --repository_cache=$HOME/.cache/bazel-repo
11+
12+
# Allows tests to run bazelisk-in-bazel, since this is the cache folder used
13+
test --test_env=XDG_CACHE_HOME

.github/workflows/ci.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: CI
2+
3+
# Controls when the action will run.
4+
on:
5+
push:
6+
branches: [master]
7+
pull_request:
8+
workflow_dispatch:
9+
10+
concurrency:
11+
# Cancel previous actions from the same PR: https://stackoverflow.com/a/72408109
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
test:
17+
runs-on: self-hosted
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: bazel-contrib/setup-bazel@0.15.0
21+
with:
22+
# Avoid downloading Bazel every time.
23+
bazelisk-cache: true
24+
# Store build cache per workflow.
25+
disk-cache: true
26+
# Share repository cache between workflows.
27+
repository-cache: true
28+
- name: bazel test
29+
run: >-
30+
bazelisk
31+
--bazelrc=.github/workflows/ci.bazelrc
32+
--bazelrc=.bazelrc
33+
test
34+
//...

.github/workflows/publish.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Publish new releases to Bazel Central Registry.
2+
name: Publish to BCR
3+
on:
4+
# Run the publish workflow after a successful release
5+
# Will be triggered from the release.yaml workflow
6+
workflow_call:
7+
inputs:
8+
tag_name:
9+
required: true
10+
type: string
11+
secrets:
12+
publish_token:
13+
required: true
14+
# In case of problems, let release engineers retry by manually dispatching
15+
# the workflow from the GitHub UI
16+
workflow_dispatch:
17+
inputs:
18+
tag_name:
19+
description: git tag being released
20+
required: true
21+
type: string
22+
jobs:
23+
publish:
24+
uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v0.2.3
25+
with:
26+
draft: false
27+
tag_name: ${{ inputs.tag_name }}
28+
# GitHub repository which is a fork of the upstream where the Pull Request will be opened.
29+
registry_fork: stackb/bazel-central-registry
30+
permissions:
31+
attestations: write
32+
contents: write
33+
id-token: write
34+
secrets:
35+
# Necessary to push to the BCR fork, and to open a pull request against a registry
36+
publish_token: ${{ secrets.publish_token || secrets.BCR_PUBLISH_TOKEN }}

.github/workflows/release.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Cut a release whenever a new tag is pushed to the repo.
2+
name: Release
3+
on:
4+
# Can be triggered from the tag.yaml workflow
5+
workflow_call:
6+
inputs:
7+
tag_name:
8+
required: true
9+
type: string
10+
secrets:
11+
publish_token:
12+
required: true
13+
# Or, developers can manually push a tag from their clone
14+
push:
15+
tags:
16+
- "v*.*.*"
17+
permissions:
18+
id-token: write
19+
attestations: write
20+
contents: write
21+
jobs:
22+
release:
23+
uses: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v7.2.3
24+
# uses: ./.github/workflows/release_ruleset.yaml # copied-from: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v7.2.3
25+
with:
26+
prerelease: false
27+
release_files: rules_closure-*.tar.gz
28+
tag_name: ${{ inputs.tag_name || github.ref_name }}
29+
secrets: inherit
30+
publish:
31+
needs: release
32+
uses: ./.github/workflows/publish.yaml
33+
with:
34+
tag_name: ${{ inputs.tag_name || github.ref_name }}
35+
secrets:
36+
publish_token: ${{ secrets.publish_token || secrets.BCR_PUBLISH_TOKEN }}

.github/workflows/release_prep.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
#!/usr/bin/env bash
3+
4+
set -o errexit -o nounset -o pipefail
5+
6+
# Set by GH actions, see
7+
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
8+
readonly TAG=$1
9+
# The prefix is chosen to match what GitHub generates for source archives.
10+
# This guarantees that users can easily switch from a released artifact to a source archive
11+
# with minimal differences in their code (e.g. strip_prefix remains the same)
12+
readonly PREFIX="rules_closure-${TAG}"
13+
readonly ARCHIVE="${PREFIX}.tar.gz"
14+
15+
# NB: configuration for 'git archive' is in /.gitattributes
16+
git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE
17+
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')
18+
19+
# The stdout of this program will be used as the top of the release notes for this release.
20+
cat << EOF
21+
## Using bzlmod with Bazel 6 or later:
22+
23+
Add to your \`MODULE.bazel\` file:
24+
25+
\`\`\`starlark
26+
bazel_dep(name = "rules_closure", version = "${TAG}")
27+
\`\`\`
28+
EOF

0 commit comments

Comments
 (0)