Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ common --grpc_keepalive_time=30s
# memory in exchange for higher download concurrency.
common --jobs=30

# These configs are split so linux CI can configure a custom exec platform.
common:remote --extra_execution_platforms=//:rbe
common:remote --remote_executor=grpcs://remote.buildbuddy.io
common:remote --jobs=800
common:remote --config=remote-base

common:remote-base --remote_executor=grpcs://remote.buildbuddy.io
common:remote-base --jobs=800

2 changes: 1 addition & 1 deletion .github/workflows/Dockerfile.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM ubuntu:24.04
# initial debugging, but we should publish to a more proper location.
#
# docker buildx create --use
# docker buildx build --platform linux/amd64 -f .github/workflows/Dockerfile.bazel -t mbolin491/codex-bazel:latest --push .
# docker buildx build --platform linux/amd64,linux/arm64 -f .github/workflows/Dockerfile.bazel -t mbolin491/codex-bazel:latest --push .

RUN apt-get update && \
apt-get install -y --no-install-recommends \
Expand Down
31 changes: 10 additions & 21 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,35 +97,24 @@ jobs:
# Use a very short path to reduce argv/path length issues.
"BAZEL_STARTUP_ARGS=--output_user_root=C:\" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: bazel test //...
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
- name: Configure Bazel startup args (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
bazel $BAZEL_STARTUP_ARGS --bazelrc=.github/workflows/ci.bazelrc test //... \
--build_metadata=REPO_URL=https://github.com/openai/codex.git \
--build_metadata=COMMIT_SHA=$(git rev-parse HEAD) \
--build_metadata=ROLE=CI \
--build_metadata=VISIBILITY=PUBLIC \
"--remote_header=x-buildbuddy-api-key=$BUILDBUDDY_API_KEY"
echo "BAZEL_STARTUP_ARGS=--bazelrc=.github/workflows/linux.bazelrc" >> "$GITHUB_ENV"

cloud-build:
name: just bazel-remote-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Bazel
uses: bazelbuild/setup-bazelisk@v3
- name: bazel test //... --config=remote
- name: bazel test //...
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
shell: bash
run: |
set -euo pipefail
bazel test //... \
target="${{ matrix.target }}"
host_arch="${target%%-*}" # e.g. aarch64 / x86_64

bazel $BAZEL_STARTUP_ARGS --bazelrc=.github/workflows/ci.bazelrc test //... \
--config="$host_arch" \
--build_metadata=REPO_URL=https://github.com/openai/codex.git \
--build_metadata=COMMIT_SHA=$(git rev-parse HEAD) \
--build_metadata=ROLE=CI \
--build_metadata=VISIBILITY=PUBLIC \
"--remote_header=x-buildbuddy-api-key=$BUILDBUDDY_API_KEY" \
--config=remote --platforms=//:rbe --keep_going
"--remote_header=x-buildbuddy-api-key=$BUILDBUDDY_API_KEY"
22 changes: 15 additions & 7 deletions .github/workflows/ci.bazelrc
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
common --remote_download_minimal
common --nobuild_runfile_links
common --keep_going

# Prefer to run the build actions entirely remotely so we can dial up the concurrency.
# Currently remote builds only work on Mac hosts, until we untangle the libc constraints mess on linux.
# These config settings are used to route linux RBE actions, but the linux bazelrc is included conditionally.
# This ensures that the configs are defined on non-linux as well.
common:aarch64 --keep_going
common:x86_64 --keep_going

# We prefer to run the build actions entirely remotely so we can dial up the concurrency.
# We have platform-specific tests, so we want to execute the tests on all platforms using the strongest sandboxing available on each platform.

# On linux, we can do a full remote build/test, by targeting the right (x86/arm) runners, so we have coverage of both.
# Linux crossbuilds don't work until we untangle the libc constraint mess.
common:linux --config=remote-base
common:linux --strategy=remote

# On mac, we can run all the build actions remotely but test actions locally.
common:macos --config=remote
common:macos --strategy=remote

# We have platform-specific tests, so execute the tests locally using the strongest sandboxing available on each platform.
common:macos --strategy=TestRunner=darwin-sandbox,local
# Note: linux-sandbox is stronger, but not available in GHA.
common:linux --strategy=TestRunner=processwrapper-sandbox,local

common:windows --strategy=TestRunner=local

4 changes: 4 additions & 0 deletions .github/workflows/linux.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
common:aarch64 --extra_execution_platforms=//:rbe_arm64
common:aarch64 --platforms=//:rbe_arm64
common:x86_64 --extra_execution_platforms=//:rbe
common:x86_64 --platforms=//:rbe
19 changes: 19 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@ platform(
# tools that various integration tests need.
# Verify at https://hub.docker.com/layers/mbolin491/codex-bazel/latest/images/sha256:8c9ff94187ea7c08a31e9a81f5fe8046ea3972a6768983c955c4079fa30567fb
"container-image": "docker://docker.io/mbolin491/codex-bazel@sha256:8c9ff94187ea7c08a31e9a81f5fe8046ea3972a6768983c955c4079fa30567fb",
"Arch": "amd64",
"OSFamily": "Linux",
},
)

platform(
name = "rbe_arm64",
constraint_values = [
"@platforms//cpu:aarch64",
"@platforms//os:linux",
"@bazel_tools//tools/cpp:clang",
"@toolchains_llvm_bootstrapped//constraints/libc:gnu.2.28",
],
exec_properties = {
# Ubuntu-based image that includes git, python3, dotslash, and other
# tools that various integration tests need.
# Verify at https://hub.docker.com/layers/mbolin491/codex-bazel/latest/images/sha256:ad9506086215fccfc66ed8d2be87847324be56790ae6a1964c241c28b77ef141
"container-image": "docker://docker.io/mbolin491/codex-bazel@sha256:ad9506086215fccfc66ed8d2be87847324be56790ae6a1964c241c28b77ef141",
"Arch": "arm64",
"OSFamily": "Linux",
},
)
Expand Down
Loading