Skip to content

Commit 5bf27a0

Browse files
Merge pull request #3104 from j2kun:buildbuddy-enable
PiperOrigin-RevId: 936757783
2 parents 6f08617 + fd27969 commit 5bf27a0

4 files changed

Lines changed: 48 additions & 23 deletions

File tree

.bazelrc

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,26 @@ common --@rules_python//python/config_settings:bootstrap_impl=script
2222
# default in bazel 9
2323
startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1
2424

25-
# buildbuddy
26-
# for remote execution of the build. Add `common --config=remote` to
27-
# .bazelrc.user
28-
common:remote --bes_backend=grpcs://heir.buildbuddy.io
29-
common:remote --bes_results_url=https://heir.buildbuddy.io/invocation/
30-
common:remote --remote_cache=grpcs://heir.buildbuddy.io
31-
common:remote --remote_cache_compression
32-
common:remote --remote_timeout=10m
25+
# BuildBuddy
26+
build --bes_results_url=https://heir.buildbuddy.io/invocation/
27+
build --bes_backend=grpcs://heir.buildbuddy.io
28+
common --noremote_upload_local_results # Uploads logs & artifacts without writing to cache
29+
common --remote_cache=grpcs://heir.buildbuddy.io
30+
common --remote_cache_compression
31+
common --remote_header=x-buildbuddy-api-key=IqGGzfrvMgDJh927qtrw
32+
common --remote_timeout=10m
33+
34+
# This enables remote build execution and writing to the remote cache, which
35+
# dramatically speeds up builds. Add a .bazelrc.user file with:
36+
#
37+
# common --remote_header=x-buildbuddy-api-key=<YOUR_API_KEY>
38+
# common --config=remote
39+
#
40+
# Note this requires a buildbuddy.io account and API key. The default
41+
# API key used above is read-only.
3342
common:remote --extra_execution_platforms=@llvm//:rbe_platform
3443
common:remote --jobs=500
35-
common:remote --remote_executor=grpcs://heir.buildbuddy.io
44+
common:remote --remote_executor=grpcs://remote.buildbuddy.io
3645

3746
# CI executions are always remote, and have extra build metadata
3847
common:ci --build_metadata=ROLE=CI

.github/workflows/build_and_test.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on:
1616
labels: ubuntu-24.04-64core
1717
env:
18-
BUILDBUDDY_API_KEY: ${{ github.event_name != 'pull_request' && secrets.BUILDBUDDY_API_KEY || vars.BUILDBUDDY_READ_ONLY_API_KEY }}
18+
BUILDBUDDY_API_KEY: ${{ github.event_name != 'pull_request' && secrets.BUILDBUDDY_API_KEY || '7eYz4UY70YSrT55wmjWV' }}
1919
steps:
2020
- name: Check out repository code
2121
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
@@ -38,11 +38,17 @@ jobs:
3838
# Bazel tests
3939
- name: "Run `bazel build`"
4040
run: |
41-
bazel build -c opt //...
41+
bazel build -c opt \
42+
--config=ci \
43+
--remote_header=x-buildbuddy-api-key="$BUILDBUDDY_API_KEY" \
44+
//...
4245
4346
- name: "Run `bazel test`"
4447
run: |
45-
bazel test -c opt //...
48+
bazel test -c opt \
49+
--config=ci \
50+
--remote_header=x-buildbuddy-api-key="$BUILDBUDDY_API_KEY" \
51+
//...
4652
4753
# Frontend tests
4854
- name: Build OpenFHE

.github/workflows/docs.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
permissions:
1717
contents: write
1818
env:
19-
BUILDBUDDY_API_KEY: ${{ github.event_name != 'pull_request' && secrets.BUILDBUDDY_API_KEY || vars.BUILDBUDDY_READ_ONLY_API_KEY }}
19+
BUILDBUDDY_API_KEY: ${{ github.event_name != 'pull_request' && secrets.BUILDBUDDY_API_KEY || '7eYz4UY70YSrT55wmjWV' }}
2020
steps:
2121
- name: Checkout
2222
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
@@ -45,14 +45,20 @@ jobs:
4545
- name: "Build markdown files from tblgen sources"
4646
run: |
4747
bazel query "filter('_filegroup', siblings(kind('gentbl_rule', @heir//...)))" | \
48-
xargs bazel build --//:enable_openmp=0 -c opt "$@"
48+
xargs bazel build -c opt \
49+
--config=ci \
50+
--remote_header=x-buildbuddy-api-key="$BUILDBUDDY_API_KEY" \
51+
"$@"
4952
5053
- name: "Copy markdown files to docs/"
5154
run: |
5255
python -m pip install --upgrade pip
5356
python -m pip install pyyaml==6.0.2 fire==0.7.0
5457
# heir-opt is needed to generate the doctest examples
55-
bazel build --//:enable_openmp=0 -c opt //tools:heir-opt
58+
bazel build -c opt \
59+
--config=ci \
60+
--remote_header=x-buildbuddy-api-key="$BUILDBUDDY_API_KEY" \
61+
//tools:heir-opt
5662
python -m scripts.docs.copy_tblgen_files
5763
5864
# Please update the local install instructions at docs/README.md if

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,6 @@ encrypt-run-decrypt flow for ease of testing.
5555

5656
## Building from source
5757

58-
HEIR requires a recent C compiler (see
59-
[clang_matrix](https://github.com/google/heir/actions/workflows/clang_matrix.yml)
60-
for version-specific support, recent GCCs also tend to work), and some backends
61-
like OpenFHE require `libomp-dev`.
62-
63-
HEIR depends on LLVM (from source) so a clean build may take 15-30 minutes
64-
depending on your machine.
65-
6658
This project uses `bazel` for its build system. Install
6759
[bazelisk](https://github.com/bazelbuild/bazelisk) to manage the bazel version
6860
automatically. Then, with `bazel` on your path (pointing to `bazelisk`), run the
@@ -78,6 +70,18 @@ Or run an end-to-end test like
7870
bazel test //tests/Examples/openfhe/ckks/halevi_shoup_matvec:all
7971
```
8072

73+
HEIR depends on LLVM (from source) so a clean build may take 30 minutes
74+
depending on your machine. For faster builds, use
75+
[BuildBuddy](https://www.buildbuddy.io/). Sign up for an account, create an API
76+
key, and add the following to `.bazelrc.user` in the root of the HEIR workspace:
77+
78+
```
79+
common --remote_header=x-buildbuddy-api-key=<YOUR_API_KEY>
80+
common --config=remote
81+
```
82+
83+
This should reduce a clean build time to about 5 minutes.
84+
8185
See the [bazel tips](https://heir.dev/docs/development/bazel/) page for more
8286
example commands and tips on using bazel.
8387

0 commit comments

Comments
 (0)