mirror of
https://github.com/openai/codex.git
synced 2026-04-28 10:21:06 +03:00
2.7 KiB
2.7 KiB
DOs
- Build at least one release per OS: add one macOS and one Linux release job to catch conditional code (e.g., Landlock) and document why they exist.
# One macOS release to mirror dev behavior
- runner: macos-14
target: aarch64-apple-darwin # Fastest macOS runner; keeps CI quick
profile: release
# One Linux release to catch Landlock/target-specific code
- runner: ubuntu-24.04
target: x86_64-unknown-linux-musl
profile: release
- Make release jobs obvious: reflect
profilein the job name so release builds are easy to spot in CI.
name: ${{ matrix.runner }} - ${{ matrix.target }}${{ matrix.profile == 'release' && ' (release)' || '' }}
- Pass
--profileeverywhere: ensure build and test steps respect the matrix profile.
- run: find . -name Cargo.toml -mindepth 2 -maxdepth 2 -print0 \
| xargs -0 -n1 -I{} bash -c 'cd "$(dirname "{}")" && cargo build --profile ${{ matrix.profile }}'
- run: cargo test --all-features --target ${{ matrix.target }} --profile ${{ matrix.profile }}
- Align cache keys across workflows: include
profilein CI and match it in release to maximize cache hits.
# rust-ci.yml
with:
key: cargo-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('**/Cargo.lock') }}
# rust-release.yml
with:
key: cargo-release-${{ matrix.runner }}-${{ matrix.target }}-release-${{ hashFiles('**/Cargo.lock') }}
- Rebase after upstream merges: drop changes that already landed on
main(e.g., imports) to keep diffs clean and avoid build breaks.
git fetch origin main
git rebase origin/main
# Resolve conflicts, ensure it builds locally, then:
git push --force-with-lease
DON’Ts
- Don’t hide release coverage: avoid sneaking a single release job into the middle of the matrix without a comment explaining why it’s there.
# Bad: release entry with no context
- runner: macos-14
target: aarch64-apple-darwin
profile: release # ← unexplained
- Don’t mismatch cache keys: using different key formats between CI and release wastes caches.
# Bad: missing profile token → poor cache reuse
key: cargo-${{ matrix.runner }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
- Don’t rely only on dev builds: release-only or target-conditional code (e.g., Landlock on Linux) can break if not built in release.
# Bad: tests/builds always run in dev profile
- run: cargo test --all-features --target ${{ matrix.target }}
- Don’t keep stale changes post-merge: if
mainalready includes an import or refactor, remove it from your PR via rebase instead of re-adding it.
// Bad (duplicate after rebase): already in main
use codex_core::user_agent::get_codex_user_agent;