mirror of
https://github.com/openai/codex.git
synced 2026-10-24 18:18:41 +00:00
feat: build codex-responses-api-proxy for all platforms as part of the GitHub Release
This commit is contained in:
@@ -27,6 +27,34 @@
|
||||
"path": "codex.exe"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codex-responses-api-proxy": {
|
||||
"platforms": {
|
||||
"macos-aarch64": {
|
||||
"regex": "^codex-responses-api-proxy-aarch64-apple-darwin\\.zst$",
|
||||
"path": "codex-responses-api-proxy"
|
||||
},
|
||||
"macos-x86_64": {
|
||||
"regex": "^codex-responses-api-proxy-x86_64-apple-darwin\\.zst$",
|
||||
"path": "codex-responses-api-proxy"
|
||||
},
|
||||
"linux-x86_64": {
|
||||
"regex": "^codex-responses-api-proxy-x86_64-unknown-linux-musl\\.zst$",
|
||||
"path": "codex-responses-api-proxy"
|
||||
},
|
||||
"linux-aarch64": {
|
||||
"regex": "^codex-responses-api-proxy-aarch64-unknown-linux-musl\\.zst$",
|
||||
"path": "codex-responses-api-proxy"
|
||||
},
|
||||
"windows-x86_64": {
|
||||
"regex": "^codex-responses-api-proxy-x86_64-pc-windows-msvc\\.exe\\.zst$",
|
||||
"path": "codex-responses-api-proxy.exe"
|
||||
},
|
||||
"windows-aarch64": {
|
||||
"regex": "^codex-responses-api-proxy-aarch64-pc-windows-msvc\\.exe\\.zst$",
|
||||
"path": "codex-responses-api-proxy.exe"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ jobs:
|
||||
sudo apt install -y musl-tools pkg-config
|
||||
|
||||
- name: Cargo build
|
||||
run: cargo build --target ${{ matrix.target }} --release --bin codex
|
||||
run: cargo build --target ${{ matrix.target }} --release --bin codex --bin codex-responses-api-proxy
|
||||
|
||||
- name: Stage artifacts
|
||||
shell: bash
|
||||
@@ -107,8 +107,10 @@ jobs:
|
||||
|
||||
if [[ "${{ matrix.runner }}" == windows* ]]; then
|
||||
cp target/${{ matrix.target }}/release/codex.exe "$dest/codex-${{ matrix.target }}.exe"
|
||||
cp target/${{ matrix.target }}/release/codex-responses-api-proxy.exe "$dest/codex-responses-api-proxy-${{ matrix.target }}.exe"
|
||||
else
|
||||
cp target/${{ matrix.target }}/release/codex "$dest/codex-${{ matrix.target }}"
|
||||
cp target/${{ matrix.target }}/release/codex-responses-api-proxy "$dest/codex-responses-api-proxy-${{ matrix.target }}"
|
||||
fi
|
||||
|
||||
- if: ${{ matrix.runner == 'windows-11-arm' }}
|
||||
|
||||
@@ -158,11 +158,8 @@ def stage_sources(staging_dir: Path, version: str) -> None:
|
||||
out.write("\n")
|
||||
|
||||
|
||||
def install_native_binaries(staging_dir: Path, workflow_url: str | None) -> None:
|
||||
cmd = ["./scripts/install_native_deps.py"]
|
||||
if workflow_url:
|
||||
cmd.extend(["--workflow-url", workflow_url])
|
||||
cmd.append(str(staging_dir))
|
||||
def install_native_binaries(staging_dir: Path, workflow_url: str) -> None:
|
||||
cmd = ["./scripts/install_native_deps.py", "--workflow-url", workflow_url, str(staging_dir)]
|
||||
subprocess.check_call(cmd, cwd=CODEX_CLI_ROOT)
|
||||
|
||||
|
||||
|
||||
@@ -145,7 +145,35 @@ def fetch_rg(
|
||||
|
||||
|
||||
def _download_artifacts(workflow_id: str, dest_dir: Path) -> None:
|
||||
cmd = [
|
||||
"""
|
||||
Find all the .zst variants of the Codex CLI artifacts in the given workflow
|
||||
run and download them into the given directory.
|
||||
"""
|
||||
view_cmd = [
|
||||
"gh",
|
||||
"run",
|
||||
"view",
|
||||
workflow_id,
|
||||
"--repo",
|
||||
"openai/codex",
|
||||
"--json",
|
||||
"artifacts",
|
||||
]
|
||||
data = json.loads(subprocess.check_output(view_cmd, text=True))
|
||||
all_artifact_names = [
|
||||
artifact["name"]
|
||||
for artifact in data.get("artifacts", [])
|
||||
if not artifact["name"].startswith("codex-responses-api-proxy")
|
||||
]
|
||||
artifact_names = [
|
||||
name
|
||||
for name in all_artifact_names
|
||||
if not name.startswith("codex-responses-api-proxy") and name.endswith(".zst")
|
||||
]
|
||||
|
||||
if not artifact_names:
|
||||
raise RuntimeError("No codex artifacts found in workflow run.")
|
||||
download_cmd = [
|
||||
"gh",
|
||||
"run",
|
||||
"download",
|
||||
@@ -155,7 +183,9 @@ def _download_artifacts(workflow_id: str, dest_dir: Path) -> None:
|
||||
"openai/codex",
|
||||
workflow_id,
|
||||
]
|
||||
subprocess.check_call(cmd)
|
||||
for name in artifact_names:
|
||||
download_cmd.extend(["--name", name])
|
||||
subprocess.check_call(download_cmd)
|
||||
|
||||
|
||||
def install_codex_binaries(
|
||||
@@ -259,9 +289,7 @@ def extract_archive(
|
||||
|
||||
if archive_format == "zst":
|
||||
output_path = archive_path.parent / dest.name
|
||||
subprocess.check_call(
|
||||
["zstd", "-f", "-d", str(archive_path), "-o", str(output_path)]
|
||||
)
|
||||
subprocess.check_call(["zstd", "-f", "-d", str(archive_path), "-o", str(output_path)])
|
||||
shutil.move(str(output_path), dest)
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user