Skip to content

Add opt-in Linux RISC-V runner builds - #294

Merged
cbartz merged 12 commits into
mainfrom
riscv-dotnet10
Dec 4, 2026
Merged

cbartz merged 12 commits into
mainfrom
riscv-dotnet10

Conversation

@florentianayuwono

@florentianayuwono florentianayuwono commented Nov 24, 2026 •

Copy link
Copy Markdown

What this PR does

Adds an opt-in Linux RISC-V 64 (linux-riscv64) runner package to the fork's CI and releases:

  • patches/runner-main-sdk8-riscv64.patch (upstream main) and patches/runner-sdk8-riscv64.patch (upstream v2.338.2) add the RiscV64 architecture to the runner. They build it with .NET 10 and bundle only Node 24.23.0 (unofficial riscv64 build, checksum-pinned). The release patch also makes Node 12/16/20 actions use Node 24, since Node 20 isn't bundled.
  • build.yml / release.yml add a linux-riscv64 job. It only exists when the repository variable ENABLE_RISCV64_BUILDS is true. Temporarily, until native RISC-V runners are available, the job cross-builds on the x64 runners: the official x64 .NET SDK plus the community riscv64 runtime packs, all checksum-pinned. The package is then smoke-tested under qemu-user. release.yml publishes the archive and its SHA-256.
  • patch_update_main.yml / patch_update_release.yml sync the RISC-V patches against their own recorded baselines, and skip them while RISC-V is disabled.
  • patches/patch-sync-l0.patch adds C# tests for the workflow scripts above.
  • .github/release-note-canonical.md documents usage, the feature flag, limitations (--disableupdate, Node 24 only) and how to switch to a native builder later.

Why we need it

We need to release a riscv64 runner binary so that riscv64 GitHub runners can be spawned (spec requirement R1). Upstream actions/runner doesn't support RISC-V. We have no RISC-V CI runner yet, so cross-building on x64 is the only way to ship today.

The variable is an off switch. riscv64 depends on unofficial .NET and Node builds, and its patches touch many upstream files. Turning the variable off stops a broken riscv64 build from blocking CI, patch sync and releases for the official architectures.

Checklist

  • Changes comply with the project's coding standards and guidelines
  • CONTRIBUTING.md updated: not applicable, no change to the contribution process
  • User-relevant changes documented (.github/release-note-canonical.md)
  • I used AI to assist with preparing this PR
  • I added or updated tests as needed (patches/patch-sync-l0.patch, plus the Node fallback tests inside the release patch)

Test plan

  • x64 L0 with the patches applied: 1,193 passed, including 28 workflow regression cases. An earlier run hit the known ProcessExtensionL0.SuccessReadProcessEnv race, which passes on retry.
  • Cross-build on the x64 self-hosted runners: the whole RISC-V job passed (run 47076555693). The ELF check rejected a planted x64 library, and the Node hot loop caught Node 24.22.3's JIT crash.
  • Release patch: cross-built locally on v2.338.2. config.sh --version reports 2.338.2 and Node v24.23.0.
  • Real hardware: a cross-built package ran live jobs on a SpacemiT K3 board, including actions/checkout, hashFiles and actions/github-script.
  • Not verified: L0 on a native RISC-V machine, and the riscv64 release-publishing path. The first riscv64 release will be smoke-tested on the K3 board before it's announced.

Review focus

