Skip to content

Commit d396d12

Browse files
KapJIfacebook-github-bot
authored andcommitted
Add test for persistent remote workers on BuildBuddy
Summary: Part of #787 Includes an example setup that works with - local builds without persistent worker - local builds with persistent worker (Buck2 protocol) - remote builds without persistent worker The demo worker included in the example in this PR distinguishes between Buck2 worker, Bazel remote worker, and one-shot modes depending on whether Buck2's WORKER_SOCKET, Bazel's --persistent_worker flag, or neither is set. The example includes a README with detailed instructions how to test this feature. - remote builds with persistent worker (Bazel protocol) Reviewed By: scottcao Differential Revision: D68157749 fbshipit-source-id: 51e2e247c75e0ca9736ddc0a5f383e662edee298
1 parent df48a53 commit d396d12

29 files changed

+1150
-1
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: build_example_persistent_worker
2+
inputs:
3+
buildbuddyApiKey:
4+
description: "The API key for BuildBuddy remote cache and execution."
5+
required: true
6+
runs:
7+
using: composite
8+
steps:
9+
- name: Build examples/persistent_worker directory
10+
env:
11+
BUILDBUDDY_API_KEY: ${{ inputs.buildbuddyApiKey }}
12+
run: |-
13+
cd examples/persistent_worker
14+
export PATH="$RUNNER_TEMP/artifacts:$PATH"
15+
./test.sh
16+
shell: bash

.github/workflows/build-and-test.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Build and test
22
on:
33
push:
44
pull_request:
5+
workflow_dispatch: # allows manual triggering
56
jobs:
67
linux-build-and-test:
78
runs-on: 4-core-ubuntu
@@ -51,7 +52,7 @@ jobs:
5152
- uses: ./.github/actions/setup_reindeer
5253
- uses: ./.github/actions/build_bootstrap
5354
linux-build-examples:
54-
runs-on: ubuntu-latest
55+
runs-on: ubuntu-22.04
5556
steps:
5657
- uses: actions/[email protected]
5758
- uses: ./.github/actions/setup_linux_env
@@ -69,6 +70,9 @@ jobs:
6970
$RUNNER_TEMP/artifacts/buck2 test //... -v 2
7071
- uses: ./.github/actions/build_example_conan
7172
- uses: ./.github/actions/build_example_no_prelude
73+
- uses: ./.github/actions/build_example_persistent_worker
74+
with:
75+
buildbuddyApiKey: ${{ secrets.BUILDBUDDY_API_KEY }}
7276
- uses: ./.github/actions/setup_reindeer
7377
- uses: ./.github/actions/build_bootstrap
7478
windows-build-examples:
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[cells]
2+
root = .
3+
prelude = prelude
4+
toolchains = toolchains
5+
none = none
6+
7+
[cell_aliases]
8+
config = prelude
9+
fbcode = none
10+
fbsource = none
11+
buck = none
12+
13+
[external_cells]
14+
prelude = bundled
15+
16+
[parser]
17+
target_platform_detector_spec = target:root//...->prelude//platforms:default
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[buck2]
2+
digest_algorithms = SHA256
3+
4+
[buck2_re_client]
5+
engine_address = grpc://remote.buildbuddy.io
6+
action_cache_address = grpc://remote.buildbuddy.io
7+
cas_address = grpc://remote.buildbuddy.io
8+
tls = true
9+
http_headers = \
10+
x-buildbuddy-api-key:$BUILDBUDDY_API_KEY
11+
12+
[build]
13+
execution_platforms = root//platforms:buildbuddy
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[buck2]
2+
digest_algorithms = SHA256
3+
4+
[buck2_re_client]
5+
engine_address = grpc://remote.buildbuddy.io
6+
action_cache_address = grpc://remote.buildbuddy.io
7+
cas_address = grpc://remote.buildbuddy.io
8+
tls = true
9+
http_headers = \
10+
x-buildbuddy-api-key:$BUILDBUDDY_API_KEY
11+
12+
[build]
13+
execution_platforms = root//platforms:buildbuddy-persistent-workers
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[build]
2+
execution_platforms = root//platforms:local-persistent-workers
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[build]
2+
execution_platforms = root//platforms:local

examples/persistent_worker/.buckroot

Whitespace-only changes.

examples/persistent_worker/.envrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# specify the following:
2+
# - BUILDBUDDY_API_KEY
3+
source_env_if_exists .envrc.private

examples/persistent_worker/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.buckconfig.local
2+
.direnv
3+
.envrc.private
4+
prelude

0 commit comments

Comments
 (0)