Files
codex/prs/bolinfest/PR-2242.md
2025-09-02 15:17:45 -07:00

5.7 KiB

PR #2242: Fix build break and build release

Description

Build release profile for one configuration.

Full Diff

diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml
index 97075a1f07..0fd67175a9 100644
--- a/.github/workflows/rust-ci.yml
+++ b/.github/workflows/rust-ci.yml
@@ -34,7 +34,7 @@ jobs:
 
   # CI to validate on different os/targets
   lint_build_test:
-    name: ${{ matrix.runner }} - ${{ matrix.target }}
+    name: ${{ matrix.runner }} - ${{ matrix.target }}${{ matrix.profile == 'release' && ' (release)' || '' }}
     runs-on: ${{ matrix.runner }}
     timeout-minutes: 30
     defaults:
@@ -49,18 +49,31 @@ jobs:
         include:
           - runner: macos-14
             target: aarch64-apple-darwin
+            profile: dev
           - runner: macos-14
             target: x86_64-apple-darwin
+            profile: dev
+          - runner: macos-14
+            target: aarch64-apple-darwin
+            profile: release
           - runner: ubuntu-24.04
             target: x86_64-unknown-linux-musl
+            profile: dev
+          - runner: ubuntu-24.04
+            target: x86_64-unknown-linux-musl
+            profile: release
           - runner: ubuntu-24.04
             target: x86_64-unknown-linux-gnu
+            profile: dev
           - runner: ubuntu-24.04-arm
             target: aarch64-unknown-linux-musl
+            profile: dev
           - runner: ubuntu-24.04-arm
             target: aarch64-unknown-linux-gnu
+            profile: dev
           - runner: windows-latest
             target: x86_64-pc-windows-msvc
+            profile: dev
 
     steps:
       - uses: actions/checkout@v4
@@ -77,7 +90,7 @@ jobs:
             ~/.cargo/registry/cache/
             ~/.cargo/git/db/
             ${{ github.workspace }}/codex-rs/target/
-          key: cargo-${{ matrix.runner }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
+          key: cargo-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('**/Cargo.lock') }}
 
       - if: ${{ matrix.target == 'x86_64-unknown-linux-musl' || matrix.target == 'aarch64-unknown-linux-musl'}}
         name: Install musl build tools
@@ -86,7 +99,6 @@ jobs:
 
       - name: cargo clippy
         id: clippy
-        continue-on-error: true
         run: cargo clippy --target ${{ matrix.target }} --all-features --tests -- -D warnings
 
       # Running `cargo build` from the workspace root builds the workspace using
@@ -98,12 +110,12 @@ jobs:
         id: build
         if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }}
         continue-on-error: true
-        run: find . -name Cargo.toml -mindepth 2 -maxdepth 2 -print0 | xargs -0 -n1 -I{} bash -c 'cd "$(dirname "{}")" && cargo build'
+        run: find . -name Cargo.toml -mindepth 2 -maxdepth 2 -print0 | xargs -0 -n1 -I{} bash -c 'cd "$(dirname "{}")" && cargo build --profile ${{ matrix.profile }}'
 
       - name: cargo test
         id: test
         continue-on-error: true
-        run: cargo test --all-features --target ${{ matrix.target }}
+        run: cargo test --all-features --target ${{ matrix.target }} --profile ${{ matrix.profile }}
         env:
           RUST_BACKTRACE: 1
 
diff --git a/.github/workflows/rust-release.yml b/.github/workflows/rust-release.yml
index 8bf7361da9..d3e313b3cc 100644
--- a/.github/workflows/rust-release.yml
+++ b/.github/workflows/rust-release.yml
@@ -87,7 +87,7 @@ jobs:
             ~/.cargo/registry/cache/
             ~/.cargo/git/db/
             ${{ github.workspace }}/codex-rs/target/
-          key: cargo-release-${{ matrix.runner }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
+          key: cargo-release-${{ matrix.runner }}-${{ matrix.target }}-release-${{ hashFiles('**/Cargo.lock') }}
 
       - if: ${{ matrix.target == 'x86_64-unknown-linux-musl' || matrix.target == 'aarch64-unknown-linux-musl'}}
         name: Install musl build tools

Review Comments

.github/workflows/rust-ci.yml

@@ -49,18 +49,28 @@ jobs:
         include:
           - runner: macos-14
             target: aarch64-apple-darwin
+            profile: dev
           - runner: macos-14
             target: x86_64-apple-darwin
+            profile: dev
+          - runner: macos-14
+            target: aarch64-apple-darwin
+            profile: release

Does this one build the fastest? And can you add a comment here because it's a bit subtle since it's in the middle of the list?

Arguably we should do one Mac and one Linux release mode because there is stuff conditionally compiled for Landlock that sometimes I forget to test...

@@ -77,7 +87,7 @@ jobs:
             ~/.cargo/registry/cache/
             ~/.cargo/git/db/
             ${{ github.workspace }}/codex-rs/target/
-          key: cargo-${{ matrix.runner }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
+          key: cargo-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('**/Cargo.lock') }}

Can/should we update rust-release.yml to match and get cache hits?

codex-rs/tui/src/updates.rs

@@ -9,6 +9,7 @@ use std::path::Path;
 use std::path::PathBuf;
 
 use codex_core::config::Config;
+use codex_core::user_agent::get_codex_user_agent;

rebase because this is merged already?