|
| 1 | +name: manual-release-build |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + build_linux: |
| 7 | + description: Build x86_64 Linux artifact on ubuntu-24.04 |
| 8 | + required: true |
| 9 | + default: true |
| 10 | + type: boolean |
| 11 | + build_macos_intel: |
| 12 | + description: Build x86_64 macOS artifact on macos-15-intel |
| 13 | + required: true |
| 14 | + default: true |
| 15 | + type: boolean |
| 16 | + |
| 17 | +concurrency: |
| 18 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 19 | + cancel-in-progress: true |
| 20 | + |
| 21 | +permissions: |
| 22 | + contents: read |
| 23 | + |
| 24 | +jobs: |
| 25 | + linux: |
| 26 | + name: Release build — x86_64-unknown-linux-gnu |
| 27 | + if: ${{ inputs.build_linux }} |
| 28 | + runs-on: ubuntu-24.04 |
| 29 | + timeout-minutes: 360 |
| 30 | + env: |
| 31 | + CARGO_INCREMENTAL: "0" |
| 32 | + SCCACHE_CACHE_SIZE: 10G |
| 33 | + defaults: |
| 34 | + run: |
| 35 | + working-directory: codex-rs |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v6 |
| 38 | + |
| 39 | + - name: Install Linux build dependencies |
| 40 | + shell: bash |
| 41 | + run: | |
| 42 | + set -euo pipefail |
| 43 | + sudo apt-get update -y |
| 44 | + sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends pkg-config libcap-dev |
| 45 | +
|
| 46 | + - uses: dtolnay/rust-toolchain@1.93.0 |
| 47 | + |
| 48 | + - name: Compute lockfile hash |
| 49 | + id: lockhash |
| 50 | + shell: bash |
| 51 | + run: | |
| 52 | + set -euo pipefail |
| 53 | + echo "hash=$(sha256sum Cargo.lock | cut -d' ' -f1)" >> "$GITHUB_OUTPUT" |
| 54 | + echo "toolchain_hash=$(sha256sum rust-toolchain.toml | cut -d' ' -f1)" >> "$GITHUB_OUTPUT" |
| 55 | +
|
| 56 | + - name: Restore cargo home cache |
| 57 | + id: cache_cargo_home_restore |
| 58 | + uses: actions/cache/restore@v5 |
| 59 | + with: |
| 60 | + path: | |
| 61 | + ~/.cargo/bin/ |
| 62 | + ~/.cargo/registry/index/ |
| 63 | + ~/.cargo/registry/cache/ |
| 64 | + ~/.cargo/git/db/ |
| 65 | + key: manual-release-linux-cargo-home-${{ steps.lockhash.outputs.hash }}-${{ steps.lockhash.outputs.toolchain_hash }} |
| 66 | + restore-keys: | |
| 67 | + manual-release-linux-cargo-home-${{ steps.lockhash.outputs.hash }}- |
| 68 | + manual-release-linux-cargo-home- |
| 69 | +
|
| 70 | + - name: Install sccache |
| 71 | + uses: taiki-e/install-action@44c6d64aa62cd779e873306675c7a58e86d6d532 |
| 72 | + with: |
| 73 | + tool: sccache |
| 74 | + version: 0.7.5 |
| 75 | + |
| 76 | + - name: Install cargo-chef |
| 77 | + uses: taiki-e/install-action@44c6d64aa62cd779e873306675c7a58e86d6d532 |
| 78 | + with: |
| 79 | + tool: cargo-chef |
| 80 | + version: 0.1.71 |
| 81 | + |
| 82 | + - name: Configure sccache |
| 83 | + shell: bash |
| 84 | + run: | |
| 85 | + set -euo pipefail |
| 86 | + echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV" |
| 87 | + echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV" |
| 88 | +
|
| 89 | + - name: Pre-warm dependency cache (cargo-chef) |
| 90 | + shell: bash |
| 91 | + run: | |
| 92 | + set -euo pipefail |
| 93 | + RECIPE="${RUNNER_TEMP}/chef-recipe.json" |
| 94 | + cargo chef prepare --recipe-path "$RECIPE" |
| 95 | + cargo chef cook --recipe-path "$RECIPE" --target x86_64-unknown-linux-gnu --release |
| 96 | +
|
| 97 | + - name: cargo build --release |
| 98 | + run: cargo build -p codex-cli --bin codex --release --timings |
| 99 | + |
| 100 | + - name: Package Linux artifact |
| 101 | + shell: bash |
| 102 | + run: | |
| 103 | + set -euo pipefail |
| 104 | + artifact="codex-x86_64-unknown-linux-gnu" |
| 105 | + mkdir -p dist/"${artifact}" |
| 106 | + cp target/release/codex dist/"${artifact}"/codex |
| 107 | + tar -C dist -czf "${artifact}.tar.gz" "${artifact}" |
| 108 | + sha256sum "${artifact}.tar.gz" > "${artifact}.tar.gz.sha256" |
| 109 | +
|
| 110 | + - name: Upload Linux artifact |
| 111 | + uses: actions/upload-artifact@v7 |
| 112 | + with: |
| 113 | + name: codex-x86_64-unknown-linux-gnu-${{ github.run_id }} |
| 114 | + path: | |
| 115 | + codex-rs/codex-x86_64-unknown-linux-gnu.tar.gz |
| 116 | + codex-rs/codex-x86_64-unknown-linux-gnu.tar.gz.sha256 |
| 117 | + retention-days: 14 |
| 118 | + |
| 119 | + - name: Upload Cargo timings |
| 120 | + if: always() |
| 121 | + uses: actions/upload-artifact@v7 |
| 122 | + with: |
| 123 | + name: cargo-timings-manual-release-x86_64-unknown-linux-gnu |
| 124 | + path: codex-rs/target/**/cargo-timings/cargo-timing.html |
| 125 | + if-no-files-found: warn |
| 126 | + retention-days: 14 |
| 127 | + |
| 128 | + - name: sccache stats |
| 129 | + if: always() |
| 130 | + run: sccache --show-stats || true |
| 131 | + |
| 132 | + - name: Save cargo home cache |
| 133 | + if: always() && !cancelled() && steps.cache_cargo_home_restore.outputs.cache-hit != 'true' |
| 134 | + continue-on-error: true |
| 135 | + uses: actions/cache/save@v5 |
| 136 | + with: |
| 137 | + path: | |
| 138 | + ~/.cargo/bin/ |
| 139 | + ~/.cargo/registry/index/ |
| 140 | + ~/.cargo/registry/cache/ |
| 141 | + ~/.cargo/git/db/ |
| 142 | + key: manual-release-linux-cargo-home-${{ steps.lockhash.outputs.hash }}-${{ steps.lockhash.outputs.toolchain_hash }} |
| 143 | + |
| 144 | + macos_intel: |
| 145 | + name: Release build — x86_64-apple-darwin |
| 146 | + if: ${{ inputs.build_macos_intel }} |
| 147 | + runs-on: macos-15-intel |
| 148 | + timeout-minutes: 360 |
| 149 | + env: |
| 150 | + CARGO_INCREMENTAL: "0" |
| 151 | + SCCACHE_CACHE_SIZE: 10G |
| 152 | + defaults: |
| 153 | + run: |
| 154 | + working-directory: codex-rs |
| 155 | + steps: |
| 156 | + - uses: actions/checkout@v6 |
| 157 | + |
| 158 | + - uses: dtolnay/rust-toolchain@1.93.0 |
| 159 | + |
| 160 | + - name: Compute lockfile hash |
| 161 | + id: lockhash |
| 162 | + shell: bash |
| 163 | + run: | |
| 164 | + set -euo pipefail |
| 165 | + echo "hash=$(shasum -a 256 Cargo.lock | cut -d' ' -f1)" >> "$GITHUB_OUTPUT" |
| 166 | + echo "toolchain_hash=$(shasum -a 256 rust-toolchain.toml | cut -d' ' -f1)" >> "$GITHUB_OUTPUT" |
| 167 | +
|
| 168 | + - name: Restore cargo home cache |
| 169 | + id: cache_cargo_home_restore |
| 170 | + uses: actions/cache/restore@v5 |
| 171 | + with: |
| 172 | + path: | |
| 173 | + ~/.cargo/bin/ |
| 174 | + ~/.cargo/registry/index/ |
| 175 | + ~/.cargo/registry/cache/ |
| 176 | + ~/.cargo/git/db/ |
| 177 | + key: manual-release-macos-intel-cargo-home-${{ steps.lockhash.outputs.hash }}-${{ steps.lockhash.outputs.toolchain_hash }} |
| 178 | + restore-keys: | |
| 179 | + manual-release-macos-intel-cargo-home-${{ steps.lockhash.outputs.hash }}- |
| 180 | + manual-release-macos-intel-cargo-home- |
| 181 | +
|
| 182 | + - name: Install sccache |
| 183 | + uses: taiki-e/install-action@44c6d64aa62cd779e873306675c7a58e86d6d532 |
| 184 | + with: |
| 185 | + tool: sccache |
| 186 | + version: 0.7.5 |
| 187 | + |
| 188 | + - name: Install cargo-chef |
| 189 | + uses: taiki-e/install-action@44c6d64aa62cd779e873306675c7a58e86d6d532 |
| 190 | + with: |
| 191 | + tool: cargo-chef |
| 192 | + version: 0.1.71 |
| 193 | + |
| 194 | + - name: Configure sccache |
| 195 | + shell: bash |
| 196 | + run: | |
| 197 | + set -euo pipefail |
| 198 | + echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV" |
| 199 | + echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV" |
| 200 | +
|
| 201 | + - name: Pre-warm dependency cache (cargo-chef) |
| 202 | + shell: bash |
| 203 | + run: | |
| 204 | + set -euo pipefail |
| 205 | + RECIPE="${RUNNER_TEMP}/chef-recipe.json" |
| 206 | + cargo chef prepare --recipe-path "$RECIPE" |
| 207 | + cargo chef cook --recipe-path "$RECIPE" --target x86_64-apple-darwin --release |
| 208 | +
|
| 209 | + - name: cargo build --release |
| 210 | + run: cargo build -p codex-cli --bin codex --release --timings |
| 211 | + |
| 212 | + - name: Package macOS Intel artifact |
| 213 | + shell: bash |
| 214 | + run: | |
| 215 | + set -euo pipefail |
| 216 | + artifact="codex-x86_64-apple-darwin" |
| 217 | + mkdir -p dist/"${artifact}" |
| 218 | + cp target/release/codex dist/"${artifact}"/codex |
| 219 | + tar -C dist -czf "${artifact}.tar.gz" "${artifact}" |
| 220 | + shasum -a 256 "${artifact}.tar.gz" > "${artifact}.tar.gz.sha256" |
| 221 | +
|
| 222 | + - name: Upload macOS Intel artifact |
| 223 | + uses: actions/upload-artifact@v7 |
| 224 | + with: |
| 225 | + name: codex-x86_64-apple-darwin-${{ github.run_id }} |
| 226 | + path: | |
| 227 | + codex-rs/codex-x86_64-apple-darwin.tar.gz |
| 228 | + codex-rs/codex-x86_64-apple-darwin.tar.gz.sha256 |
| 229 | + retention-days: 14 |
| 230 | + |
| 231 | + - name: Upload Cargo timings |
| 232 | + if: always() |
| 233 | + uses: actions/upload-artifact@v7 |
| 234 | + with: |
| 235 | + name: cargo-timings-manual-release-x86_64-apple-darwin |
| 236 | + path: codex-rs/target/**/cargo-timings/cargo-timing.html |
| 237 | + if-no-files-found: warn |
| 238 | + retention-days: 14 |
| 239 | + |
| 240 | + - name: sccache stats |
| 241 | + if: always() |
| 242 | + run: sccache --show-stats || true |
| 243 | + |
| 244 | + - name: Save cargo home cache |
| 245 | + if: always() && !cancelled() && steps.cache_cargo_home_restore.outputs.cache-hit != 'true' |
| 246 | + continue-on-error: true |
| 247 | + uses: actions/cache/save@v5 |
| 248 | + with: |
| 249 | + path: | |
| 250 | + ~/.cargo/bin/ |
| 251 | + ~/.cargo/registry/index/ |
| 252 | + ~/.cargo/registry/cache/ |
| 253 | + ~/.cargo/git/db/ |
| 254 | + key: manual-release-macos-intel-cargo-home-${{ steps.lockhash.outputs.hash }}-${{ steps.lockhash.outputs.toolchain_hash }} |
0 commit comments