Compare commits

...

3 Commits

Author SHA1 Message Date
starr-openai
8f65d78dcc ci: trigger remote-env lane for shared setup changes
Co-authored-by: Codex <noreply@openai.com>
2026-04-07 13:50:49 -07:00
starr-openai
b6db359493 ci: switch remote-env pr smoke tests to bazel 2026-04-06 15:53:37 -07:00
starr-openai
dce7723492 Restore Linux remote-env PR tests 2026-04-06 15:53:37 -07:00
5 changed files with 116 additions and 28 deletions

View File

@@ -8,9 +8,10 @@ The workflows in this directory are split so that pull requests get fast, review
It runs Bazel `test` and Bazel `clippy` on the supported Bazel targets,
including the generated Rust test binaries needed to lint inline `#[cfg(test)]`
code.
- `rust-ci.yml` keeps the Cargo-native PR checks intentionally small:
- `rust-ci.yml` keeps a small set of supplemental PR checks intentionally small:
- `cargo fmt --check`
- `cargo shear`
- Linux remote-env smoke tests
- `argument-comment-lint` on Linux, macOS, and Windows
- `tools/argument-comment-lint` package tests when the lint or its workflow wiring changes
@@ -24,7 +25,7 @@ The workflows in this directory are split so that pull requests get fast, review
- the full Cargo `nextest` matrix
- release-profile Cargo builds
- cross-platform `argument-comment-lint`
- Linux remote-env tests
- the broader Linux remote-env coverage
## Rule Of Thumb

View File

