Skip to content

Commit ae9dca2

Browse files
authored
ci: add Linux ARM64 release build
Add Linux ARM64 release and npm package support.
1 parent 19d9e28 commit ae9dca2

5 files changed

Lines changed: 34 additions & 8 deletions

File tree

.agents/skills/codex-upstream-reapply/references/npm-release.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- 顶层发布包名:`@loongphy/codext`
1919
- 平台包名:
2020
- `@loongphy/codext-linux-x64`
21+
- `@loongphy/codext-linux-arm64`
2122
- `@loongphy/codext-darwin-x64`
2223
- `@loongphy/codext-darwin-arm64`
2324
- `@loongphy/codext-win32-x64`

.github/workflows/rust-release.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ jobs:
2626
include:
2727
- runner: ubuntu-24.04
2828
target: x86_64-unknown-linux-musl
29+
- runner: ubuntu-24.04
30+
target: aarch64-unknown-linux-musl
2931
- runner: macos-15-intel
3032
target: x86_64-apple-darwin
3133
- runner: macos-15
@@ -47,7 +49,7 @@ jobs:
4749
targets: ${{ matrix.target }}
4850

4951
- name: Use hermetic Cargo home
50-
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
52+
if: ${{ contains(matrix.target, 'unknown-linux-musl') }}
5153
shell: bash
5254
run: |
5355
set -euo pipefail
@@ -58,7 +60,7 @@ jobs:
5860
: > "${cargo_home}/config.toml"
5961
6062
- name: Cache Cargo home and target dir
61-
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
63+
if: ${{ contains(matrix.target, 'unknown-linux-musl') }}
6264
uses: actions/cache@v4
6365
with:
6466
path: |
@@ -70,7 +72,7 @@ jobs:
7072
${{ runner.os }}-${{ matrix.target }}-cargo-
7173
7274
- name: Cache Cargo home and target dir
73-
if: ${{ matrix.target != 'x86_64-unknown-linux-musl' }}
75+
if: ${{ !contains(matrix.target, 'unknown-linux-musl') }}
7476
uses: actions/cache@v4
7577
with:
7678
path: |
@@ -82,20 +84,20 @@ jobs:
8284
${{ runner.os }}-${{ matrix.target }}-cargo-
8385
8486
- name: Install Zig
85-
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
87+
if: ${{ contains(matrix.target, 'unknown-linux-musl') }}
8688
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29
8789
with:
8890
version: 0.14.0
8991

9092
- name: Install musl build tools
91-
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
93+
if: ${{ contains(matrix.target, 'unknown-linux-musl') }}
9294
env:
9395
TARGET: ${{ matrix.target }}
9496
shell: bash
9597
run: bash "${GITHUB_WORKSPACE}/.github/scripts/install-musl-build-tools.sh"
9698

