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@v6 - name: Setup pnpm uses: pnpm/action-setup@v4 with: run_install: false - name: Setup Node.js uses: actions/setup-node@v6 with: node-version: 22 - name: Install dependencies run: pnpm install --frozen-lockfile # stage_npm_packages.py requires DotSlash when staging releases. - uses: facebook/install-dotslash@v2 - name: Stage npm package id: stage_npm_package env: GH_TOKEN: ${{ github.token }} run: | set -euo pipefail # Use the newest successful rust-release workflow that still has native artifacts. OUTPUT_DIR="${RUNNER_TEMP}" set +e WORKFLOW_URLS=$(gh run list \ --workflow .github/workflows/rust-release.yml \ --json status,conclusion,headBranch,url \ --jq 'map(select(.status=="completed" and .conclusion=="success" and (.headBranch | startswith("rust-v")) and (.url | contains("/actions/runs/")) ) | .[].url') set -e if [ -z "$WORKFLOW_URLS" ]; then echo "Unable to resolve a completed successful rust-release workflow." exit 1 fi for WORKFLOW_URL in $WORKFLOW_URLS; do CODEX_VERSION="$(gh run view "$WORKFLOW_URL" --json headBranch -q '.headBranch | sub("^rust-v"; "")')" echo "Attempting npm staging from ${WORKFLOW_URL} (version ${CODEX_VERSION})." if python3 ./scripts/stage_npm_packages.py \ --release-version "$CODEX_VERSION" \ --workflow-url "$WORKFLOW_URL" \ --package codex \ --output-dir "$OUTPUT_DIR"; then PACK_OUTPUT="${OUTPUT_DIR}/codex-npm-${CODEX_VERSION}.tgz" break fi echo "Npm staging failed for ${WORKFLOW_URL}; trying next rust-release run." done if [ -z "${PACK_OUTPUT:-}" ]; then echo "::error::No eligible rust-release run could produce a stageable npm package." exit 1 fi echo "Staged package at ${PACK_OUTPUT}" echo "pack_output=$PACK_OUTPUT" >> "$GITHUB_OUTPUT" - name: Upload staged npm package artifact uses: actions/upload-artifact@v7 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 - name: Ensure codex-cli/README.md contains only ASCII and certain Unicode code points run: ./scripts/asciicheck.py codex-cli/README.md - name: Check codex-cli/README ToC run: python3 scripts/readme_toc.py codex-cli/README.md - name: Prettier (run `pnpm run format:fix` to fix) run: pnpm run format