From 9f767cd3fb3aa416c05cb4422c6dff74176ceafa Mon Sep 17 00:00:00 2001 From: Channing Conger Date: Thu, 7 May 2026 01:02:08 +0000 Subject: [PATCH] ci: merge Unix runtime libs into rusty_v8 sandbox artifacts Co-authored-by: Codex --- .github/scripts/rusty_v8_bazel.py | 18 ++++++++++-------- .github/scripts/test_rusty_v8_bazel.py | 19 +++++++++++++++++-- .github/workflows/rusty-v8-release.yml | 3 +-- .github/workflows/v8-canary.yml | 2 +- third_party/v8/README.md | 4 +++- 5 files changed, 32 insertions(+), 14 deletions(-) diff --git a/.github/scripts/rusty_v8_bazel.py b/.github/scripts/rusty_v8_bazel.py index f2712d4a31..e7ab4ab7fc 100644 --- a/.github/scripts/rusty_v8_bazel.py +++ b/.github/scripts/rusty_v8_bazel.py @@ -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 ) diff --git a/.github/scripts/test_rusty_v8_bazel.py b/.github/scripts/test_rusty_v8_bazel.py index 8c9d821ada..5fa15fbde7 100644 --- a/.github/scripts/test_rusty_v8_bazel.py +++ b/.github/scripts/test_rusty_v8_bazel.py @@ -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( diff --git a/.github/workflows/rusty-v8-release.yml b/.github/workflows/rusty-v8-release.yml index 7036c87522..4b3858f107 100644 --- a/.github/workflows/rusty-v8-release.yml +++ b/.github/workflows/rusty-v8-release.yml @@ -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 diff --git a/.github/workflows/v8-canary.yml b/.github/workflows/v8-canary.yml index 7c6e01becb..c6cba8de1a 100644 --- a/.github/workflows/v8-canary.yml +++ b/.github/workflows/v8-canary.yml @@ -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" diff --git a/third_party/v8/README.md b/third_party/v8/README.md index b9f69aa945..461a6357bb 100644 --- a/third_party/v8/README.md +++ b/third_party/v8/README.md @@ -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_.a.gz` -- `rusty_v8_ptrcomp_sandbox_release_.lib.gz` - `src_binding_ptrcomp_sandbox_release_.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