Skip to content

Commit d6b1571

Browse files
authored
chore(ci): use bazelisk (googleapis#1485)
1 parent 40efa92 commit d6b1571

File tree

4 files changed

+23
-15
lines changed

4 files changed

+23
-15
lines changed

.bazeliskrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# See https://github.com/bazelbuild/bazelisk
2+
# Should match https://github.com/googleapis/googleapis/blob/master/.bazeliskrc
3+
USE_BAZEL_VERSION=6.3.0

.github/workflows/ci.yaml

+9-8
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,14 @@ jobs:
8787
apidiff -incompatible pkg.latest github.com/googleapis/gapic-showcase/client > diff.txt && cat diff.txt && ! [ -s diff.txt ]
8888
bazel-build:
8989
runs-on: ubuntu-latest
90-
env:
91-
USE_BAZEL_VERSION: 6.0.0
92-
container: gcr.io/gapic-images/googleapis:latest
93-
# Dockerfile for this image: https://github.com/googleapis/googleapis-discovery/blob/master/Dockerfile
9490
steps:
9591
- uses: actions/checkout@v4
96-
- name: Run bazel build
97-
run: bazelisk build '//...'
98-
- name: Run bazel test
99-
run: bazelisk test '//...'
92+
- uses: bazel-contrib/setup-bazel@0.8.1
93+
with:
94+
# Avoid downloading Bazel every time.
95+
bazelisk-cache: true
96+
# Store build cache per workflow.
97+
disk-cache: ${{ github.workflow }}
98+
# Share repository cache between workflows.
99+
repository-cache: true
100+
- run: bazelisk test '//...'

.github/workflows/deps.yaml

+8-4
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ jobs:
1414
outputs:
1515
changed: ${{ steps.update.outputs.changed }}
1616
runs-on: ubuntu-latest
17-
env:
18-
USE_BAZEL_VERSION: 6.0.0
19-
container: gcr.io/gapic-images/googleapis:latest
20-
# Dockerfile for this image: https://github.com/googleapis/googleapis-discovery/blob/master/Dockerfile
2117
steps:
2218
- uses: actions/checkout@v4
19+
- uses: bazel-contrib/setup-bazel@0.8.1
20+
with:
21+
# Avoid downloading Bazel every time.
22+
bazelisk-cache: true
23+
# Store build cache per workflow.
24+
disk-cache: ${{ github.workflow }}
25+
# Share repository cache between workflows.
26+
repository-cache: true
2327
- name: Run gazelle update-repos
2428
id: update
2529
run: |

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ install:
2525
go install ./cmd/protoc-gen-go_cli
2626

2727
update-bazel-repos:
28-
bazel run //:gazelle -- update-repos -from_file=go.mod -prune -to_macro=repositories.bzl%com_googleapis_gapic_generator_go_repositories
28+
bazelisk run //:gazelle -- update-repos -from_file=go.mod -prune -to_macro=repositories.bzl%com_googleapis_gapic_generator_go_repositories
2929
sed -i '' "s/ \"go_repository\",//g" repositories.bzl
30-
bazel run //:gazelle -- update-repos -from_file=showcase/go.mod -to_macro=repositories.bzl%com_googleapis_gapic_generator_go_repositories
30+
bazelisk run //:gazelle -- update-repos -from_file=showcase/go.mod -to_macro=repositories.bzl%com_googleapis_gapic_generator_go_repositories
3131
sed -i '' "s/ \"go_repository\",//g" repositories.bzl
3232

3333
gazelle:
34-
bazel run //:gazelle
34+
bazelisk run //:gazelle
3535
sed -i '' "s/extendedops_go_proto/extended_operations_go_proto/g" internal/gengapic/BUILD.bazel
3636
sed -i '' "s/@com_github_golang_protobuf\/\/protoc-gen-go\/plugin/@io_bazel_rules_go\/\/proto\/wkt:compiler_plugin_go_proto/g" cmd/protoc-gen-go_gapic/BUILD
3737
sed -i '' "s/@com_github_golang_protobuf\/\/protoc-gen-go\/plugin/@io_bazel_rules_go\/\/proto\/wkt:compiler_plugin_go_proto/g" cmd/protoc-gen-go_cli/BUILD.bazel

0 commit comments

Comments
 (0)