@@ -39,7 +39,7 @@ jobs:
argument_comment_lint_package=false
workflows=false
for f in "${files[@]}"; do
[[ $f == codex-rs/* ]] && codex=true
[[ $f == codex-rs/* || $f == defs.bzl || $f == scripts/test-remote-env.sh ]] && codex=true
[[ $f == codex-rs/* || $f == tools/argument-comment-lint/* || $f == justfile ]] && argument_comment_lint=true
[[ $f == tools/argument-comment-lint/* || $f == .github/workflows/rust-ci.yml || $f == .github/workflows/rust-ci-full.yml ]] && argument_comment_lint_package=true
[[ $f == .github/* ]] && workflows=true
@@ -50,7 +50,7 @@ jobs:
echo "codex=$codex" >> "$GITHUB_OUTPUT"
echo "workflows=$workflows" >> "$GITHUB_OUTPUT"
# --- Fast Cargo-native PR checks -------------------------------------------
# --- Fast PR checks --------------------------------------------------------
general:
name: Format / etc
runs-on: ubuntu-24.04
@@ -85,6 +85,87 @@ jobs:
- name: cargo shear
run: cargo shear
remote_tests_linux:
name: Remote tests - Linux
runs-on:
group: codex-runners
labels: codex-linux-x64
timeout-minutes: 45
needs: changed
if: ${{ needs.changed.outputs.codex == 'true' || needs.changed.outputs.workflows == 'true' }}
defaults:
run:
working-directory: codex-rs
env:
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Bazel CI
uses: ./.github/actions/setup-bazel-ci
with:
target: x86_64-unknown-linux-gnu
install-test-prereqs: "true"
- name: Install Linux build dependencies
shell: bash
run: |
set -euo pipefail
if command -v apt-get >/dev/null 2>&1; then
sudo apt-get update -y
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends pkg-config libcap-dev
fi
- name: Enable unprivileged user namespaces
run: |
sudo sysctl -w kernel.unprivileged_userns_clone=1
if sudo sysctl -a 2>/dev/null | grep -q '^kernel.apparmor_restrict_unprivileged_userns'; then
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
fi
- name: Set up remote test env (Docker)
shell: bash
run: |
set -euo pipefail
export CODEX_TEST_REMOTE_ENV_CONTAINER_NAME=codex-remote-test-env
export CODEX_TEST_REMOTE_ENV_SKIP_EXEC_SERVER_BUILD=1
source "${GITHUB_WORKSPACE}/scripts/test-remote-env.sh"
echo "CODEX_TEST_REMOTE_ENV=${CODEX_TEST_REMOTE_ENV}" >> "$GITHUB_ENV"
- name: Remote tests via Bazel
id: remote_tests
shell: bash
run: |
set -euo pipefail
cd "${GITHUB_WORKSPACE}"
run_remote_test() {
local target="$1"
local test_name="$2"
"${GITHUB_WORKSPACE}/.github/scripts/run-bazel-ci.sh" \
--print-failed-test-logs \
--use-node-test-env \
-- \
test \
--test_env=CODEX_TEST_REMOTE_ENV="${CODEX_TEST_REMOTE_ENV}" \
--test_arg="${test_name}" \
--test_arg=--exact \
--test_verbose_timeout_warnings \
--build_metadata=COMMIT_SHA="${GITHUB_SHA}" \
-- \
"${target}"
}
run_remote_test "//codex-rs/core:core-unit-tests" "unified_exec::tests::unified_exec_uses_remote_exec_server_when_configured"
run_remote_test "//codex-rs/core:core-unit-tests" "unified_exec::tests::remote_exec_server_rejects_inherited_fd_launches"
run_remote_test "//codex-rs/core:core-all-test" "suite::remote_env::remote_test_env_can_connect_and_use_filesystem"
env:
RUST_BACKTRACE: 1
- name: Tear down remote test env
if: always()
shell: bash
run: |
set +e
if [[ "${{ steps.remote_tests.outcome }}" != "success" ]]; then
docker logs codex-remote-test-env || true
fi
docker rm -f codex-remote-test-env >/dev/null 2>&1 || true
argument_comment_lint_package:
name: Argument comment lint package
runs-on: ubuntu-24.04
@@ -194,6 +275,7 @@ jobs:
changed,
general,
cargo_shear,
remote_tests_linux,
argument_comment_lint_package,
argument_comment_lint_prebuilt,
]
@@ -206,6 +288,7 @@ jobs:
echo "argpkg : ${{ needs.argument_comment_lint_package.result }}"
echo "arglint: ${{ needs.argument_comment_lint_prebuilt.result }}"
echo "general: ${{ needs.general.result }}"
echo "remote : ${{ needs.remote_tests_linux.result }}"
echo "shear : ${{ needs.cargo_shear.result }}"
# If nothing relevant changed (PR touching only root README, etc.),
@@ -226,4 +309,5 @@ jobs:
if [[ '${{ needs.changed.outputs.codex }}' == 'true' || '${{ needs.changed.outputs.workflows }}' == 'true' ]]; then
[[ '${{ needs.general.result }}' == 'success' ]] || { echo 'general failed'; exit 1; }
[[ '${{ needs.cargo_shear.result }}' == 'success' ]] || { echo 'cargo_shear failed'; exit 1; }
[[ '${{ needs.remote_tests_linux.result }}' == 'success' ]] || { echo 'remote_tests_linux failed'; exit 1; }
fi

View File

@@ -52,6 +52,7 @@ codex_rust_crate(
"//codex-rs/linux-sandbox:codex-linux-sandbox",
"//codex-rs/rmcp-client:test_stdio_server",
"//codex-rs/rmcp-client:test_streamable_http_server",
"//codex-rs/exec-server:codex-exec-server",
"//codex-rs/cli:codex",
],
)

View File

@@ -218,6 +218,17 @@ def codex_rust_crate(
maybe_deps += [name + "-build-script"]
sanitized_binaries = []
cargo_env = {}
for binary in binaries.keys():
#binary = binary.replace("-", "_")
sanitized_binaries.append(binary)
cargo_env["CARGO_BIN_EXE_" + binary] = "$(rlocationpath :%s)" % binary
for binary_label in extra_binaries:
sanitized_binaries.append(binary_label)
binary = Label(binary_label).name
cargo_env["CARGO_BIN_EXE_" + binary] = "$(rlocationpath %s)" % binary_label
if lib_srcs:
lib_rule = rust_proc_macro if proc_macro else rust_library
lib_rule(
@@ -251,7 +262,7 @@ def codex_rust_crate(
"--remap-path-prefix=codex-rs=",
],
rustc_env = rustc_env,
data = test_data_extra,
data = test_data_extra + sanitized_binaries,
tags = test_tags + ["manual"],
)
@@ -261,7 +272,7 @@ def codex_rust_crate(
workspace_root_test(
name = name + "-unit-tests",
env = test_env,
env = test_env | cargo_env,
test_bin = ":" + unit_test_binary,
workspace_root_marker = "//codex-rs/utils/cargo-bin:repo_root.marker",
tags = test_tags,
@@ -270,13 +281,7 @@ def codex_rust_crate(
maybe_deps += [name]
sanitized_binaries = []
cargo_env = {}
for binary, main in binaries.items():
#binary = binary.replace("-", "_")
sanitized_binaries.append(binary)
cargo_env["CARGO_BIN_EXE_" + binary] = "$(rlocationpath :%s)" % binary
rust_binary(
name = binary,
crate_name = binary.replace("-", "_"),
@@ -288,11 +293,6 @@ def codex_rust_crate(
visibility = ["//visibility:public"],
)
for binary_label in extra_binaries:
sanitized_binaries.append(binary_label)
binary = Label(binary_label).name
cargo_env["CARGO_BIN_EXE_" + binary] = "$(rlocationpath %s)" % binary_label
integration_test_kwargs = {}
if integration_test_args:
integration_test_kwargs["args"] = integration_test_args

View File

@@ -32,19 +32,21 @@ setup_remote_env() {
return 1
fi
if ! command -v cargo >/dev/null 2>&1; then
echo "cargo is required to build codex-exec-server" >&2
return 1
fi
if [[ "${CODEX_TEST_REMOTE_ENV_SKIP_EXEC_SERVER_BUILD:-0}" != "1" ]]; then
if ! command -v cargo >/dev/null 2>&1; then
echo "cargo is required to build codex-exec-server" >&2
return 1
fi
(
cd "${REPO_ROOT}/codex-rs"
cargo build -p codex-exec-server --bin codex-exec-server
)
(
cd "${REPO_ROOT}/codex-rs"
cargo build -p codex-exec-server --bin codex-exec-server
)
if [[ ! -f "${codex_exec_server_binary_path}" ]]; then
echo "codex-exec-server binary not found at ${codex_exec_server_binary_path}" >&2
return 1
if [[ ! -f "${codex_exec_server_binary_path}" ]]; then
echo "codex-exec-server binary not found at ${codex_exec_server_binary_path}" >&2
return 1
fi
fi
docker rm -f "${container_name}" >/dev/null 2>&1 || true