mirror of
https://github.com/openai/codex.git
synced 2026-05-16 09:12:54 +00:00
ci: merge Unix runtime libs into rusty_v8 sandbox artifacts
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
18
.github/scripts/rusty_v8_bazel.py
vendored
18
.github/scripts/rusty_v8_bazel.py
vendored
@@ -23,7 +23,7 @@ from rusty_v8_module_bazel import (
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
MODULE_BAZEL = ROOT / "MODULE.bazel"
|
||||
RUSTY_V8_CHECKSUMS_DIR = ROOT / "third_party" / "v8"
|
||||
MUSL_RUNTIME_ARCHIVE_LABELS = [
|
||||
STATIC_RUNTIME_ARCHIVE_LABELS = [
|
||||
"@llvm//runtimes/libcxx:libcxx.static",
|
||||
"@llvm//runtimes/libcxx:libcxxabi.static",
|
||||
]
|
||||
@@ -197,8 +197,10 @@ def staged_checksums_name(target: str, artifact_profile: str) -> str:
|
||||
return f"rusty_v8_{artifact_profile}_{target}.sha256"
|
||||
|
||||
|
||||
def is_musl_archive_target(target: str, source_path: Path) -> bool:
|
||||
return target.endswith("-unknown-linux-musl") and source_path.suffix == ".a"
|
||||
def needs_merged_runtime_archive(target: str, source_path: Path) -> bool:
|
||||
return source_path.suffix == ".a" and target.endswith(
|
||||
("-apple-darwin", "-unknown-linux-gnu", "-unknown-linux-musl")
|
||||
)
|
||||
|
||||
|
||||
def single_bazel_output_file(
|
||||
@@ -245,7 +247,7 @@ def host_runnable_bazel_output_file(
|
||||
return runnable_outputs[0]
|
||||
|
||||
|
||||
def merged_musl_archive(
|
||||
def merged_runtime_archive(
|
||||
platform: str,
|
||||
lib_path: Path,
|
||||
compilation_mode: str = "fastbuild",
|
||||
@@ -265,10 +267,10 @@ def merged_musl_archive(
|
||||
)
|
||||
runtime_archives = [
|
||||
single_bazel_output_file(platform, label, compilation_mode, bazel_configs)
|
||||
for label in MUSL_RUNTIME_ARCHIVE_LABELS
|
||||
for label in STATIC_RUNTIME_ARCHIVE_LABELS
|
||||
]
|
||||
|
||||
temp_dir = Path(tempfile.mkdtemp(prefix="rusty-v8-musl-stage-"))
|
||||
temp_dir = Path(tempfile.mkdtemp(prefix="rusty-v8-runtime-stage-"))
|
||||
merged_archive = temp_dir / lib_path.name
|
||||
merge_commands = "\n".join(
|
||||
[
|
||||
@@ -320,8 +322,8 @@ def stage_release_pair(
|
||||
staged_library = output_dir / staged_archive_name(target, lib_path, artifact_profile)
|
||||
staged_binding = output_dir / staged_binding_name(target, artifact_profile)
|
||||
source_archive = (
|
||||
merged_musl_archive(platform, lib_path, compilation_mode, bazel_configs)
|
||||
if is_musl_archive_target(target, lib_path)
|
||||
merged_runtime_archive(platform, lib_path, compilation_mode, bazel_configs)
|
||||
if needs_merged_runtime_archive(target, lib_path)
|
||||
else lib_path
|
||||
)
|
||||
|
||||
|
||||
19
.github/scripts/test_rusty_v8_bazel.py
vendored
19
.github/scripts/test_rusty_v8_bazel.py
vendored
@@ -35,10 +35,10 @@ class RustyV8BazelTest(unittest.TestCase):
|
||||
),
|
||||
)
|
||||
self.assertEqual(
|
||||
"rusty_v8_ptrcomp_sandbox_release_x86_64-pc-windows-msvc.lib.gz",
|
||||
"librusty_v8_ptrcomp_sandbox_release_x86_64-pc-windows-msvc.a.gz",
|
||||
rusty_v8_bazel.staged_archive_name(
|
||||
"x86_64-pc-windows-msvc",
|
||||
Path("v8.lib"),
|
||||
Path("v8.a"),
|
||||
rusty_v8_bazel.SANDBOX_ARTIFACT_PROFILE,
|
||||
),
|
||||
)
|
||||
@@ -57,6 +57,21 @@ class RustyV8BazelTest(unittest.TestCase):
|
||||
),
|
||||
)
|
||||
|
||||
def test_needs_merged_runtime_archive(self) -> None:
|
||||
for target in [
|
||||
"x86_64-apple-darwin",
|
||||
"x86_64-unknown-linux-gnu",
|
||||
"x86_64-unknown-linux-musl",
|
||||
]:
|
||||
self.assertTrue(rusty_v8_bazel.needs_merged_runtime_archive(target, Path("v8.a")))
|
||||
|
||||
self.assertFalse(
|
||||
rusty_v8_bazel.needs_merged_runtime_archive(
|
||||
"x86_64-pc-windows-msvc",
|
||||
Path("v8.a"),
|
||||
)
|
||||
)
|
||||
|
||||
@patch("rusty_v8_bazel.ensure_bazel_output_files")
|
||||
@patch("rusty_v8_bazel.subprocess.run")
|
||||
def test_host_runnable_bazel_output_file_selects_runnable_candidate(
|
||||
|
||||
3
.github/workflows/rusty-v8-release.yml
vendored
3
.github/workflows/rusty-v8-release.yml
vendored
@@ -164,7 +164,7 @@ jobs:
|
||||
"${pair_target}"
|
||||
--build_metadata=COMMIT_SHA=$(git rev-parse HEAD)
|
||||
)
|
||||
if [[ "${TARGET}" == *-unknown-linux-musl ]]; then
|
||||
if [[ "${TARGET}" != *-pc-windows-msvc ]]; then
|
||||
bazel_args+=(
|
||||
"@llvm//runtimes/libcxx:libcxx.static"
|
||||
"@llvm//runtimes/libcxx:libcxxabi.static"
|
||||
@@ -256,7 +256,6 @@ jobs:
|
||||
name: ${{ needs.metadata.outputs.release_tag }}
|
||||
files: |
|
||||
dist/**/librusty_v8_ptrcomp_sandbox_release_*.a.gz
|
||||
dist/**/rusty_v8_ptrcomp_sandbox_release_*.lib.gz
|
||||
dist/**/src_binding_ptrcomp_sandbox_release_*.rs
|
||||
dist/**/rusty_v8_ptrcomp_sandbox_release_*.sha256
|
||||
overwrite_files: true
|
||||
|
||||
2
.github/workflows/v8-canary.yml
vendored
2
.github/workflows/v8-canary.yml
vendored
@@ -157,7 +157,7 @@ jobs:
|
||||
"${pair_target}"
|
||||
--build_metadata=COMMIT_SHA=$(git rev-parse HEAD)
|
||||
)
|
||||
if [[ "${TARGET}" == *-unknown-linux-musl ]]; then
|
||||
if [[ "${TARGET}" != *-pc-windows-msvc ]]; then
|
||||
bazel_args+=(
|
||||
"@llvm//runtimes/libcxx:libcxx.static"
|
||||
"@llvm//runtimes/libcxx:libcxxabi.static"
|
||||
|
||||
4
third_party/v8/README.md
vendored
4
third_party/v8/README.md
vendored
@@ -54,7 +54,6 @@ current assets on the same tag, with the Rust crate's sandbox feature suffix in
|
||||
their raw names:
|
||||
|
||||
- `librusty_v8_ptrcomp_sandbox_release_<target>.a.gz`
|
||||
- `rusty_v8_ptrcomp_sandbox_release_<target>.lib.gz`
|
||||
- `src_binding_ptrcomp_sandbox_release_<target>.rs`
|
||||
|
||||
The dedicated publishing workflow is `.github/workflows/rusty-v8-release.yml`.
|
||||
@@ -77,6 +76,9 @@ The same run also builds the matching sandbox pair targets:
|
||||
|
||||
If a tagged run targets an existing GitHub release, publication amends only the
|
||||
sandbox-profile files and leaves the current release-profile assets unchanged.
|
||||
Unix sandbox archives are staged with the matching static libc++ and libc++abi
|
||||
runtime libraries merged in so Cargo consumers can link them with the `v8`
|
||||
crate's default `use_custom_libcxx` feature.
|
||||
|
||||
Cargo musl builds use `RUSTY_V8_ARCHIVE` plus a downloaded
|
||||
`RUSTY_V8_SRC_BINDING_PATH` to point at those `openai/codex` release assets
|
||||
|
||||
Reference in New Issue
Block a user