From af3aac9de1971c86cd58f60a891d04ca2d3281af Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Wed, 20 Mar 2024 10:06:46 +0100 Subject: [PATCH 1/2] CI: Automatically derive the version of Bazel to use Right now we hardcode 6.0.0 in there, even though we already have it specified in .bazelversion in the root of the repository. --- .github/workflows/master.yaml | 8 ++++---- .github/workflows/pull-requests.yaml | 8 ++++---- tools/github_workflows/workflows_template.libsonnet | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/master.yaml b/.github/workflows/master.yaml index ac4d5c34..3f162c5e 100644 --- a/.github/workflows/master.yaml +++ b/.github/workflows/master.yaml @@ -3,14 +3,14 @@ "build_and_test": { "runs-on": "ubuntu-latest", "steps": [ - { - "name": "Installing Bazel", - "run": "curl -L https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-linux-x86_64 > ~/bazel && chmod +x ~/bazel && echo ~ >> ${GITHUB_PATH}" - }, { "name": "Check out source code", "uses": "actions/checkout@v1" }, + { + "name": "Installing Bazel", + "run": "v=$(cat .bazelversion) && curl -L https://github.com/bazelbuild/bazel/releases/download/${v}/bazel-${v}-linux-x86_64 > ~/bazel && chmod +x ~/bazel && echo ~ >> ${GITHUB_PATH}" + }, { "name": "Gazelle", "run": "bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro go_dependencies.bzl%go_dependencies -prune && bazel run //:gazelle" diff --git a/.github/workflows/pull-requests.yaml b/.github/workflows/pull-requests.yaml index 53699bb4..18f8e68d 100644 --- a/.github/workflows/pull-requests.yaml +++ b/.github/workflows/pull-requests.yaml @@ -3,14 +3,14 @@ "build_and_test": { "runs-on": "ubuntu-latest", "steps": [ - { - "name": "Installing Bazel", - "run": "curl -L https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-linux-x86_64 > ~/bazel && chmod +x ~/bazel && echo ~ >> ${GITHUB_PATH}" - }, { "name": "Check out source code", "uses": "actions/checkout@v1" }, + { + "name": "Installing Bazel", + "run": "v=$(cat .bazelversion) && curl -L https://github.com/bazelbuild/bazel/releases/download/${v}/bazel-${v}-linux-x86_64 > ~/bazel && chmod +x ~/bazel && echo ~ >> ${GITHUB_PATH}" + }, { "name": "Gazelle", "run": "bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro go_dependencies.bzl%go_dependencies -prune && bazel run //:gazelle" diff --git a/tools/github_workflows/workflows_template.libsonnet b/tools/github_workflows/workflows_template.libsonnet index ccad0e4b..ab43c505 100644 --- a/tools/github_workflows/workflows_template.libsonnet +++ b/tools/github_workflows/workflows_template.libsonnet @@ -59,14 +59,14 @@ // TODO: Switch back to l.gcr.io/google/bazel once updated // container images get published once again. // https://github.com/GoogleCloudPlatform/container-definitions/issues/12037 - { - name: 'Installing Bazel', - run: 'curl -L https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-linux-x86_64 > ~/bazel && chmod +x ~/bazel && echo ~ >> ${GITHUB_PATH}', - }, { name: 'Check out source code', uses: 'actions/checkout@v1', }, + { + name: 'Installing Bazel', + run: 'v=$(cat .bazelversion) && curl -L https://github.com/bazelbuild/bazel/releases/download/${v}/bazel-${v}-linux-x86_64 > ~/bazel && chmod +x ~/bazel && echo ~ >> ${GITHUB_PATH}', + }, { name: 'Gazelle', run: 'bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro go_dependencies.bzl%go_dependencies -prune && bazel run //:gazelle', From d4a17c5260ab02c230c9ce9f530d560617c25f3e Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Wed, 20 Mar 2024 10:07:20 +0100 Subject: [PATCH 2/2] Upgrade to Bazel 6.4.0 We should at some point upgrade to Bazel 7.x, but that requires more bzlmod trickery. Let's first jump to 6.4.0, so that Alex can use native.package_relative_label() in PR #199. --- .bazelversion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelversion b/.bazelversion index 09b254e9..19b860c1 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -6.0.0 +6.4.0