|
53 | 53 | defaults: |
54 | 54 | run: |
55 | 55 | working-directory: codex-rs |
56 | | - env: |
57 | | - RUSTC_WRAPPER: sccache |
58 | | - CARGO_INCREMENTAL: "0" |
59 | | - SCCACHE_CACHE_SIZE: 10G |
60 | 56 |
|
61 | 57 | strategy: |
62 | 58 | fail-fast: false |
@@ -92,80 +88,14 @@ jobs: |
92 | 88 | ~/.cargo/registry/index/ |
93 | 89 | ~/.cargo/registry/cache/ |
94 | 90 | ~/.cargo/git/db/ |
95 | | - key: cargo-${{ matrix.runner }}-${{ matrix.target }}-release-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('codex-rs/rust-toolchain.toml') }} |
96 | | - restore-keys: | |
97 | | - cargo-${{ matrix.runner }}-${{ matrix.target }}-release- |
98 | | -
|
99 | | - - name: Install sccache |
100 | | - uses: taiki-e/install-action@0c5db7f7f897c03b771660e91d065338615679f4 # v2 |
101 | | - with: |
102 | | - tool: sccache |
103 | | - version: 0.7.5 |
104 | | - |
105 | | - - name: Configure sccache backend |
106 | | - shell: bash |
107 | | - run: | |
108 | | - set -euo pipefail |
109 | | - if [[ -n "${ACTIONS_CACHE_URL:-}" && -n "${ACTIONS_RUNTIME_TOKEN:-}" ]]; then |
110 | | - echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV" |
111 | | - echo "Using sccache GitHub backend" |
112 | | - else |
113 | | - echo "SCCACHE_GHA_ENABLED=false" >> "$GITHUB_ENV" |
114 | | - echo "SCCACHE_DIR=${{ github.workspace }}/.sccache" >> "$GITHUB_ENV" |
115 | | - echo "Using sccache local disk + actions/cache fallback" |
116 | | - fi |
117 | | -
|
118 | | - - name: Restore sccache cache (fallback) |
119 | | - if: ${{ env.SCCACHE_GHA_ENABLED != 'true' }} |
120 | | - id: cache_sccache_restore |
121 | | - uses: actions/cache/restore@v4 |
122 | | - with: |
123 | | - path: ${{ github.workspace }}/.sccache/ |
124 | | - key: sccache-${{ matrix.runner }}-${{ matrix.target }}-release-${{ hashFiles('**/Cargo.lock') }}-${{ github.run_id }} |
125 | | - restore-keys: | |
126 | | - sccache-${{ matrix.runner }}-${{ matrix.target }}-release-${{ hashFiles('**/Cargo.lock') }}- |
127 | | - sccache-${{ matrix.runner }}-${{ matrix.target }}-release- |
128 | | -
|
129 | | - - if: ${{ matrix.target == 'x86_64-unknown-linux-musl' || matrix.target == 'aarch64-unknown-linux-musl'}} |
130 | | - name: Prepare APT cache directories (musl) |
131 | | - shell: bash |
132 | | - run: | |
133 | | - set -euo pipefail |
134 | | - sudo mkdir -p /var/cache/apt/archives /var/lib/apt/lists |
135 | | - sudo chown -R "$USER:$USER" /var/cache/apt /var/lib/apt/lists |
136 | | -
|
137 | | - - if: ${{ matrix.target == 'x86_64-unknown-linux-musl' || matrix.target == 'aarch64-unknown-linux-musl'}} |
138 | | - name: Restore APT cache (musl) |
139 | | - id: cache_apt_restore |
140 | | - uses: actions/cache/restore@v4 |
141 | | - with: |
142 | | - path: | |
143 | | - /var/cache/apt |
144 | | - key: apt-${{ matrix.runner }}-${{ matrix.target }}-v1 |
| 91 | + ${{ github.workspace }}/codex-rs/target/ |
| 92 | + key: cargo-${{ matrix.runner }}-${{ matrix.target }}-release-${{ hashFiles('**/Cargo.lock') }} |
145 | 93 |
|
146 | 94 | - if: ${{ matrix.target == 'x86_64-unknown-linux-musl' || matrix.target == 'aarch64-unknown-linux-musl'}} |
147 | 95 | name: Install musl build tools |
148 | | - env: |
149 | | - DEBIAN_FRONTEND: noninteractive |
150 | | - shell: bash |
151 | 96 | run: | |
152 | | - set -euo pipefail |
153 | | - sudo apt-get -y update -o Acquire::Retries=3 |
154 | | - sudo apt-get -y install --no-install-recommends musl-tools pkg-config |
155 | | -
|
156 | | - - name: Install cargo-chef |
157 | | - uses: taiki-e/install-action@0c5db7f7f897c03b771660e91d065338615679f4 # v2 |
158 | | - with: |
159 | | - tool: cargo-chef |
160 | | - version: 0.1.71 |
161 | | - |
162 | | - - name: Pre-warm dependency cache (cargo-chef) |
163 | | - shell: bash |
164 | | - run: | |
165 | | - set -euo pipefail |
166 | | - RECIPE="${RUNNER_TEMP}/chef-recipe.json" |
167 | | - cargo chef prepare --recipe-path "$RECIPE" |
168 | | - cargo chef cook --recipe-path "$RECIPE" --target ${{ matrix.target }} --release --all-features |
| 97 | + sudo apt-get update |
| 98 | + sudo apt-get install -y musl-tools pkg-config |
169 | 99 |
|
170 | 100 | - name: Cargo build |
171 | 101 | run: cargo build --target ${{ matrix.target }} --release --bin codex --bin codex-responses-api-proxy |
@@ -397,40 +327,6 @@ jobs: |
397 | 327 | zstd -T0 -19 --rm "$dest/$base" |
398 | 328 | done |
399 | 329 |
|
400 | | - - name: Save APT cache (musl) |
401 | | - if: always() && !cancelled() && (matrix.target == 'x86_64-unknown-linux-musl' || matrix.target == 'aarch64-unknown-linux-musl') && steps.cache_apt_restore.outputs.cache-hit != 'true' |
402 | | - continue-on-error: true |
403 | | - uses: actions/cache/save@v4 |
404 | | - with: |
405 | | - path: | |
406 | | - /var/cache/apt |
407 | | - key: apt-${{ matrix.runner }}-${{ matrix.target }}-v1 |
408 | | - |
409 | | - - name: Save sccache cache (fallback) |
410 | | - if: always() && !cancelled() && env.SCCACHE_GHA_ENABLED != 'true' |
411 | | - continue-on-error: true |
412 | | - uses: actions/cache/save@v4 |
413 | | - with: |
414 | | - path: ${{ github.workspace }}/.sccache/ |
415 | | - key: sccache-${{ matrix.runner }}-${{ matrix.target }}-release-${{ hashFiles('**/Cargo.lock') }}-${{ github.run_id }} |
416 | | - |
417 | | - - name: sccache stats |
418 | | - if: always() |
419 | | - continue-on-error: true |
420 | | - run: sccache --show-stats || true |
421 | | - |
422 | | - - name: sccache summary |
423 | | - if: always() |
424 | | - shell: bash |
425 | | - run: | |
426 | | - { |
427 | | - echo "### sccache stats — ${{ matrix.target }} (release)"; |
428 | | - echo; |
429 | | - echo '```'; |
430 | | - sccache --show-stats || true; |
431 | | - echo '```'; |
432 | | - } >> "$GITHUB_STEP_SUMMARY" |
433 | | -
|
434 | 330 | - name: Remove signing keychain |
435 | 331 | if: ${{ always() && matrix.runner == 'macos-15-xlarge' }} |
436 | 332 | shell: bash |
|
0 commit comments