mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
747f1003dd
## Why The root formatting entrypoints could drift: `just fmt` did not format the Justfile itself, and the CI-facing check recipe only checked Python scripts instead of matching everything formatted by `just fmt`. ## What changed - Add a shared cross-platform Python formatter driver used by both `just fmt` and `just fmt-check`. - Run Justfile, Rust, Python SDK, and internal-script formatter groups concurrently while buffering each formatter group's output until it finishes. - Log formatter starts immediately, then print each formatter group's labeled output when it completes. - Keep the SDK lint-fix and Ruff formatting passes ordered, with source comments explaining their distinct roles and the check-mode equivalents. - Run Ruff through shared `uv run --no-sync --with ruff` overlays so formatting works on clean glibc Linux checkouts without installing the platform-specific SDK runtime wheel. - Show `fmt-check` help text in `just -l` and simplify CI to call the shared driver through `just fmt-check`. - Pin the general CI workflow to `just@1.51.0` so its formatter agrees with the checked-in Justfile. - Add regression coverage for the thin Just recipes and the driver's formatter graph. ## Validation - `just fmt` - `just fmt-check` - `python3 -m pytest sdk/python/tests/test_artifact_workflow_and_binaries.py -k 'root_fmt or root_format' -q` - `pnpm run format` - `git diff --check` - `just -l | rg -n '^ fmt|fmt-check'` - `uvx --from uv==0.7.22 uv run --frozen --project sdk/python --no-sync --with ruff ruff check --diff sdk/python`
89 lines
3.2 KiB
YAML
89 lines
3.2 KiB
YAML
name: ci
|
|
|
|
on:
|
|
pull_request: {}
|
|
push: { branches: [main] }
|
|
|
|
jobs:
|
|
build-test:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
env:
|
|
NODE_OPTIONS: --max-old-space-size=4096
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
|
persist-credentials: false
|
|
|
|
- name: Verify codex-rs Cargo manifests inherit workspace settings
|
|
run: python3 .github/scripts/verify_cargo_workspace_manifests.py
|
|
|
|
- name: Verify codex-tui does not import codex-core directly
|
|
run: python3 .github/scripts/verify_tui_core_boundary.py
|
|
|
|
- name: Verify Bazel clippy flags match Cargo workspace lints
|
|
run: python3 .github/scripts/verify_bazel_clippy_lints.py
|
|
|
|
- name: Test Codex package builder
|
|
run: python3 -m unittest discover -s scripts/codex_package -p 'test_*.py'
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@a8198c4bff370c8506180b035930dea56dbd5288 # v5
|
|
with:
|
|
run_install: false
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
|
with:
|
|
node-version: 22
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Stage npm package
|
|
id: stage_npm_package
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
set -euo pipefail
|
|
# Use a recent successful rust-release run that published the full
|
|
# cross-platform native payload required by the npm package layout.
|
|
# Passing the workflow URL directly avoids relying on old rust-v*
|
|
# branches remaining discoverable via `gh run list --branch ...`.
|
|
CODEX_VERSION=0.133.0-alpha.4
|
|
WORKFLOW_URL="https://github.com/openai/codex/actions/runs/26201494185"
|
|
OUTPUT_DIR="${RUNNER_TEMP}"
|
|
python3 ./scripts/stage_npm_packages.py \
|
|
--release-version "$CODEX_VERSION" \
|
|
--workflow-url "$WORKFLOW_URL" \
|
|
--package codex \
|
|
--output-dir "$OUTPUT_DIR"
|
|
PACK_OUTPUT="${OUTPUT_DIR}/codex-npm-${CODEX_VERSION}.tgz"
|
|
echo "pack_output=$PACK_OUTPUT" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Upload staged npm package artifact
|
|
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
|
with:
|
|
name: codex-npm-staging
|
|
path: ${{ steps.stage_npm_package.outputs.pack_output }}
|
|
|
|
- name: Ensure root README.md contains only ASCII and certain Unicode code points
|
|
run: ./scripts/asciicheck.py README.md
|
|
- name: Check root README ToC
|
|
run: python3 scripts/readme_toc.py README.md
|
|
|
|
- uses: taiki-e/install-action@44c6d64aa62cd779e873306675c7a58e86d6d532 # v2.62.49
|
|
with:
|
|
tool: just@1.51.0
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
|
with:
|
|
version: "0.11.3"
|
|
- name: Check formatting (run `just fmt` to fix)
|
|
run: just fmt-check
|
|
|
|
- name: Prettier (run `pnpm run format:fix` to fix)
|
|
run: pnpm run format
|