Skip to content

Commit

Permalink
Add remote execution test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
bduffany committed Apr 2, 2024
1 parent eda9c50 commit cbe8915
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 2 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/test-executor-linux-arm64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "Test linux/arm64 executor"

on:
pull_request:
branches:
- master

jobs:
build:
runs-on: ubuntu-22.04-16cpu-arm64
if: "!contains(github.event.head_commit.message, 'ci skip')"

steps:
- name: Checkout
uses: actions/checkout@v4

# GitHub's arm64 runners do not have the same pre-installed software as
# the amd64 runners so we have to install a few things here.
- name: Install bazelisk
run: |
curl -L --output /tmp/bazelisk https://github.com/bazelbuild/bazelisk/releases/download/v1.17.0/bazelisk-linux-arm64
chmod +x /tmp/bazelisk
sudo mv /tmp/bazelisk /usr/bin/bazelisk
sudo ln -s /usr/bin/bazelisk /usr/bin/bazel
- name: Install apt packages
run: |
sudo apt-get update
sudo apt-get install -y gcc g++
- name: Run tests
run: |
bazel test \
//enterprise/server/test/integration/remote_execution:remote_execution_test \
--config=cache \
--build_metadata=ROLE=CI \
--bes_backend=remote.buildbuddy.io \
--bes_results_url=https://app.buildbuddy.io/invocation/ \
--remote_cache=remote.buildbuddy.io
18 changes: 18 additions & 0 deletions deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6825,6 +6825,12 @@ def install_static_dependencies(workspace_name = "buildbuddy"):
sha256 = "6d9c268fa0f696c3fc71b3656936c777d02b3b1c6637674ac3173facaefa4a77",
urls = ["https://storage.googleapis.com/buildbuddy-tools/binaries/redis/redis-server-6.2.1-linux-x86_64"],
)
http_file(
name = "com_github_redis_redis-redis-server-v6.2.1-linux-arm64",
executable = True,
sha256 = "c381660c79dcbe4835a243bab8a0d3c3ee5dc502c1b4a47f1761bd8f9e7be240",
urls = ["https://storage.googleapis.com/buildbuddy-tools/binaries/redis/redis-server-6.2.1-linux-arm64"],
)
http_file(
name = "com_github_redis_redis-redis-server-v6.2.6-darwin-arm64",
executable = True,
Expand All @@ -6849,6 +6855,12 @@ def install_static_dependencies(workspace_name = "buildbuddy"):
sha256 = "973e213b1e9207ccdd3ea4730c0f92cbef769ec112ac2b84980583220d8db845",
urls = ["https://github.com/bazelbuild/bazel/releases/download/5.3.2/bazel-5.3.2-linux-x86_64"],
)
http_file(
name = "io_bazel_bazel-5.3.2-linux-arm64",
executable = True,
sha256 = "dcad413da286ac1d3f88e384ff05c2ed796f903be85b253591d170ce258db721",
urls = ["https://github.com/bazelbuild/bazel/releases/download/5.3.2/bazel-5.3.2-linux-arm64"],
)
http_file(
name = "io_bazel_bazel-6.0.0-darwin-x86_64",
executable = True,
Expand All @@ -6861,6 +6873,12 @@ def install_static_dependencies(workspace_name = "buildbuddy"):
sha256 = "f03d44ecaac3878e3d19489e37caa4ca1dc57427b686a78a85065ea3c27ebe68",
urls = ["https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-linux-x86_64"],
)
http_file(
name = "io_bazel_bazel-6.0.0-linux-arm64",
executable = True,
sha256 = "408c33a0edb8f31374da47e011eef88c360264f268e9a4e3d9e699fbd5e57ad3",
urls = ["https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-linux-arm64"],
)
http_file(
name = "io_bazel_bazel-6.5.0-darwin-x86_64",
executable = True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,10 @@ func TestSimpleCommandWithOSArchPool_CaseInsensitive(t *testing.T) {
platform := &repb.Platform{
Properties: []*repb.Platform_Property{
{Name: "Pool", Value: "FoO"},
{Name: "OSFamily", Value: "LiNuX"},
{Name: "Arch", Value: "AmD64"},
// GOOS / GOARCH are normally lowercase, make sure uppercase
// variants are treated equivalently.
{Name: "OSFamily", Value: strings.ToUpper(runtime.GOOS)},
{Name: "Arch", Value: strings.ToUpper(runtime.GOARCH)},
},
}

Expand Down Expand Up @@ -694,11 +696,19 @@ func TestSimpleCommand_DefaultWorkspacePermissions(t *testing.T) {
"output_file_parent", "input_dir",
}

platform := &repb.Platform{
Properties: []*repb.Platform_Property{
{Name: "OSFamily", Value: runtime.GOOS},
{Name: "Arch", Value: runtime.GOARCH},
},
}

cmd := rbe.Execute(&repb.Command{
// %a %n prints perms in octal followed by the file name.
Arguments: append([]string{"stat", "--format", "%a %n"}, dirs...),
OutputDirectories: []string{"output_dir", "output_dir_parent/output_dir_child"},
OutputFiles: []string{"output_file_parent/output.txt"},
Platform: platform,
}, &rbetest.ExecuteOpts{InputRootDir: inputRoot})
res := cmd.Wait()

Expand Down
1 change: 1 addition & 0 deletions enterprise/server/testutil/testredis/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ genrule(
name = "redis-server_crossplatform",
srcs = select({
"//platforms/configs:linux_x86_64": ["@com_github_redis_redis-redis-server-v6.2.1-linux-x86_64//file:downloaded"],
"//platforms/configs:linux_arm64": ["@com_github_redis_redis-redis-server-v6.2.1-linux-arm64//file:downloaded"],
"//platforms/configs:macos_x86_64": ["@com_github_redis_redis-redis-server-v6.2.6-darwin-x86_64//file:downloaded"],
"//platforms/configs:macos_arm64": ["@com_github_redis_redis-redis-server-v6.2.6-darwin-arm64//file:downloaded"],
}),
Expand Down
1 change: 1 addition & 0 deletions enterprise/server/testutil/testredis/testredis.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func (h *Handle) start() {
osArchKey := runtime.GOOS + "_" + runtime.GOARCH
switch osArchKey {
case "linux_amd64":
case "linux_arm64":
case "darwin_amd64":
case "darwin_arm64":
default:
Expand Down
8 changes: 8 additions & 0 deletions platforms/configs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ config_setting(
],
)

config_setting(
name = "linux_arm64",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:arm64",
],
)

config_setting(
name = "macos_x86_64",
constraint_values = [
Expand Down
1 change: 1 addition & 0 deletions server/util/bazel/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def bazel_pkg_tar(name, versions = [], **kwargs):
name = "bazel-{}_crossplatform".format(version),
srcs = select({
"@bazel_tools//src/conditions:darwin": ["@io_bazel_bazel-{}-darwin-x86_64//file:downloaded".format(version)],
"//platforms/configs:linux_arm64": ["@io_bazel_bazel-{}-linux-arm64//file:downloaded".format(version)],
"//conditions:default": ["@io_bazel_bazel-{}-linux-x86_64//file:downloaded".format(version)],
}),
outs = ["bazel-{}".format(version)],
Expand Down

0 comments on commit cbe8915

Please sign in to comment.