mirror of
https://github.com/openai/codex.git
synced 2026-11-17 22:10:37 +00:00
220 lines
9.4 KiB
YAML
220 lines
9.4 KiB
YAML
name: Bazel
|
|
|
|
# Note this workflow was originally derived from:
|
|
# https://github.com/cerisier/toolchains_llvm_bootstrapped/blob/main/.github/workflows/ci.yaml
|
|
|
|
on:
|
|
pull_request: {}
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
# Cancel previous actions from the same PR or branch except 'main' branch.
|
|
# See https://docs.github.com/en/actions/using-jobs/using-concurrency and https://docs.github.com/en/actions/learn-github-actions/contexts for more info.
|
|
group: concurrency-group::${{ github.workflow }}::${{ github.event.pull_request.number > 0 && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}${{ github.ref_name == 'main' && format('::{0}', github.run_id) || ''}}
|
|
cancel-in-progress: ${{ github.ref_name != 'main' }}
|
|
jobs:
|
|
test:
|
|
timeout-minutes: 120
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
# macOS
|
|
- os: macos-15-xlarge
|
|
target: aarch64-apple-darwin
|
|
- os: macos-15-xlarge
|
|
target: x86_64-apple-darwin
|
|
|
|
# Linux
|
|
- os: ubuntu-24.04
|
|
target: x86_64-unknown-linux-gnu
|
|
- os: ubuntu-24.04
|
|
target: x86_64-unknown-linux-musl
|
|
# 2026-02-27 Bazel tests have been flaky on arm in CI.
|
|
# Disable until we can investigate and stabilize them.
|
|
# - os: ubuntu-24.04-arm
|
|
# target: aarch64-unknown-linux-musl
|
|
# - os: ubuntu-24.04-arm
|
|
# target: aarch64-unknown-linux-gnu
|
|
|
|
# Windows
|
|
- os: windows-latest
|
|
target: x86_64-pc-windows-gnullvm
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
# Configure a human readable name for each job
|
|
name: Local Bazel build on ${{ matrix.os }} for ${{ matrix.target }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Set up Bazel CI
|
|
id: setup_bazel
|
|
uses: ./.github/actions/setup-bazel-ci
|
|
with:
|
|
target: ${{ matrix.target }}
|
|
install-test-prereqs: "true"
|
|
|
|
- name: Check MODULE.bazel.lock is up to date
|
|
if: matrix.os == 'ubuntu-24.04' && matrix.target == 'x86_64-unknown-linux-gnu'
|
|
shell: bash
|
|
run: ./scripts/check-module-bazel-lock.sh
|
|
|
|
- name: bazel test //...
|
|
env:
|
|
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
|
|
shell: bash
|
|
run: |
|
|
bazel_targets=(
|
|
//...
|
|
# Keep V8 out of the ordinary Bazel CI path. Only the dedicated
|
|
# canary and release workflows should build `third_party/v8`.
|
|
-//third_party/v8:all
|
|
)
|
|
if [[ "${RUNNER_OS:-}" == "Windows" ]]; then
|
|
# This is intentionally a foothold rather than the final Windows
|
|
# Bazel suite. Keep a stable set of targets that are known not to
|
|
# pull in the unresolved V8 dependency so we can land meaningful CI
|
|
# coverage now and expand it once the V8 situation is understood.
|
|
bazel_targets=(
|
|
//codex-rs/analytics:analytics-unit-tests
|
|
//codex-rs/ansi-escape:ansi-escape-unit-tests
|
|
//codex-rs/app-server-protocol:app-server-protocol-schema_fixtures-test
|
|
//codex-rs/app-server-protocol:app-server-protocol-unit-tests
|
|
//codex-rs/apply-patch:apply-patch-all-test
|
|
//codex-rs/apply-patch:apply-patch-unit-tests
|
|
//codex-rs/async-utils:async-utils-unit-tests
|
|
//codex-rs/codex-api:codex-api-unit-tests
|
|
//codex-rs/codex-backend-openapi-models:codex-backend-openapi-models-unit-tests
|
|
//codex-rs/codex-client:codex-client-unit-tests
|
|
//codex-rs/codex-experimental-api-macros:codex-experimental-api-macros-unit-tests
|
|
//codex-rs/config:config-unit-tests
|
|
//codex-rs/connectors:connectors-unit-tests
|
|
//codex-rs/core-skills:core-skills-unit-tests
|
|
//codex-rs/exec-server:exec-server-unit-tests
|
|
//codex-rs/execpolicy-legacy:execpolicy-legacy-all-test
|
|
//codex-rs/execpolicy-legacy:execpolicy-legacy-unit-tests
|
|
//codex-rs/execpolicy:execpolicy-unit-tests
|
|
//codex-rs/features:features-unit-tests
|
|
//codex-rs/feedback:feedback-unit-tests
|
|
//codex-rs/file-search:file-search-unit-tests
|
|
//codex-rs/git-utils:git-utils-unit-tests
|
|
//codex-rs/hooks:hooks-unit-tests
|
|
//codex-rs/instructions:instructions-unit-tests
|
|
//codex-rs/keyring-store:keyring-store-unit-tests
|
|
//codex-rs/network-proxy:network-proxy-unit-tests
|
|
//codex-rs/otel:otel-unit-tests
|
|
//codex-rs/plugin:plugin-unit-tests
|
|
//codex-rs/process-hardening:process-hardening-unit-tests
|
|
//codex-rs/protocol:protocol-unit-tests
|
|
//codex-rs/responses-api-proxy:responses-api-proxy-unit-tests
|
|
//codex-rs/rmcp-client:rmcp-client-unit-tests
|
|
//codex-rs/rollout:rollout-unit-tests
|
|
//codex-rs/sandboxing:sandboxing-unit-tests
|
|
//codex-rs/secrets:secrets-unit-tests
|
|
//codex-rs/shell-escalation:shell-escalation-unit-tests
|
|
//codex-rs/skills:skills-unit-tests
|
|
//codex-rs/state:state-unit-tests
|
|
//codex-rs/stdio-to-uds:stdio-to-uds-unit-tests
|
|
//codex-rs/terminal-detection:terminal-detection-unit-tests
|
|
//codex-rs/tools:tools-unit-tests
|
|
//codex-rs/utils/absolute-path:absolute-path-unit-tests
|
|
//codex-rs/utils/approval-presets:approval-presets-unit-tests
|
|
//codex-rs/utils/cache:cache-unit-tests
|
|
//codex-rs/utils/cargo-bin:cargo-bin-unit-tests
|
|
//codex-rs/utils/cli:cli-unit-tests
|
|
//codex-rs/utils/elapsed:elapsed-unit-tests
|
|
//codex-rs/utils/fuzzy-match:fuzzy-match-unit-tests
|
|
//codex-rs/utils/home-dir:home-dir-unit-tests
|
|
//codex-rs/utils/image:image-unit-tests
|
|
//codex-rs/utils/json-to-toml:json-to-toml-unit-tests
|
|
//codex-rs/utils/output-truncation:output-truncation-unit-tests
|
|
//codex-rs/utils/path-utils:path-utils-unit-tests
|
|
//codex-rs/utils/plugins:plugins-unit-tests
|
|
//codex-rs/utils/pty:pty-unit-tests
|
|
//codex-rs/utils/readiness:readiness-unit-tests
|
|
//codex-rs/utils/rustls-provider:rustls-provider-unit-tests
|
|
//codex-rs/utils/sleep-inhibitor:sleep-inhibitor-unit-tests
|
|
//codex-rs/utils/stream-parser:stream-parser-unit-tests
|
|
//codex-rs/utils/string:string-unit-tests
|
|
//codex-rs/utils/template:template-unit-tests
|
|
//codex-rs/windows-sandbox-rs:windows-sandbox-rs-unit-tests
|
|
)
|
|
echo "Windows smoke target count: ${#bazel_targets[@]}"
|
|
fi
|
|
|
|
./.github/scripts/run-bazel-ci.sh \
|
|
--print-failed-test-logs \
|
|
--use-node-test-env \
|
|
-- \
|
|
test \
|
|
--test_verbose_timeout_warnings \
|
|
--build_metadata=COMMIT_SHA=${GITHUB_SHA} \
|
|
-- \
|
|
"${bazel_targets[@]}"
|
|
|
|
# Save bazel repository cache explicitly; make non-fatal so cache uploading
|
|
# never fails the overall job. Only save when key wasn't hit.
|
|
- name: Save bazel repository cache
|
|
if: always() && !cancelled() && steps.setup_bazel.outputs.cache-hit != 'true'
|
|
continue-on-error: true
|
|
uses: actions/cache/save@v5
|
|
with:
|
|
path: |
|
|
~/.cache/bazel-repo-cache
|
|
key: bazel-cache-${{ matrix.target }}-${{ hashFiles('MODULE.bazel', 'codex-rs/Cargo.lock', 'codex-rs/Cargo.toml') }}
|
|
|
|
clippy:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
# Keep Linux lint coverage on x64 and add the arm64 macOS path that
|
|
# the Bazel test job already exercises.
|
|
- os: ubuntu-24.04
|
|
target: x86_64-unknown-linux-gnu
|
|
- os: macos-15-xlarge
|
|
target: aarch64-apple-darwin
|
|
runs-on: ${{ matrix.os }}
|
|
name: Bazel clippy on ${{ matrix.os }} for ${{ matrix.target }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Set up Bazel CI
|
|
id: setup_bazel
|
|
uses: ./.github/actions/setup-bazel-ci
|
|
with:
|
|
target: ${{ matrix.target }}
|
|
|
|
- name: bazel build --config=clippy //codex-rs/...
|
|
env:
|
|
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
|
|
shell: bash
|
|
run: |
|
|
# Keep the initial Bazel clippy scope on codex-rs and out of the
|
|
# V8 proof-of-concept target for now.
|
|
./.github/scripts/run-bazel-ci.sh \
|
|
-- \
|
|
build \
|
|
--config=clippy \
|
|
--build_metadata=COMMIT_SHA=${GITHUB_SHA} \
|
|
--build_metadata=TAG_job=clippy \
|
|
-- \
|
|
//codex-rs/... \
|
|
-//codex-rs/v8-poc:all
|
|
|
|
# Save bazel repository cache explicitly; make non-fatal so cache uploading
|
|
# never fails the overall job. Only save when key wasn't hit.
|
|
- name: Save bazel repository cache
|
|
if: always() && !cancelled() && steps.setup_bazel.outputs.cache-hit != 'true'
|
|
continue-on-error: true
|
|
uses: actions/cache/save@v5
|
|
with:
|
|
path: |
|
|
~/.cache/bazel-repo-cache
|
|
key: bazel-cache-${{ matrix.target }}-${{ hashFiles('MODULE.bazel', 'codex-rs/Cargo.lock', 'codex-rs/Cargo.toml') }}
|