Most of the +1.9k lines are .patch files. I've posted a self-review with inline notes on the parts that need human judgement. Suggested split:

  • Workflows and release note (about 360 lines, for a CI reviewer):
    • the job only exists when the variable is on, and riscv64 falls back to amd64 in runs-on;
    • the cross-build SDK step;
    • the qemu smoke test;
    • the riscv64 asset upload.
  • runner-main-sdk8-riscv64.patch (for a C# reviewer). Read it as real code by applying it to its baseline:
    git worktree add /tmp/rv aea9aaa3a0b49933412c6f59d7f05be037207a28   # upstream actions/runner commit
    git -C /tmp/rv apply "$PWD/patches/runner-main-sdk8-riscv64.patch" && git -C /tmp/rv diff
  • runner-sdk8-riscv64.patch: the same changes for v2.338.2. Only the Node 12/16/20 → 24 fallback (NodeUtil, HandlerFactory) needs separate reading.
  • Checksums: don't compare them by eye. The self-review has a script that checks every pin against what its publisher states.

Potential breaking changes

None while ENABLE_RISCV64_BUILDS is unset, which is the default. The existing architectures' jobs, patches and release assets don't change.

New dependencies and workflow changes

  • Community .NET 10 SDK for riscv64 (filipnavara/dotnet-riscv) and unofficial Node riscv64 builds (unofficial-builds.nodejs.org). Both are pinned by SHA-256, and neither is supported by Microsoft or the Node.js project.
  • qemu-user and riscv64 cross libc, apt-installed on the x64 builder for the smoke test only. This is temporary.
  • New repository variable ENABLE_RISCV64_BUILDS.

florentianayuwono and others added 2 commits November 24, 2026 16:04
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update the architecture patches for the current upstream source and keep RISC-V packages on Node 24 only.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@florentianayuwono florentianayuwono self-assigned this Nov 25, 2026
florentianayuwono and others added 3 commits November 26, 2026 14:26
Keep optional RISC-V sync from blocking existing architectures when disabled, and use its own patch baseline when enabled.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Match GitHub Actions string comparison when deciding whether to synchronize the optional RISC-V patches.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move workflow regressions into a patch against an existing upstream test file, inline the fork-specific helpers, and preserve x64 CI when optional tests become stale.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Native RISC-V execution, GitHub Actions acceptance of RISCV64 metadata, runtime behavior, and end-to-end CI/release publishing remain unverified and require human validation on a native builder.

No open issues 🎉

What changed in this PR

Adds experimental, opt-in Linux RISC-V runner builds to the fork’s existing architecture-patch system, covering mirrored upstream main and release sources.

Changes:

  • Adds RISC-V architecture support using community .NET 10 and Node 24, including legacy Node request fallback for release builds.
  • Extends CI and release workflows with checksum-pinned SDK installation, L0 tests, package validation and asset publishing.
  • Adds independent RISC-V patch baselines, workflow regression tests and setup documentation.

Native execution, live GitHub Actions jobs and native CI/release publishing remain unverified.

File Description
patches/​runner-sdk8-riscv64.patch Adds release-source RISC-V support, Node 24 fallback and compatibility tests.
patches/​runner-main-sdk8-riscv64.patch Adds main-source RISC-V architecture, runtime and build support.
patches/​patch-sync-l0.patch Adds regression tests for workflow gates, patch baselines and SDK checksum rejection.
.github/​workflows/​release.yml Adds opt-in RISC-V builds, tests, packaging and release assets.
.github/​workflows/​patch_update_release.yml Synchronizes the enabled RISC-V patch from its own release marker.
.github/​workflows/​patch_update_main.yml Synchronizes the enabled RISC-V patch from its own commit marker.
.github/​workflows/​build.yml Adds opt-in RISC-V CI and workflow regression-test integration.
.github/​release-note-canonical.md Documents prerequisites, build steps, opt-in controls and operational limitations.

Review effort: Balanced

@cbartz cbartz assigned cbartz and unassigned florentianayuwono Nov 27, 2026
@cbartz

cbartz commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Tested this end to end on real riscv64 hardware: the runner registers, picks up jobs and runs them, but the bundled Node 24.22.3 segfaults as soon as JavaScript runs for long, so every JavaScript action crashes. The fix is in Node 24.23.0; we'll wait for its riscv64 build and bump NODE24_VERSION rather than work around it here.

Node issue

  • Every riscv64 Node build from v24.22.0 onwards crashes in Runtime_InstallBaselineCode the first time V8's Sparkplug compiler tiers up a function. v24.21.0 is fine. It reproduces under qemu-user as well as on hardware, so it is not specific to the CPU.
  • Cause: Node 24.22.0 backported V8 0b94a9fd23ba, whose riscv64 hunk of GenerateTailCallToReturnedCode drops the argument pushed for CallRuntime(fn, 1). V8 fixed it two days later in ec2f506f97df, which Node didn't take at the time.
  • Fix: [v24.x] deps: V8: cherry-pick ec2f506f97df nodejs/node#67430 cherry-picks ec2f506f97df, and it is in the v24.23.0 release proposal (2026-11-30, Version 24.23.0 'Krypton' (LTS) nodejs/node#67663, planned for 2026-11-30). The riscv64 binary will then come from unofficial-builds.
  • node --version and trivial scripts exit before Sparkplug kicks in, which is why the current package test doesn't catch this.
  • No good interim option: --no-sparkplug avoids the crash, but Node rejects it in NODE_OPTIONS, so it would need a wrapper around bin/node. Pinning back to 24.21.0 would drop two security releases (24.22.1, 24.22.3).

What was tested

  • Build: the package was cross-built on amd64 from f6e8bc8 (amd64 .NET SDK 10.0.115, plus the riscv64 runtime packs from the community SDK). The runner projects don't use ReadyToRun, so the IL matches a native build, and all native bits come from the community runtime.
  • Hardware: a SpacemiT K3 board running Bianbu 4.0.1 (kernel 6.18, 8 harts).
  • Shell-only workflows: pass.
  • JavaScript actions: to check the rest of the stack, a temporary build wrapped node with --no-sparkplug (note: the wrapper has to be bash -p, because dash drops env vars like INPUT_GITHUB-TOKEN). With it, actions/checkout@v4, actions/github-script@v7 and hashFiles() all pass, including the node20→node24 fallback. 10 more runs (20 jobs) passed back to back.

Suggestions

  • Package test: have the riscv64 package test run real JavaScript, not just --version. Something like node -e 'let s=0;for(let i=0;i<5e6;i++)s+=i' would have caught this.
  • Self-update: the runner tried to self-update to 2.338.2 (no riscv64 package exists, so it failed harmlessly). Should riscv64 runners be documented as needing --disableupdate, so an update can't replace the custom build?
  • Listener crash, FYI: we saw one Runner.Listener SIGSEGV (exit 139) mid-job, with nothing in the managed logs. Most likely it is in the community riscv64 .NET runtime. It hasn't recurred in 20+ jobs since, and crash dumps are enabled to catch it if it does.

AI-generated message.

Node 24.22.x segfaults on riscv64 in V8's Sparkplug JIT
(Runtime_InstallBaselineCode) once JavaScript gets warm, which breaks
every JavaScript action. 24.23.0 carries the upstream V8 fix
(ec2f506f97df). Both riscv64 patches now set NODE24_VERSION to 24.23.0
with the matching unofficial-builds checksum.
@cbartz

cbartz commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Node 24.23.0 is out for riscv64 and fixes the Sparkplug crash, so I pushed 23e9524 to bump both RISC-V patches to it. JavaScript actions now run on real hardware without any workaround.

What changed

  • runner-main-sdk8-riscv64.patch (24.22.3) and runner-sdk8-riscv64.patch (24.22.1) both set NODE24_VERSION="24.23.0". The riscv64 checksum is 832252bc…bae6c42, which matches the unofficial-builds SHASUMS256.txt.
  • The patches are only applied to linux-riscv64 builds, so other architectures are unaffected. The package test's node --version check still compares against NODE24_VERSION.
  • Both patches were regenerated from their recorded baselines (aea9aaa3, v2.338.2), so the only diff is the version and checksum.
  • I added a line to the release note: don't lower the RISC-V node version to match upstream while upstream is still on 24.22.x.

Verification

  • qemu-user: the hot loop that used to crash passes on 24.23.0 with the default JIT (6/6 runs). 24.22.3 still segfaults on the same test.
  • SpacemiT K3 board (Bianbu): used a tarball cross-built from the bumped main patch. The node hot loop passed 10/10 with no flags, and the JSON, WebAssembly and fork() checks also passed.
  • Live job on the board: smoke run with actions/checkout@v4, hashFiles and actions/github-script@v7 all green. It reports node v24.23.0 riscv64 with empty execArgv.

Still open

  • Native build: CI and release publishing on a native riscv64 builder are still untested.
  • Future node bumps: when upstream moves past 24.23.0, the patch-sync job will conflict on the NODE24_VERSION line. The riscv64 checksum needs a manual update at that point anyway.

AI-generated message.

No RISC-V builder exists yet, so the linux-riscv64 job could never run.
Build it on the x64 runners instead with the official x64 .NET SDK plus
the community SDK's riscv64 runtime packs, both checksum-pinned. The
packs are copied dereferenced, since copying their symlinks would
package the x64 runtime.

The RISC-V L0 steps now run only when runner.arch is RISCV64, so the x64
cross-build skips them (they would need emulation) and they come back
on their own once the job moves to a native runner. Meanwhile the
package is smoke-tested under qemu-user, the job fails if any bundled
ELF file is not RISC-V, and a Node hot loop exercises V8's JIT, which
node --version alone does not.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The unconditional matrix include in .github/workflows/build.yml creates a RISC-V job even when ENABLE_RISCV64_BUILDS is unset or false, allowing experimental build failures to break unrelated PR CI; the include in .github/workflows/release.yml likewise creates a RISC-V job when check.outputs.riscv64-enabled is false, allowing experimental build failures to block releases despite RISC-V asset publication being disabled.

2 open issues

Review effort: Balanced

Comment thread .github/workflows/build.yml Resolved
Comment thread .github/workflows/release.yml Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The release note’s native RISC-V guidance is incomplete: changing only runs-on leaves both workflows installing and executing the x64 SDK for linux-riscv64, so SDK setup fails on a native builder before reaching L0.

1 open issue
2 resolved since last review

Review effort: Balanced

Comment thread .github/release-note-canonical.md Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

QEMU smoke tests and a board trial provide evidence for the architecture combining community .NET runtime packs, Node JIT execution, and cross-build packaging. Native RISC-V L0 and the release-publishing path remain unverified and need human validation.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@cbartz
cbartz marked this pull request as ready for review December 3, 2026 12:49

@cbartz cbartz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review to help reviewers. The inline notes mark the places that need human judgement and explain why things are done the way they are. Most of the +1.9k lines are mechanical: three .patch files, mostly csproj runtime-ID additions. See Review focus in the description for how to read them as real code.

Checksums: verify with a script, not by eye

There are three pinned SHA-256 values. Each one appears identically in every file that uses it, which you can check with:

grep -rhoE '[0-9a-f]{64}' .github patches | sort | uniq -c

The script below compares each pin with what its publisher states. Microsoft only publishes SHA-512 for the SDK, so the x64 SDK (about 200 MB) is downloaded once to check both. I ran it on 2026-12-03 and all four checks printed OK.

verify-pins.sh (needs curl, jq, gh)
#!/usr/bin/env bash
# Compare PR 294's pinned checksums with what each publisher states.
set -euo pipefail
fail=0
check() { if [[ "$2" == "$3" ]]; then echo "OK   $1"; else echo "FAIL $1: pinned $2, publisher $3"; fail=1; fi; }

# Node 24.23.0 riscv64: unofficial-builds SHASUMS256.txt
node=$(curl -fsSL https://unofficial-builds.nodejs.org/download/release/v24.23.0/SHASUMS256.txt | awk '$2=="node-v24.23.0-linux-riscv64.tar.gz"{print $1}')
check "node riscv64" 832252bca22aa10bc88fe7ceebf67ae6c40aa206dbcbca78d107c9ef5bae6c42 "$node"

# Community riscv64 SDK: GitHub release asset digest
rv=$(gh api repos/filipnavara/dotnet-riscv/releases/tags/10.0.115 --jq '.assets[]|select(.name=="dotnet-sdk-10.0.115-linux-riscv64.tar.gz")|.digest')
check "riscv64 SDK" sha256:f06bcd3f7cff2781711150ae817190ce67d630b075be0b0aedeb021049c8a0d4 "$rv"

# Official x64 SDK: Microsoft publishes only SHA-512, so download once and compute both
tmp=$(mktemp -d); trap 'rm -rf "$tmp"' EXIT
curl -fsSL -o "$tmp/sdk.tgz" https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.115/dotnet-sdk-10.0.115-linux-x64.tar.gz
ms512=$(curl -fsSL https://builds.dotnet.microsoft.com/dotnet/release-metadata/10.0/releases.json | jq -r '.releases[] | (.sdks // [.sdk])[] | select(.version=="10.0.115") | .files[] | select(.name=="dotnet-sdk-linux-x64.tar.gz") | .hash' | head -1)
check "x64 SDK sha512 vs Microsoft" "$ms512" "$(sha512sum "$tmp/sdk.tgz" | cut -d' ' -f1)"
check "x64 SDK pinned sha256" a2c56c69422f28995196290c068d0e670206f7f873cd0079500774bae8ce3ea4 "$(sha256sum "$tmp/sdk.tgz" | cut -d' ' -f1)"
exit $fail

A checksum only proves we get the same bytes every time. Trusting the content is a separate decision: the riscv64 SDK and runtime packs come from a community build, and the Node binary from the Node.js project's unofficial builds. Both are called out in the release note.

AI-generated message.

Comment thread .github/workflows/build.yml Resolved
Comment thread .github/workflows/build.yml Resolved
Comment thread .github/workflows/build.yml Resolved
Comment thread .github/workflows/build.yml Resolved
Comment thread .github/workflows/build.yml Resolved
Comment thread .github/workflows/patch_update_main.yml Resolved
Comment thread patches/runner-main-sdk8-riscv64.patch Resolved
Comment thread patches/runner-main-sdk8-riscv64.patch Resolved
Comment thread patches/runner-main-sdk8-riscv64.patch Resolved
Comment thread patches/runner-sdk8-riscv64.patch Resolved

@weiiwang01 weiiwang01 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if we still need the ENABLE_RISCV64_BUILDS flag instead of enabling the riscv64 build immediately, as even if the build has some problems, we can always just remove the release and fix them.

@cbartz

cbartz commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

Thanks! We'll keep the variable and set ENABLE_RISCV64_BUILDS=true right after merging, so riscv64 is built and released from the start.

The reason to keep it: a riscv64 failure doesn't produce a bad release we could delete, it blocks other work. A riscv64 patch conflict fails the whole patch-sync job (exit 1), so no architecture gets its patch updates. A failing riscv64 build also stops the release job, so nothing gets published. With the variable we can turn riscv64 off without a code change and keep shipping the other architectures.

AI-generated message.

@cbartz
cbartz merged commit 0bd0387 into main Dec 4, 2026
8 checks passed
@cbartz
cbartz deleted the riscv-dotnet10 branch December 4, 2026 07:03
cbartz added a commit that referenced this pull request Dec 4, 2026
Cherry-pick of #294 plus a CI fix to apply release patches on release branches.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants