mirror of
https://github.com/openai/codex.git
synced 2026-08-23 13:09:46 +00:00
Add a just recipe for assembling Codex packages (#39584)
## What changed - Add `just assemble-codex-package` as the documented entry point for the package builder. - Export `CODEX_REPO_ROOT` from `just` and release CI, and require the package builder to use it for repository-relative inputs. - Resolve the ripgrep and zsh manifests relative to their Python modules. GitOrigin-RevId: 039d12107a49171f064b0119adc6b99cf97c6c1e
This commit is contained in:
committed by
copyberry
parent
3b45c29062
commit
8e2265196e
1
.github/actions/setup-ci/action.yml
vendored
1
.github/actions/setup-ci/action.yml
vendored
@@ -53,6 +53,7 @@ runs:
|
|||||||
echo "cargo-target-dir=$cargo_target_dir" >> "$GITHUB_OUTPUT"
|
echo "cargo-target-dir=$cargo_target_dir" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
{
|
{
|
||||||
|
echo "CODEX_REPO_ROOT=$GITHUB_WORKSPACE"
|
||||||
echo "BAZEL_OUTPUT_BASE=$bazel_output_base"
|
echo "BAZEL_OUTPUT_BASE=$bazel_output_base"
|
||||||
echo "BAZEL_OUTPUT_USER_ROOT=$bazel_output_user_root"
|
echo "BAZEL_OUTPUT_USER_ROOT=$bazel_output_user_root"
|
||||||
echo "BAZEL_REPOSITORY_CACHE=$bazel_repository_cache"
|
echo "BAZEL_REPOSITORY_CACHE=$bazel_repository_cache"
|
||||||
|
|||||||
1
.github/workflows/rust-release.yml
vendored
1
.github/workflows/rust-release.yml
vendored
@@ -15,6 +15,7 @@ on:
|
|||||||
- "rust-v*.*.*"
|
- "rust-v*.*.*"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
CODEX_REPO_ROOT: ${{ github.workspace }}
|
||||||
CODEX_ZSH_RELEASE_TAG: codex-zsh-v0.1.0
|
CODEX_ZSH_RELEASE_TAG: codex-zsh-v0.1.0
|
||||||
CODEX_ZSH_MANIFEST_SHA256: c534eab89dcea7e3d8a5e5b3f49c025c7c64cd4e4d9814ee24871de58a9359a1
|
CODEX_ZSH_MANIFEST_SHA256: c534eab89dcea7e3d8a5e5b3f49c025c7c64cd4e4d9814ee24871de58a9359a1
|
||||||
|
|
||||||
|
|||||||
6
justfile
6
justfile
@@ -1,5 +1,6 @@
|
|||||||
set working-directory := "codex-rs"
|
set working-directory := "codex-rs"
|
||||||
set positional-arguments
|
set positional-arguments
|
||||||
|
export CODEX_REPO_ROOT := justfile_directory()
|
||||||
export JUST_SHELL := justfile_directory() / "scripts/just-shell.py"
|
export JUST_SHELL := justfile_directory() / "scripts/just-shell.py"
|
||||||
set shell := ["python3", "-c", 'import os, runpy; runpy.run_path(os.environ["JUST_SHELL"], run_name="__main__")']
|
set shell := ["python3", "-c", 'import os, runpy; runpy.run_path(os.environ["JUST_SHELL"], run_name="__main__")']
|
||||||
set windows-shell := ["python", "-c", 'import os, runpy; runpy.run_path(os.environ["JUST_SHELL"], run_name="__main__")']
|
set windows-shell := ["python", "-c", 'import os, runpy; runpy.run_path(os.environ["JUST_SHELL"], run_name="__main__")']
|
||||||
@@ -35,6 +36,11 @@ file-search *args:
|
|||||||
code-mode-host *args:
|
code-mode-host *args:
|
||||||
cargo run --bin codex-code-mode-host -- {args}
|
cargo run --bin codex-code-mode-host -- {args}
|
||||||
|
|
||||||
|
# Assemble a local Codex package.
|
||||||
|
[no-cd]
|
||||||
|
assemble-codex-package *args:
|
||||||
|
{{ python }} {{ justfile_directory() }}/scripts/build_codex_package.py {args}
|
||||||
|
|
||||||
# Build the CLI and run the app-server test client
|
# Build the CLI and run the app-server test client
|
||||||
app-server-test-client *args:
|
app-server-test-client *args:
|
||||||
cargo build -p codex-cli
|
cargo build -p codex-cli
|
||||||
|
|||||||
@@ -4,6 +4,14 @@ This package contains the implementation behind `scripts/build_codex_package.py`
|
|||||||
The top-level script is the stable executable entry point; these modules keep the
|
The top-level script is the stable executable entry point; these modules keep the
|
||||||
package-building logic split by responsibility.
|
package-building logic split by responsibility.
|
||||||
|
|
||||||
|
Run the builder through `just`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
just assemble-codex-package --help
|
||||||
|
just assemble-codex-package --variant codex-app-server
|
||||||
|
just assemble-codex-package --target x86_64-unknown-linux-gnu
|
||||||
|
```
|
||||||
|
|
||||||
The builder creates a canonical Codex package directory:
|
The builder creates a canonical Codex package directory:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
|
|||||||
@@ -3,12 +3,9 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from .dotslash import fetch_dotslash_executable
|
from .dotslash import fetch_dotslash_executable
|
||||||
from .targets import REPO_ROOT
|
from .targets import TargetSpec, resolve_input_path
|
||||||
from .targets import TargetSpec
|
|
||||||
from .targets import resolve_input_path
|
|
||||||
|
|
||||||
|
RG_MANIFEST = Path(__file__).with_name("rg")
|
||||||
RG_MANIFEST = REPO_ROOT / "scripts" / "codex_package" / "rg"
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_rg_bin(spec: TargetSpec, rg_bin: Path | None) -> Path:
|
def resolve_rg_bin(spec: TargetSpec, rg_bin: Path | None) -> Path:
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
"""Supported package targets and default binary discovery."""
|
"""Supported package targets and default binary discovery."""
|
||||||
|
|
||||||
|
import os
|
||||||
import platform
|
import platform
|
||||||
import stat
|
import stat
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
_repo_root = os.environ.get("CODEX_REPO_ROOT")
|
||||||
SCRIPT_DIR = Path(__file__).resolve().parents[1]
|
if _repo_root is None:
|
||||||
REPO_ROOT = SCRIPT_DIR.parent
|
raise RuntimeError(
|
||||||
|
"CODEX_REPO_ROOT must point to the repository root; "
|
||||||
|
"run `just assemble-codex-package` to set it automatically"
|
||||||
|
)
|
||||||
|
REPO_ROOT = Path(_repo_root)
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
|
|||||||
@@ -3,12 +3,9 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from .dotslash import fetch_dotslash_executable
|
from .dotslash import fetch_dotslash_executable
|
||||||
from .targets import REPO_ROOT
|
from .targets import TargetSpec, resolve_input_path
|
||||||
from .targets import TargetSpec
|
|
||||||
from .targets import resolve_input_path
|
|
||||||
|
|
||||||
|
ZSH_MANIFEST = Path(__file__).with_name("codex-zsh")
|
||||||
ZSH_MANIFEST = REPO_ROOT / "scripts" / "codex_package" / "codex-zsh"
|
|
||||||
ZSH_RESOURCE_PATH = Path("zsh") / "bin" / "zsh"
|
ZSH_RESOURCE_PATH = Path("zsh") / "bin" / "zsh"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user