ci: add RISC-V (riscv64) unit test workflow#959
Conversation
Run sonic's compat-mode unit/issue/generic tests on real riscv64 hardware via the RISE project ephemeral GitHub Actions runners (ubuntu-24.04-riscv, https://riscv-runners.riseproject.dev/). Pinned to go1.25 since the race detector requires go1.23+ on linux/riscv64; arch-specific JIT packages are excluded as sonic falls back to encoding/json on riscv64.
128c311 to
1acb09d
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new GitHub Actions workflow to run Sonic’s unit/issue/generic test suites on real riscv64 hardware via RISE ephemeral runners (runs-on: ubuntu-24.04-riscv), including coverage upload to Codecov.
Changes:
- Introduces
.github/workflows/test-riscv64.ymlto rungo testsuites on RISC-V runners, excluding arch-specific packages. - Configures Go setup + module caching and uploads coverage to Codecov with
riscv64flags.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 128c3118ef
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| - name: Unit Test | ||
| run: | | ||
| GOMAXPROCS=4 go test -race -covermode=atomic -coverprofile=coverage.txt $(go list ./... | grep -v -E 'loader|jit|avx|x86|sse') |
There was a problem hiding this comment.
Drop -race from RISC-V test commands
On the ubuntu-24.04-riscv runner these commands execute as linux/riscv64, but go help build for Go 1.25 lists -race support only for linux/amd64, freebsd/amd64, darwin/amd64, darwin/arm64, windows/amd64, linux/ppc64le, and linux/arm64; GOOS=linux GOARCH=riscv64 go test -race fails with -race is not supported on linux/riscv64. Because every test step in this workflow uses -race, the new PR workflow will fail before running any tests.
Useful? React with 👍 / 👎.
|
|
||
| - name: Unit Test | ||
| run: | | ||
| GOMAXPROCS=4 go test -race -covermode=atomic -coverprofile=coverage.txt $(go list ./... | grep -v -E 'loader|jit|avx|x86|sse') |
There was a problem hiding this comment.
Exclude native-only internal packages on RISC-V
Even after removing -race, this package list still includes non-compat internal packages such as github.com/bytedance/sonic/internal/decoder/api; on GOOS=linux GOARCH=riscv64, go list -deps ./internal/decoder/api reports that its internal/native dependency has all files excluded by build constraints, since the native dispatch files are only _amd64/_arm64. The grep only removes paths containing loader|jit|avx|x86|sse, so the new RISC-V unit job will still try to build packages that cannot compile on riscv64.
Useful? React with 👍 / 👎.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #959 +/- ##
==========================================
- Coverage 51.86% 51.24% -0.63%
==========================================
Files 127 170 +43
Lines 10893 14145 +3252
==========================================
+ Hits 5650 7249 +1599
- Misses 4920 6505 +1585
- Partials 323 391 +68
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Old Go toolchains lack the cmd/link change that emits LC_UUID (golang/go#68678, fixed in go1.23). On the current macos-latest image the stricter dyld rejects their test binaries with 'missing LC_UUID load command -> signal: abort trap', failing every package before any test runs and cancelling the rest of the matrix via fail-fast. Exclude the Go<=1.22 x macos-latest combinations; those versions stay covered on the Linux runners, and macOS keeps testing go1.23+.
What
Adds a GitHub Actions workflow (
.github/workflows/test-riscv64.yml) that runs sonic's unit / issue / generic tests on real riscv64 hardware using the RISE project ephemeral runners (runs-on: ubuntu-24.04-riscv).Details
riscv64sonic falls back to its compat path (encoding/json), so the JIT/VM-specific suites don't apply. The workflow runs an explicit riscv64-safe package set and avoids native/JIT-only internal packages.-race, and go1.26 with-racebecause the race detector supportslinux/riscv64starting with go1.26.riscv64, runner, and Go-version flags.Note for maintainers
The RISE runners require their GitHub App to be installed on the
bytedanceorg (or this repo) beforeubuntu-24.04-riscvjobs can be scheduled - see https://riscv-runners.riseproject.dev/ -> "Install the GitHub App". Until then this job will stay queued waiting for a runner.