From c0dd43993cab086bc90b0b71e0aadd75a89e2a7e Mon Sep 17 00:00:00 2001 From: Rocky Zhang Date: Sun, 31 May 2026 01:53:02 +0000 Subject: [PATCH] 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. --- .github/workflows/nightly.yml | 33 ++++++++++++++++++++ .github/workflows/release.yml | 49 ++++++++++++++++++++++++++++-- docs/INSTALL.md | 3 +- npm/codewhale/scripts/artifacts.js | 1 + 4 files changed, 82 insertions(+), 4 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 53fcd34a..035193ef 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -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 </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 <