9799
- name: Configure rustc UBSan wrapper
98-
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
100+
if: ${{ contains(matrix.target, 'unknown-linux-musl') }}
99101
shell: bash
100102
run: |
101103
set -euo pipefail
@@ -118,7 +120,7 @@ jobs:
118120
echo "RUSTC_WORKSPACE_WRAPPER=" >> "$GITHUB_ENV"
119121
120122
- name: Clear sanitizer flags
121-
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
123+
if: ${{ contains(matrix.target, 'unknown-linux-musl') }}
122124
shell: bash
123125
run: |
124126
set -euo pipefail
@@ -136,7 +138,7 @@ jobs:
136138
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS=" >> "$GITHUB_ENV"
137139
138140
- name: Configure musl rusty_v8 artifact overrides
139-
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
141+
if: ${{ contains(matrix.target, 'unknown-linux-musl') }}
140142
env:
141143
TARGET: ${{ matrix.target }}
142144
shell: bash
@@ -276,6 +278,11 @@ jobs:
276278
chmod +x "${linux_stage}/codext"
277279
tar -C "${linux_stage}" -czf "${out_dir}/codext-linux-x64-${VERSION}.tar.gz" codext
278280
281+
linux_arm64_stage="$(mktemp -d "${RUNNER_TEMP}/release-linux-arm64-XXXXXX")"
282+
cp "${artifacts_root}/codex-bin-aarch64-unknown-linux-musl/codex" "${linux_arm64_stage}/codext"
283+
chmod +x "${linux_arm64_stage}/codext"
284+
tar -C "${linux_arm64_stage}" -czf "${out_dir}/codext-linux-arm64-${VERSION}.tar.gz" codext
285+
279286
darwin_x64_stage="$(mktemp -d "${RUNNER_TEMP}/release-darwin-x64-XXXXXX")"
280287
cp "${artifacts_root}/codex-bin-x86_64-apple-darwin/codex" "${darwin_x64_stage}/codext"
281288
chmod +x "${darwin_x64_stage}/codext"
@@ -366,12 +373,15 @@ jobs:
366373
367374
mkdir -p \
368375
"${vendor_root}/x86_64-unknown-linux-musl/codex" \
376+
"${vendor_root}/aarch64-unknown-linux-musl/codex" \
369377
"${vendor_root}/x86_64-apple-darwin/codex" \
370378
"${vendor_root}/aarch64-apple-darwin/codex" \
371379
"${vendor_root}/x86_64-pc-windows-msvc/codex"
372380
373381
cp "${artifacts_root}/codex-bin-x86_64-unknown-linux-musl/codex" \
374382
"${vendor_root}/x86_64-unknown-linux-musl/codex/codex"
383+
cp "${artifacts_root}/codex-bin-aarch64-unknown-linux-musl/codex" \
384+
"${vendor_root}/aarch64-unknown-linux-musl/codex/codex"
375385
cp "${artifacts_root}/codex-bin-x86_64-apple-darwin/codex" \
376386
"${vendor_root}/x86_64-apple-darwin/codex/codex"
377387
cp "${artifacts_root}/codex-bin-aarch64-apple-darwin/codex" \
@@ -401,6 +411,7 @@ jobs:
401411
packages=(
402412
codex
403413
codex-linux-x64
414+
codex-linux-arm64
404415
codex-darwin-x64
405416
codex-darwin-arm64
406417
codex-win32-x64

codex-cli/bin/codex.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const require = createRequire(import.meta.url);
1414

1515
const PLATFORM_PACKAGE_BY_TARGET = {
1616
"x86_64-unknown-linux-musl": "@loongphy/codext-linux-x64",
17+
"aarch64-unknown-linux-musl": "@loongphy/codext-linux-arm64",
1718
"x86_64-apple-darwin": "@loongphy/codext-darwin-x64",
1819
"aarch64-apple-darwin": "@loongphy/codext-darwin-arm64",
1920
"x86_64-pc-windows-msvc": "@loongphy/codext-win32-x64",
@@ -29,6 +30,9 @@ switch (platform) {
2930
case "x64":
3031
targetTriple = "x86_64-unknown-linux-musl";
3132
break;
33+
case "arm64":
34+
targetTriple = "aarch64-unknown-linux-musl";
35+
break;
3236
default:
3337
break;
3438
}

codex-cli/scripts/build_npm_package.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
"os": "linux",
2727
"cpu": "x64",
2828
},
29+
"codex-linux-arm64": {
30+
"npm_name": "@loongphy/codext-linux-arm64",
31+
"npm_tag": "linux-arm64",
32+
"target_triple": "aarch64-unknown-linux-musl",
33+
"os": "linux",
34+
"cpu": "arm64",
35+
},
2936
"codex-darwin-x64": {
3037
"npm_name": "@loongphy/codext-darwin-x64",
3138
"npm_tag": "darwin-x64",
@@ -56,6 +63,7 @@
5663
PACKAGE_NATIVE_COMPONENTS: dict[str, list[str]] = {
5764
"codex": [],
5865
"codex-linux-x64": ["codex", "rg"],
66+
"codex-linux-arm64": ["codex", "rg"],
5967
"codex-darwin-x64": ["codex", "rg"],
6068
"codex-darwin-arm64": ["codex", "rg"],
6169
"codex-win32-x64": ["codex", "rg", "codex-windows-sandbox-setup", "codex-command-runner"],

codex-cli/scripts/install_native_deps.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
RG_MANIFEST = CODEX_CLI_ROOT / "bin" / "rg"
2626
BINARY_TARGETS = (
2727
"x86_64-unknown-linux-musl",
28+
"aarch64-unknown-linux-musl",
2829
"x86_64-apple-darwin",
2930
"aarch64-apple-darwin",
3031
"x86_64-pc-windows-msvc",
@@ -68,6 +69,7 @@ class BinaryComponent:
6869

6970
RG_TARGET_PLATFORM_PAIRS: list[tuple[str, str]] = [
7071
("x86_64-unknown-linux-musl", "linux-x86_64"),
72+
("aarch64-unknown-linux-musl", "linux-aarch64"),
7173
("x86_64-apple-darwin", "macos-x86_64"),
7274
("aarch64-apple-darwin", "macos-aarch64"),
7375
("x86_64-pc-windows-msvc", "windows-x86_64"),

0 commit comments

Comments
 (0)