[llvm] [Github][Bazel] Add Workflow to Run Bazel Build (PR #165071)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 24 21:24:37 PDT 2025


https://github.com/boomanaiden154 updated https://github.com/llvm/llvm-project/pull/165071

>From 9697dab0ff62851305569b1489d81045334b74b2 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Sat, 25 Oct 2025 04:15:05 +0000
Subject: [PATCH 1/4] [Github][Bazel] Add Workflow to Run Bazel Build

This patch adds a job to the bazel checks workflow to run the bazel
build/test. This patch only tests a couple projects just to get things
going. The plan is to expand to more projects eventually and setup a GCS
bucket for caching so jobs complete quickly by using cached artifacts.

This should add minimal load to the CI given the low frequency of bazel
PRs, and especially when we enable GCS based caching due to bazel's
effective use of caching. Google is also sponsoring the Linux Premerge
CI and is interested in having premerge bazel builds which is why it
makes sense to do premerge testing of this alternative build system.
---
 .github/workflows/bazel-checks.yml | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/.github/workflows/bazel-checks.yml b/.github/workflows/bazel-checks.yml
index 65d51649dd9e7..7890789aa03c5 100644
--- a/.github/workflows/bazel-checks.yml
+++ b/.github/workflows/bazel-checks.yml
@@ -30,3 +30,26 @@ jobs:
       - name: Run Buildifier
         run: |
           buildifier --mode=check $(find ./utils/bazel -name *BUILD*)
+  
+  bazel-build:
+    name: "Bazel Build/Test"
+    runs-on: llvm-premerge-linux-runners
+    if: github.repository == 'llvm/llvm-project'
+    steps:
+      - name: Fetch LLVM sources
+        uses: actions/checkout at 08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+        # TODO(boomanaiden154): We should use a purpose built container for this. Move
+        # over when we have fixed the issues with using custom containers with Github
+        # ARC in GKE.
+      - name: Setup System Dependencies
+        run: |
+          sudo apt-get install -y libmpfr-dev pfm
+          sudo curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.27.0/bazelisk-amd64.deb > /tmp/bazelisk.deb
+          sudo apt-get install -y /tmp/bazelisk.deb
+          rm /tmp/bazelisk.deb
+      - name: Build/Test
+        working-directory: utils/bazel
+        run: |
+          bazel test --config=ci @llvm-project//llvm/... \
+            @llvm-project/clang/... \
+            @llvm-project/mlir/...

>From 8ef3b0a69c8963a4e17f8d83f2dd5b564f8b3b06 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Sat, 25 Oct 2025 04:20:25 +0000
Subject: [PATCH 2/4] fix1

---
 .github/workflows/bazel-checks.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.github/workflows/bazel-checks.yml b/.github/workflows/bazel-checks.yml
index 7890789aa03c5..2547130bbcd34 100644
--- a/.github/workflows/bazel-checks.yml
+++ b/.github/workflows/bazel-checks.yml
@@ -43,6 +43,7 @@ jobs:
         # ARC in GKE.
       - name: Setup System Dependencies
         run: |
+          sudo apt-get update
           sudo apt-get install -y libmpfr-dev pfm
           sudo curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.27.0/bazelisk-amd64.deb > /tmp/bazelisk.deb
           sudo apt-get install -y /tmp/bazelisk.deb

>From 862d76819fe7c6e696eb5df7296b0131dd907795 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Sat, 25 Oct 2025 04:22:25 +0000
Subject: [PATCH 3/4] fix2

---
 .github/workflows/bazel-checks.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/bazel-checks.yml b/.github/workflows/bazel-checks.yml
index 2547130bbcd34..3bc38225b92a9 100644
--- a/.github/workflows/bazel-checks.yml
+++ b/.github/workflows/bazel-checks.yml
@@ -52,5 +52,5 @@ jobs:
         working-directory: utils/bazel
         run: |
           bazel test --config=ci @llvm-project//llvm/... \
-            @llvm-project/clang/... \
-            @llvm-project/mlir/...
+            @llvm-project//clang/... \
+            @llvm-project//mlir/...

>From 32dd8d9b4bfa0bec2291634c3806a9aec02628d2 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Sat, 25 Oct 2025 04:24:24 +0000
Subject: [PATCH 4/4] fix3

---
 .github/workflows/bazel-checks.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/bazel-checks.yml b/.github/workflows/bazel-checks.yml
index 3bc38225b92a9..0bd76b92e79ad 100644
--- a/.github/workflows/bazel-checks.yml
+++ b/.github/workflows/bazel-checks.yml
@@ -51,6 +51,7 @@ jobs:
       - name: Build/Test
         working-directory: utils/bazel
         run: |
-          bazel test --config=ci @llvm-project//llvm/... \
+          bazel test --config=ci --sandbox_base="" \
+            @llvm-project//llvm/... \
             @llvm-project//clang/... \
             @llvm-project//mlir/...



More information about the llvm-commits mailing list