Skip to content

feat: support riscv64 prebuilt binaries in release and install#1382

Merged
dc-bytedance merged 3 commits into
mainfrom
feat/riscv64-support
Jun 11, 2026
Merged

feat: support riscv64 prebuilt binaries in release and install#1382
dc-bytedance merged 3 commits into
mainfrom
feat/riscv64-support

Conversation

@dc-bytedance

@dc-bytedance dc-bytedance commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Re-homes #1297 onto a branch in the upstream repo and cherry-picks it onto the current main. Original feature by @rockyzhang — the two original commits are preserved; a follow-up commit applies review feedback.

Adds linux/riscv64 as a supported target so lark-cli builds, releases, and installs natively on RISC-V 64-bit hardware. lark-cli is pure Go built with CGO_ENABLED=0 and has no architecture-specific code, so riscv64 needs only distribution-list additions — no product code changes.

Changes

  • .goreleaser.yml: add riscv64 to the build goarch list. goreleaser v2 auto-skips the invalid darwin/riscv64 and windows/riscv64 combos, so no ignore rule is needed.
  • package.json: add riscv64 to the npm cpu list so npm does not reject installation on riscv64 hosts.
  • scripts/install.js: add riscv64: "riscv64" to ARCH_MAP so the postinstall binary download resolves lark-cli-<version>-linux-riscv64.tar.gz.
  • scripts/build-pkg-pr-new.sh: build the linux/riscv64 preview target and map it in the embedded runner's archMap.
  • Makefile, AGENTS.md (original commit): make the test -race flag architecture-conditional — the Go 1.23 toolchain has no race detector on riscv64.
  • Makefile (follow-up commit): derive the guard with a make-native TEST_GOARCH := $(or $(GOARCH),$(shell go env GOARCH)) filter so it also honors make GOARCH=riscv64 unit-test, and restore the trailing newline the original commit dropped.

Test Plan

  • validate passed: native go build ./..., GOOS=linux GOARCH=riscv64 CGO_ENABLED=0 go build ./..., go vet ./..., gofmt clean, node --test scripts/install.test.js (32/32)
  • security code review passed (0 findings)
  • manual verification: riscv64 cross-compile produces a valid UCB RISC-V statically-linked ELF; make GOARCH=riscv64 -n unit-test shows go test without -race while the default amd64 path keeps -race; the full npm install chain (download → SHA-256 → extract → run) was exercised on emulated riscv64 (QEMU + container)
  • make unit-test: pre-existing local-load flake, unrelated to this change — internal/binding (TestResolveExecRef_*) and internal/selfupdate (TestVerifyBinaryLookPath) time out (~10s) only under the full concurrent -race run; each passes in isolation (~2s). This diff touches no Go code, so behavior is identical to main; CI is the authoritative gate.
  • skipped: sandbox E2E / skillave — build & release-pipeline config change, no CLI command or shortcut behavior to exercise
  • skipped: acceptance-reviewer — no user-facing UX change

Related Issues

N/A — re-homes PR #1297 (a PR, not a tracking issue); maintainer can close #1297 on merge.

Summary by CodeRabbit

  • New Features

    • Added riscv64 support: releases now include a riscv64 binary, runtime selects it on riscv64 platforms, and the installer/downloads recognize riscv64 archives.
  • Build / Packaging

    • CPU compatibility lists updated to include riscv64 and packaging now produces riscv64 artifacts.
  • Documentation

    • Clarified unit-test guidance: the Go race detector runs only on platforms that support it (e.g., not on riscv64).

@github-actions github-actions Bot added the size/M Single-domain feat or fix with limited business impact label Jun 10, 2026
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7d169534-1284-4db4-bb42-3b28e6d1893d

📥 Commits

Reviewing files that changed from the base of the PR and between 01e8f44 and 9a20ec7.

📒 Files selected for processing (6)
  • .goreleaser.yml
  • AGENTS.md
  • Makefile
  • package.json
  • scripts/build-pkg-pr-new.sh
  • scripts/install.js
✅ Files skipped from review due to trivial changes (2)
  • scripts/install.js
  • AGENTS.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • .goreleaser.yml
  • package.json
  • scripts/build-pkg-pr-new.sh
  • Makefile

📝 Walkthrough

Walkthrough

This PR adds riscv64 to release and package metadata, conditions the Go race detector in tests for riscv64, and builds/wires riscv64 binaries and installer/runtime mappings across build and install scripts.

Changes

riscv64 Architecture Support

Layer / File(s) Summary
Release configuration and documentation
.goreleaser.yml, package.json, AGENTS.md
Add riscv64 to the GoReleaser build matrix and npm cpu list; clarify that -race runs only where supported.
Conditional race detector support in tests
Makefile
Introduce TEST_GOARCH and RACE_FLAG and use $(RACE_FLAG) in the unit-test go test invocation to omit -race on riscv64.
Package building and runtime installation
scripts/build-pkg-pr-new.sh, scripts/install.js
Add a linux/riscv64 build target, extend the generated run.js archMap to include riscv64, and add riscv64 to the installer's ARCH_MAP for archive selection.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • larksuite/cli#178: Similar adjustments to AGENTS.md and testing guidance regarding the Go -race detector.

Poem

🐰 I hopped through builds and scripts today,
riscv64 now finds its way.
Tests skip race where it can't run,
Binaries land for RISC‑V fun.
Hops and carrots for CI play.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main objective: adding riscv64 support for prebuilt binaries in release and installation workflows.
Description check ✅ Passed The description provides comprehensive summary, detailed changes, thorough test plan, and related issue reference, matching all required template sections.
Linked Issues check ✅ Passed All code changes in the PR directly implement objectives from linked issue #1297: riscv64 added to .goreleaser.yml, package.json, scripts/install.js, scripts/build-pkg-pr-new.sh, and Makefile with conditional -race flag.
Out of Scope Changes check ✅ Passed All changes are within scope: distribution configuration, packaging metadata, and build tooling adjustments for riscv64 support with no unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/riscv64-support

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.98%. Comparing base (8e667db) to head (9a20ec7).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1382      +/-   ##
==========================================
- Coverage   71.98%   71.98%   -0.01%     
==========================================
  Files         700      700              
  Lines       66293    66293              
==========================================
- Hits        47721    47718       -3     
- Misses      14867    14870       +3     
  Partials     3705     3705              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@9a20ec7aac3d7ff6a2038a35a534c9041a5e2339

🧩 Skill update

npx skills add larksuite/cli#feat/riscv64-support -y -g

@dc-bytedance
dc-bytedance force-pushed the feat/riscv64-support branch from 9328ed3 to 01e8f44 Compare June 10, 2026 09:12
rockyzhang and others added 3 commits June 10, 2026 19:50
The cherry-picked riscv64 commit derived RACE_FLAG from `go env GOARCH`
via a grep pipeline, which ignores a GOARCH passed on the make command
line (e.g. `make GOARCH=riscv64 unit-test`) since command-line make
variables are not visible to $(shell ...). Switch to a make-native
filter that honors both, and restore the trailing newline the same
commit dropped.
@dc-bytedance
dc-bytedance force-pushed the feat/riscv64-support branch from 01e8f44 to 9a20ec7 Compare June 10, 2026 11:50
@dc-bytedance
dc-bytedance merged commit 5aeae2d into main Jun 11, 2026
21 checks passed
@dc-bytedance
dc-bytedance deleted the feat/riscv64-support branch June 11, 2026 11:18
This was referenced Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants