Add RISC-V (riscv64gc-unknown-linux-gnu) prebuilt binary support

Adds riscv64 to build pipelines so CodeWhale ships prebuilt binaries
and npm wrappers for 64-bit RISC-V Linux (glibc) systems.

Changes:

**CI / build**
- release.yml: +2 build matrix entries (codewhale + codewhale-tui for
  riscv64gc-unknown-linux-gnu), cross-compilation toolchain step using
  a dedicated DEB822-format apt source for ports.ubuntu.com, bundle
  step, and release-notes table row.
- nightly.yml: +2 matrix entries, matching cross-compilation setup.
- resolve job: handle workflow_dispatch when the target tag does not
  yet exist (fall back to HEAD SHA).

**Packaging**
- npm/codewhale/scripts/artifacts.js: add riscv64 to ASSET_MATRIX
  under linux so npm install -g codewhale resolves on RISC-V.

**Docs**
- docs/INSTALL.md: add riscv64 row to supported platforms table;
  replace with clearer 'other architectures' wording.

Build strategy: cross-compile from ubuntu-latest (x86_64) using
gcc-riscv64-linux-gnu. The dbus runtime dependency (from the keyring
crate's secret-service backend) is satisfied via ports.ubuntu.com.
PKG_CONFIG_ALLOW_CROSS and a cross-target libdir are set so the
keyring crate finds dbus-1 during cross-compilation.

Docker support for linux/riscv64 is intentionally not added here:
GitHub Actions does not yet provide the infrastructure to build or
emulate riscv64 containers. The Dockerfile changes will follow when
the hosted CI surface supports it.
This commit is contained in:
Rocky Zhang
2026-05-31 01:53:02 +00:00
parent 54151a4bc9
commit c0dd43993c
4 changed files with 82 additions and 4 deletions
+33
View File
@@ -33,6 +33,10 @@ jobs:
target: aarch64-unknown-linux-gnu
binary: codewhale
artifact_name: codewhale-linux-arm64
- os: ubuntu-latest
target: riscv64gc-unknown-linux-gnu
binary: codewhale
artifact_name: codewhale-linux-riscv64
- os: macos-latest
target: x86_64-apple-darwin
binary: codewhale
@@ -54,6 +58,10 @@ jobs:
target: aarch64-unknown-linux-gnu
binary: codewhale-tui
artifact_name: codewhale-tui-linux-arm64
- os: ubuntu-latest
target: riscv64gc-unknown-linux-gnu
binary: codewhale-tui
artifact_name: codewhale-tui-linux-riscv64
- os: macos-latest
target: x86_64-apple-darwin
binary: codewhale-tui
@@ -84,8 +92,33 @@ jobs:
sleep 15
done
sudo apt-get install -y libdbus-1-dev pkg-config
- name: Install RISC-V cross-compilation toolchain
if: matrix.target == 'riscv64gc-unknown-linux-gnu'
run: |
# Install cross-compiler (available in standard repos)
sudo apt-get update
sudo apt-get install -y gcc-riscv64-linux-gnu libc6-dev-riscv64-cross
# Add Ubuntu ports for riscv64 packages
. /etc/os-release
sudo tee /etc/apt/sources.list.d/riscv64.sources <<SRC
Types: deb
URIs: http://ports.ubuntu.com/
Suites: ${UBUNTU_CODENAME} ${UBUNTU_CODENAME}-updates
Components: main universe
Architectures: riscv64
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
SRC
sudo dpkg --add-architecture riscv64
sudo apt-get update -o Dir::Etc::sourcelist=/etc/apt/sources.list.d/riscv64.sources -o Dir::Etc::sourceparts=- -o APT::Get::List-Cleanup=0
sudo apt-get install -y libdbus-1-dev:riscv64
- name: Build
shell: bash
env:
CC_riscv64gc_unknown_linux_gnu: riscv64-linux-gnu-gcc
CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER: riscv64-linux-gnu-gcc
PKG_CONFIG_ALLOW_CROSS: 1
PKG_CONFIG_LIBDIR_riscv64gc_unknown_linux_gnu: /usr/lib/riscv64-linux-gnu/pkgconfig
run: cargo build --release --locked --target ${{ matrix.target }}
- name: Stage artifact
id: stage
+46 -3
View File
@@ -71,9 +71,15 @@ jobs:
run: |
if [ "${GITHUB_EVENT_NAME}" = "workflow_dispatch" ]; then
tag="v${{ inputs.version }}"
git fetch --force origin "refs/tags/${tag}:refs/tags/${tag}"
sha="$(git rev-list -n 1 "${tag}")"
source_ref="${tag}"
if git rev-parse "refs/tags/${tag}" >/dev/null 2>&1; then
sha="$(git rev-list -n 1 "${tag}")"
source_ref="${tag}"
else
# Tag doesn't exist yet — build from HEAD
sha="${GITHUB_SHA}"
source_ref="${GITHUB_REF_NAME}"
echo "Tag ${tag} not found; building from ${source_ref} @ ${sha}"
fi
else
tag="${GITHUB_REF_NAME}"
sha="${GITHUB_SHA}"
@@ -109,6 +115,10 @@ jobs:
target: aarch64-unknown-linux-gnu
binary: codewhale
artifact_name: codewhale-linux-arm64
- os: ubuntu-latest
target: riscv64gc-unknown-linux-gnu
binary: codewhale
artifact_name: codewhale-linux-riscv64
- os: macos-latest
target: x86_64-apple-darwin
binary: codewhale
@@ -130,6 +140,10 @@ jobs:
target: aarch64-unknown-linux-gnu
binary: codewhale-tui
artifact_name: codewhale-tui-linux-arm64
- os: ubuntu-latest
target: riscv64gc-unknown-linux-gnu
binary: codewhale-tui
artifact_name: codewhale-tui-linux-riscv64
- os: macos-latest
target: x86_64-apple-darwin
binary: codewhale-tui
@@ -204,10 +218,34 @@ jobs:
sleep 15
done
sudo apt-get install -y libdbus-1-dev pkg-config
- name: Install RISC-V cross-compilation toolchain
if: matrix.target == 'riscv64gc-unknown-linux-gnu'
run: |
# Install cross-compiler (available in standard repos)
sudo apt-get update
sudo apt-get install -y gcc-riscv64-linux-gnu libc6-dev-riscv64-cross
# Add Ubuntu ports for riscv64 packages
. /etc/os-release
sudo tee /etc/apt/sources.list.d/riscv64.sources <<SRC
Types: deb
URIs: http://ports.ubuntu.com/
Suites: ${UBUNTU_CODENAME} ${UBUNTU_CODENAME}-updates
Components: main universe
Architectures: riscv64
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
SRC
sudo dpkg --add-architecture riscv64
sudo apt-get update -o Dir::Etc::sourcelist=/etc/apt/sources.list.d/riscv64.sources -o Dir::Etc::sourceparts=- -o APT::Get::List-Cleanup=0
sudo apt-get install -y libdbus-1-dev:riscv64
- name: Build
shell: bash
env:
DEEPSEEK_BUILD_SHA: ${{ needs.resolve.outputs.sha }}
CC_riscv64gc_unknown_linux_gnu: riscv64-linux-gnu-gcc
CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER: riscv64-linux-gnu-gcc
PKG_CONFIG_ALLOW_CROSS: 1
PKG_CONFIG_LIBDIR_riscv64gc_unknown_linux_gnu: /usr/lib/riscv64-linux-gnu/pkgconfig
run: cargo build --release --locked --target ${{ matrix.target }}
- name: Rename binary
shell: bash
@@ -296,6 +334,10 @@ jobs:
bundle linux-arm64 \
codewhale-linux-arm64 codewhale-tui-linux-arm64 tar.gz ""
# Platform: linux-riscv64
bundle linux-riscv64 \
codewhale-linux-riscv64 codewhale-tui-linux-riscv64 tar.gz ""
# Platform: macos-x64
bundle macos-x64 \
codewhale-macos-x64 codewhale-tui-macos-x64 tar.gz ""
@@ -471,6 +513,7 @@ jobs:
|---|---|---|
| Linux x64 | `codewhale-linux-x64.tar.gz` | `install.sh` |
| Linux ARM64 | `codewhale-linux-arm64.tar.gz` | `install.sh` |
| Linux RISC-V | `codewhale-linux-riscv64.tar.gz` | `install.sh` |
| macOS x64 | `codewhale-macos-x64.tar.gz` | `install.sh` |
| macOS ARM | `codewhale-macos-arm64.tar.gz` | `install.sh` |
| Windows x64 | `codewhale-windows-x64.zip` | `install.bat` |
+2 -1
View File
@@ -19,10 +19,11 @@ these platform/architecture combinations from v0.8.8 onward:
| ------------ | ------------ | :---------: | :-------------: | ----------------------------------------------------- |
| Linux | x64 (x86_64) | ✅ | ✅ | `codewhale-linux-x64`, `codewhale-tui-linux-x64` |
| Linux | arm64 | ✅ | ✅ | `codewhale-linux-arm64`, `codewhale-tui-linux-arm64` |
| Linux | riscv64 | ✅ | ✅ | `codewhale-linux-riscv64`, `codewhale-tui-linux-riscv64`|
| macOS | x64 | ✅ | ✅ | `codewhale-macos-x64`, `codewhale-tui-macos-x64` |
| macOS | arm64 (M-series) | ✅ | ✅ | `codewhale-macos-arm64`, `codewhale-tui-macos-arm64` |
| Windows | x64 | ✅ | ✅ | `codewhale-windows-x64.exe`, `codewhale-tui-windows-x64.exe` |
| Other Linux (musl, riscv64, …) | — | ❌¹ | ✅² | build from source |
| Other Linux (musl, other architectures) | — | ❌¹ | ✅² | build from source |
| FreeBSD / OpenBSD | — | ❌ | ✅² | build from source |
¹ The npm package will exit with a clear error and point you here.
+1
View File
@@ -7,6 +7,7 @@ const ASSET_MATRIX = {
linux: {
x64: ["codewhale-linux-x64", "codewhale-tui-linux-x64"],
arm64: ["codewhale-linux-arm64", "codewhale-tui-linux-arm64"],
riscv64: ["codewhale-linux-riscv64", "codewhale-tui-linux-riscv64"],
},
darwin: {
x64: ["codewhale-macos-x64", "codewhale-tui-macos-x64"],