From 769b36fd3c49df1690e91a675fcbf4a42fe52966 Mon Sep 17 00:00:00 2001 From: florentianayuwono <76247368+florentianayuwono@users.noreply.github.com> Date: Fri, 4 Dec 2026 14:03:26 +0700 Subject: [PATCH 1/2] feat(riscv64): add RISC-V build support to releases/v2.338.2 Cherry-picked from 0bd03873 (#294) so the release branch can build the linux-riscv64 package. --- .github/release-note-canonical.md | 110 +++ .github/workflows/build.yml | 126 +++- .github/workflows/patch_update_main.yml | 51 +- .github/workflows/patch_update_release.yml | 55 +- .github/workflows/release.yml | 143 +++- patches/patch-sync-l0.patch | 303 ++++++++ patches/runner-main-sdk8-riscv64.patch | 400 +++++++++++ patches/runner-sdk8-riscv64.patch | 779 +++++++++++++++++++++ 8 files changed, 1948 insertions(+), 19 deletions(-) create mode 100644 .github/release-note-canonical.md create mode 100644 patches/patch-sync-l0.patch create mode 100644 patches/runner-main-sdk8-riscv64.patch create mode 100644 patches/runner-sdk8-riscv64.patch diff --git a/.github/release-note-canonical.md b/.github/release-note-canonical.md new file mode 100644 index 00000000000..08e0c158d20 --- /dev/null +++ b/.github/release-note-canonical.md @@ -0,0 +1,110 @@ +## ppc64le and s390x: install the .NET 8 runtime first + +Unlike the other packages, `actions-runner-linux-ppc64le-.tar.gz` and `actions-runner-linux-s390x-.tar.gz` are not self-contained. They need the .NET 8 runtime installed on the machine. Without it, the runner never connects to GitHub. It exits with `You must install .NET to run this application` and keeps restarting. + +On Ubuntu 24.04: + +```bash +sudo apt-get install -y dotnet-runtime-8.0 +``` + +On Ubuntu 26.04, `dotnet-runtime-8.0` is in `ppa:dotnet/backports`: + +```bash +sudo add-apt-repository -y ppa:dotnet/backports +sudo apt-get install -y dotnet-runtime-8.0 +``` + +## Linux ARM32 runner override + +The ARM32 runner build retains the local `RUNNER_IGNORE_ARM32_KILL_SWITCH` environment variable. It is read only from the runner process environment, not from workflow variables or the Actions service. The default ignores service-driven ARM32 deprecation and kill signals; set it to `false` to explicitly re-enable them. + +## Runner package contents + +Package validation now checks that published bundles contain the expected Node runtime and version. Linux ARM32 bundles use Node 22; other Linux bundles use Node 24. + +## Linux RISC-V 64 runner (experimental) + +**The RISC-V package is experimental and provided as is, without any guarantee +that it works. It is best-effort and may lag behind or be dropped from a release +if its build breaks. Do not rely on it for production workloads.** + +The RISC-V runner is an unofficial build using the community +[.NET 10 SDK](https://github.com/filipnavara/dotnet-riscv) and +[Node.js RISC-V builds](https://unofficial-builds.nodejs.org/). Neither is an +official Microsoft-supported RISC-V runner runtime. Track their security +updates and update the SDK version, archive checksum, Node versions and Node +checksums together when upgrading. + +Only Node 24 is bundled. Actions requesting Node 12, 16 or 20 use Node 24 on +RISC-V, even when Node 20 is explicitly enabled. Older actions may need to be +updated for Node 24. Individual actions, container images and tools also need +RISC-V support; JavaScript actions in Alpine job containers are not supported +on non-x64 runners. + +### Build on RISC-V + +Apply `patches/runner-main-sdk8-riscv64.patch` for the current main source, or +`patches/runner-sdk8-riscv64.patch` for the corresponding upstream release +source. The patch names follow the existing architecture-patch convention; +the RISC-V target uses .NET 10, not .NET 8. Apply the workflow-test patch +separately before running L0 tests. + +Install the community SDK and its included runtime packs in a separate +directory, then put its `dotnet` on `PATH`: + +```sh +version=10.0.115 +archive="dotnet-sdk-${version}-linux-riscv64.tar.gz" +curl -fLO "https://github.com/filipnavara/dotnet-riscv/releases/download/${version}/${archive}" +echo "f06bcd3f7cff2781711150ae817190ce67d630b075be0b0aedeb021049c8a0d4 ${archive}" | sha256sum --check +mkdir -p "$HOME/dotnet-riscv64" +tar -xzf "$archive" -C "$HOME/dotnet-riscv64" +export DOTNET_ROOT="$HOME/dotnet-riscv64" +export PATH="$DOTNET_ROOT:$PATH" +# Use runner-sdk8-riscv64.patch instead for the corresponding release. +git apply patches/runner-main-sdk8-riscv64.patch +git apply patches/patch-sync-l0.patch +cd src +./dev.sh layout Release linux-riscv64 +../.github/scripts/strip-bundled-npm.sh ../_layout linux-riscv64 +./dev.sh test +./dev.sh package Release linux-riscv64 +``` + +Keep the SDK separate from .NET 8 so the RISC-V build does not select the +.NET 8 SDK. Node archives are checksum-verified before extraction. The +resulting archive is `_package/actions-runner-linux-riscv64-.tar.gz`. +Refresh `patches/patch-sync-l0.patch` if its upstream test file changes. While +RISC-V is disabled, x64 CI warns and skips those workflow tests if the patch is +stale; when RISC-V is enabled, CI requires the patch to apply. + +### Enable CI and releases + +CI and releases do not schedule RISC-V builds by default. Refresh and check +both RISC-V patches against the current main source and latest upstream release +before setting the repository variable `ENABLE_RISCV64_BUILDS` to `true`. + +Until native RISC-V runners are available (as of 2026-12-03), CI and releases +cross-build the RISC-V package on the x64 builder: the official x64 .NET SDK +plus the community SDK's riscv64 runtime packs, both checksum-pinned. The RISC-V L0 tests are +skipped, because running them would require emulation. Instead, the package is +smoke-tested under qemu-user, and CI fails if any bundled ELF file is not +RISC-V. Once a native Ubuntu 24.04 RISC-V builder is available, change the +`linux-riscv64` build host in `runs-on` to it and replace the cross-build SDK +setup in `build.yml` and `release.yml` with a plain install of the community +SDK (as in "Build on RISC-V" above). The RISC-V L0 steps then run again +automatically on the RISC-V runner. + +Patch synchronization skips RISC-V +while disabled and uses each RISC-V patch's own source marker when enabled. +Enabling the variable does not itself refresh stale patches; update the pinned +Node checksum when porting to a new Node version. The RISC-V patches set +`NODE24_VERSION` to at least 24.23.0, because Node 24.22.x crashes in V8's +Sparkplug JIT on riscv64; do not lower it to match upstream. Enabled releases +run the RISC-V package checks, then publish the archive and its SHA-256 +checksum. + +Configure RISC-V runners with `--disableupdate` and maintain timely upgrades +from this repository's releases; GitHub's official runner download service +does not provide this fork's RISC-V package. diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 41a357425a8..9fbe21c5fb3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: build: strategy: matrix: - runtime: [ linux-s390x, linux-ppc64le, linux-x64, linux-arm64, linux-arm ] + runtime: ${{ fromJSON(vars.ENABLE_RISCV64_BUILDS == 'true' && '["linux-s390x","linux-ppc64le","linux-x64","linux-arm64","linux-arm","linux-riscv64"]' || '["linux-s390x","linux-ppc64le","linux-x64","linux-arm64","linux-arm"]') }} include: - runtime: linux-x64 @@ -39,19 +39,68 @@ jobs: runs_on: s390x patch_tag: s390x - runs-on: [ self-hosted, noble, generic, "${{ matrix.runs_on }}" ] + # linux-riscv64 has no include entry: an unmatched include would add the job + # even when RISC-V builds are disabled. Temporary (added 2026-12-03) until native RISC-V runners + # are available: it falls back to the x64 builder for a cross-build. + runs-on: [ self-hosted, noble, generic, "${{ matrix.runs_on || 'amd64' }}" ] steps: - uses: actions/checkout@v7 - name: Install DotNet SDK + if: matrix.runtime != 'linux-riscv64' run: sudo apt-get update && sudo apt-get install -y dotnet-sdk-8.0 + # Temporary (added 2026-12-03) until native RISC-V runners are available: linux-riscv64 is + # cross-built on x64 because no RISC-V builder exists yet. The RISC-V L0 + # tests are skipped, since running them would require emulation; the + # package is smoke-tested under qemu-user instead. + - name: Install RISC-V cross-build DotNet SDK + if: matrix.runtime == 'linux-riscv64' + run: | + # riscv64-dotnet-setup:start + set -euo pipefail + + # The official x64 SDK builds for linux-riscv64 once it has the community + # riscv64 runtime packs. Those packs are symlinks into the community SDK's + # shared/ and host/ directories, so copy them dereferenced: copying the + # links would package the x64 runtime instead. + version=10.0.115 + x64_sha256=a2c56c69422f28995196290c068d0e670206f7f873cd0079500774bae8ce3ea4 + riscv64_sha256=f06bcd3f7cff2781711150ae817190ce67d630b075be0b0aedeb021049c8a0d4 + x64_archive="${RUNNER_TEMP:?}/dotnet-sdk-${version}-linux-x64.tar.gz" + riscv64_archive="${RUNNER_TEMP}/dotnet-sdk-${version}-linux-riscv64.tar.gz" + sdk_dir="${RUNNER_TEMP}/dotnet-riscv64-cross-${version}" + riscv64_sdk_dir="${RUNNER_TEMP}/dotnet-riscv64-community-${version}" + + curl -fsSL --retry 3 --connect-timeout 30 --max-time 600 -o "$x64_archive" \ + "https://builds.dotnet.microsoft.com/dotnet/Sdk/${version}/dotnet-sdk-${version}-linux-x64.tar.gz" + curl -fsSL --retry 3 --connect-timeout 30 --max-time 600 -o "$riscv64_archive" \ + "https://github.com/filipnavara/dotnet-riscv/releases/download/${version}/dotnet-sdk-${version}-linux-riscv64.tar.gz" + printf '%s %s\n' "$x64_sha256" "$x64_archive" "$riscv64_sha256" "$riscv64_archive" | sha256sum --check + mkdir -p "$sdk_dir" "$riscv64_sdk_dir" + tar -xzf "$x64_archive" -C "$sdk_dir" + tar -xzf "$riscv64_archive" -C "$riscv64_sdk_dir" + for pack in Microsoft.NETCore.App.Runtime Microsoft.NETCore.App.Host Microsoft.AspNetCore.App.Runtime; do + cp -rL "$riscv64_sdk_dir/packs/${pack}.linux-riscv64" "$sdk_dir/packs/" + done + rm -rf "$riscv64_sdk_dir" "$x64_archive" "$riscv64_archive" + + "$sdk_dir/dotnet" --version + echo "$sdk_dir" >> "${GITHUB_PATH:?}" + echo "DOTNET_ROOT=$sdk_dir" >> "${GITHUB_ENV:?}" + # riscv64-dotnet-setup:end + - name: Apply patches - if: matrix.runtime == 'linux-s390x' || matrix.runtime == 'linux-ppc64le' || matrix.runtime == 'linux-arm' + if: matrix.runtime == 'linux-s390x' || matrix.runtime == 'linux-ppc64le' || matrix.runtime == 'linux-arm' || matrix.runtime == 'linux-riscv64' run: | - git apply patches/runner-main-sdk8-${{ matrix.patch_tag }}.patch + if [[ "${{ matrix.runtime }}" == "linux-riscv64" && ( "$GITHUB_REF" == refs/heads/releases/* || "$GITHUB_BASE_REF" == releases/* ) ]]; then + git apply patches/runner-sdk8-riscv64.patch + else + git apply patches/runner-main-sdk8-${{ matrix.patch_tag || 'riscv64' }}.patch + fi - name: Update DotNet required version pin + if: matrix.runtime != 'linux-riscv64' run: | current_version=$( cat src/global.json | jq -r '.sdk.version' ) if [ "${{ matrix.runtime }}" = "linux-arm" ]; then @@ -70,9 +119,51 @@ jobs: ./dev.sh layout Release ${{ matrix.runtime }} working-directory: src + # Temporary (added 2026-12-03) until native RISC-V runners are available: lets the x64 builder + # run the riscv64 Node and runner binaries for the steps below. Invariant + # globalization avoids needing a riscv64 libicu on the host. + - name: Set up RISC-V user-mode emulation + if: matrix.runtime == 'linux-riscv64' + run: | + sudo apt-get update + sudo apt-get install -y qemu-user qemu-user-binfmt libc6-riscv64-cross libstdc++6-riscv64-cross + if [[ ! -e /proc/sys/fs/binfmt_misc/qemu-riscv64 ]]; then + echo "::error::No binfmt_misc handler for riscv64; cannot run the cross-built package." + exit 1 + fi + echo "QEMU_LD_PREFIX=/usr/riscv64-linux-gnu" >> "$GITHUB_ENV" + echo "DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1" >> "$GITHUB_ENV" + # Fork-only: see .github/scripts/strip-bundled-npm.sh. - name: Strip bundled npm and corepack - run: .github/scripts/strip-bundled-npm.sh _layout ${{ matrix.runtime }} + run: | + if [[ "${{ matrix.runtime }}" == "linux-riscv64" ]] && compgen -G '_layout/externals/node20*' > /dev/null; then + echo "::error::RISC-V runner must not bundle Node 20." + exit 1 + fi + .github/scripts/strip-bundled-npm.sh _layout ${{ matrix.runtime }} + + - name: Apply workflow test patch + if: matrix.runtime == 'linux-x64' || (matrix.runtime == 'linux-riscv64' && runner.arch == 'RISCV64') + env: + ENABLE_RISCV64_BUILDS: ${{ vars.ENABLE_RISCV64_BUILDS }} + run: | + # workflow-test-patch:start + apply_workflow_test_patch() { + local enabled="$1" patch="$2" + + if git apply --check "$patch" >/dev/null 2>&1; then + git apply "$patch" + elif [[ "${enabled,,}" == "true" ]]; then + echo "::error::Workflow test patch is stale; refresh it before enabling RISC-V." + return 1 + else + echo "::warning::Workflow test patch is stale; skipping its tests while RISC-V is disabled." + fi + } + # workflow-test-patch:end + + apply_workflow_test_patch "${ENABLE_RISCV64_BUILDS:-}" patches/patch-sync-l0.patch # Run tests - name: L0 @@ -81,7 +172,9 @@ jobs: unset ACTIONS_RUNNER_HOOK_JOB_STARTED ACTIONS_RUNNER_HOOK_JOB_COMPLETED ./dev.sh test working-directory: src - if: matrix.runtime == 'linux-x64' + # linux-riscv64 runs L0 only on a native RISC-V runner; the temporary x64 + # cross-build skips it (see the SDK setup step). + if: matrix.runtime == 'linux-x64' || (matrix.runtime == 'linux-riscv64' && runner.arch == 'RISCV64') # Create runner package tar.gz/zip - name: Package Release @@ -98,6 +191,27 @@ jobs: ./package_test/config.sh --version working-directory: src + # Temporary (added 2026-12-03) until native RISC-V runners are available. + - name: Test package (RISC-V cross-build) + if: github.event_name != 'pull_request' && matrix.runtime == 'linux-riscv64' + run: | + # A cross-build can silently bundle x64 libraries (see the SDK setup step), + # so require every ELF file in the package to target RISC-V (e_machine 243). + bad=0 + while IFS= read -r -d '' file; do + [[ "$(od -An -tx1 -N4 "$file" | tr -d ' \n')" == 7f454c46 ]] || continue + machine=$(od -An -tu2 -j18 -N2 "$file" | tr -d ' ') + if [[ "$machine" != 243 ]]; then + echo "::error::$file is not a RISC-V ELF (e_machine $machine)" + bad=1 + fi + done < <(find package_test -type f -print0) + test "$bad" -eq 0 + # `node --version` exits before V8's JIT tiers up; a hot loop exercises it + # (Node 24.22.x crashed here on riscv64). + package_test/externals/node24/bin/node -e 'let s=0; for (let i=0; i<5e6; i++) s+=i; if (s !== 12499997500000) process.exit(1)' + working-directory: src + # linux-arm produces armv7l (32-bit) binaries that cannot execute on the # arm64 build host directly, so smoke-test the package inside a 32-bit arm container. # On arm64 hosts with native AArch32 support this runs natively; if binfmt/qemu-user diff --git a/.github/workflows/patch_update_main.yml b/.github/workflows/patch_update_main.yml index f085a5bf9ab..cb936a957fd 100644 --- a/.github/workflows/patch_update_main.yml +++ b/.github/workflows/patch_update_main.yml @@ -68,11 +68,56 @@ jobs: - name: Process architectures if: steps.get-commits.outputs.PREVIOUS_COMMIT != '' && steps.get-commits.outputs.PREVIOUS_COMMIT != steps.get-commits.outputs.LATEST_COMMIT id: process-arches + env: + ENABLE_RISCV64_BUILDS: ${{ vars.ENABLE_RISCV64_BUILDS }} run: | + # patch-sync-baseline:start + patch_sync_baseline() { + local architecture="$1" enabled="$2" shared_baseline="$3" patch="$4" kind="$5" + local prefix marker baseline + + if [[ "$architecture" != "riscv64" ]]; then + printf '%s\n' "$shared_baseline" + return 0 + fi + + if [[ "${enabled,,}" != "true" ]]; then + return 0 + fi + + case "$kind" in + commit) prefix="# From upstream commit: " ;; + release) prefix="# From upstream release: " ;; + *) echo "Invalid RISC-V patch marker type: $kind" >&2; return 1 ;; + esac + + if [[ ! -f "$patch" ]]; then + echo "Invalid RISC-V patch marker: missing $patch" >&2 + return 1 + fi + + marker=$(tail -n 1 "$patch") + baseline=${marker#"$prefix"} + if [[ "$marker" != "$prefix"* || -z "$baseline" ]] || + [[ "$kind" == "commit" && ! "$baseline" =~ ^([0-9a-f]{40}|[0-9a-f]{64})$ ]] || + [[ "$kind" == "release" && ! "$baseline" =~ ^v[0-9][0-9A-Za-z.+_-]*$ ]]; then + echo "Invalid RISC-V patch marker in $patch" >&2 + return 1 + fi + + printf '%s\n' "$baseline" + } + # patch-sync-baseline:end + mkdir -p patches touch successful_arches.txt - for arch in ppc64le s390x arm; do + for arch in ppc64le s390x arm riscv64; do + patch_baseline=$(patch_sync_baseline "$arch" "${ENABLE_RISCV64_BUILDS:-}" "${{ steps.get-commits.outputs.PREVIOUS_COMMIT }}" "patches/runner-main-sdk8-$arch.patch" commit) + if [[ -z "$patch_baseline" ]]; then + echo "Skipping $arch while RISC-V builds are disabled" + continue + fi echo "Processing $arch..." cd upstream-runner @@ -82,13 +127,13 @@ jobs: # Check if previous patch exists if [ ! -f "../patches/runner-main-sdk8-$arch.patch" ] || \ - ! grep -q "${{ steps.get-commits.outputs.PREVIOUS_COMMIT }}" "../patches/runner-main-sdk8-$arch.patch"; then + ! grep -Fq -- "$patch_baseline" "../patches/runner-main-sdk8-$arch.patch"; then echo "::error::No valid previous patch for $arch" exit 1 fi # Apply previous patch to previous commit - git checkout ${{ steps.get-commits.outputs.PREVIOUS_COMMIT }} + git checkout "$patch_baseline" if ! git apply --check --whitespace=nowarn "../patches/runner-main-sdk8-$arch.patch"; then echo "::error::Previous patch application failed for $arch" exit 1 diff --git a/.github/workflows/patch_update_release.yml b/.github/workflows/patch_update_release.yml index 4afb159405d..8303c3346f1 100644 --- a/.github/workflows/patch_update_release.yml +++ b/.github/workflows/patch_update_release.yml @@ -66,11 +66,56 @@ jobs: - name: Process architectures if: steps.get-tags.outputs.PREVIOUS_TAG != '' && steps.get-tags.outputs.PREVIOUS_TAG != steps.get-tags.outputs.LATEST_TAG id: process-arches + env: + ENABLE_RISCV64_BUILDS: ${{ vars.ENABLE_RISCV64_BUILDS }} run: | + # patch-sync-baseline:start + patch_sync_baseline() { + local architecture="$1" enabled="$2" shared_baseline="$3" patch="$4" kind="$5" + local prefix marker baseline + + if [[ "$architecture" != "riscv64" ]]; then + printf '%s\n' "$shared_baseline" + return 0 + fi + + if [[ "${enabled,,}" != "true" ]]; then + return 0 + fi + + case "$kind" in + commit) prefix="# From upstream commit: " ;; + release) prefix="# From upstream release: " ;; + *) echo "Invalid RISC-V patch marker type: $kind" >&2; return 1 ;; + esac + + if [[ ! -f "$patch" ]]; then + echo "Invalid RISC-V patch marker: missing $patch" >&2 + return 1 + fi + + marker=$(tail -n 1 "$patch") + baseline=${marker#"$prefix"} + if [[ "$marker" != "$prefix"* || -z "$baseline" ]] || + [[ "$kind" == "commit" && ! "$baseline" =~ ^([0-9a-f]{40}|[0-9a-f]{64})$ ]] || + [[ "$kind" == "release" && ! "$baseline" =~ ^v[0-9][0-9A-Za-z.+_-]*$ ]]; then + echo "Invalid RISC-V patch marker in $patch" >&2 + return 1 + fi + + printf '%s\n' "$baseline" + } + # patch-sync-baseline:end + mkdir -p patches touch successful_arches.txt - for arch in ppc64le s390x arm; do + for arch in ppc64le s390x arm riscv64; do + patch_baseline=$(patch_sync_baseline "$arch" "${ENABLE_RISCV64_BUILDS:-}" "${{ steps.get-tags.outputs.PREVIOUS_TAG }}" "patches/runner-sdk8-$arch.patch" release) + if [[ -z "$patch_baseline" ]]; then + echo "Skipping $arch while RISC-V builds are disabled" + continue + fi echo "Processing $arch..." cd upstream-runner @@ -96,16 +141,16 @@ jobs: # Check if previous patch exists if [ ! -f "../patches/runner-sdk8-$arch.patch" ] || \ - ! grep -q "${{ steps.get-tags.outputs.PREVIOUS_TAG }}" "../patches/runner-sdk8-$arch.patch"; then - echo "::error::No valid previous patch for $arch — patch file missing or does not reference ${{ steps.get-tags.outputs.PREVIOUS_TAG }}" + ! grep -Fq -- "$patch_baseline" "../patches/runner-sdk8-$arch.patch"; then + echo "::error::No valid previous patch for $arch — patch file missing or does not reference $patch_baseline" cd .. exit 1 fi # Apply previous patch to previous release - git checkout ${{ steps.get-tags.outputs.PREVIOUS_TAG }} + git checkout "$patch_baseline" if ! git apply --check --whitespace=nowarn "../patches/runner-sdk8-$arch.patch"; then - echo "::error::Previous patch application failed for $arch — patch does not apply cleanly to ${{ steps.get-tags.outputs.PREVIOUS_TAG }}" + echo "::error::Previous patch application failed for $arch — patch does not apply cleanly to $patch_baseline" cd .. exit 1 fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6f8293d56fb..d319ef676d1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,6 +15,8 @@ jobs: check: if: startsWith(github.ref, 'refs/heads/releases/') || github.ref == 'refs/heads/main' runs-on: ubuntu-latest + outputs: + riscv64-enabled: ${{ vars.ENABLE_RISCV64_BUILDS == 'true' }} steps: - uses: actions/checkout@v7 @@ -55,9 +57,11 @@ jobs: linux-s390x-sha: ${{ steps.sha.outputs.linux-s390x-sha256 }} linux-ppc64le-sha: ${{ steps.sha.outputs.linux-ppc64le-sha256 }} linux-arm-sha: ${{ steps.sha.outputs.linux-arm-sha256 }} + linux-riscv64-sha: ${{ steps.sha.outputs.linux-riscv64-sha256 }} + riscv64-enabled: ${{ needs.check.outputs.riscv64-enabled }} strategy: matrix: - runtime: [ linux-s390x, linux-ppc64le, linux-x64, linux-arm64, linux-arm ] + runtime: ${{ fromJSON(needs.check.outputs.riscv64-enabled == 'true' && '["linux-s390x","linux-ppc64le","linux-x64","linux-arm64","linux-arm","linux-riscv64"]' || '["linux-s390x","linux-ppc64le","linux-x64","linux-arm64","linux-arm"]') }} include: - runtime: linux-s390x runs_on: s390x @@ -77,19 +81,68 @@ jobs: runs_on: arm64 patch_tag: arm - runs-on: [ self-hosted, noble, generic, "${{ matrix.runs_on }}" ] + # linux-riscv64 has no include entry: an unmatched include would add the job + # even when RISC-V builds are disabled. Temporary (added 2026-12-03) until native RISC-V runners + # are available: it falls back to the x64 builder for a cross-build. + runs-on: [ self-hosted, noble, generic, "${{ matrix.runs_on || 'amd64' }}" ] steps: - uses: actions/checkout@v7 - name: Install DotNet SDK + if: matrix.runtime != 'linux-riscv64' run: sudo apt-get update && sudo apt-get install -y dotnet-sdk-8.0 + # Temporary (added 2026-12-03) until native RISC-V runners are available: linux-riscv64 is + # cross-built on x64 because no RISC-V builder exists yet. The RISC-V L0 + # tests are skipped, since running them would require emulation; the + # package is smoke-tested under qemu-user instead. + - name: Install RISC-V cross-build DotNet SDK + if: matrix.runtime == 'linux-riscv64' + run: | + # riscv64-dotnet-setup:start + set -euo pipefail + + # The official x64 SDK builds for linux-riscv64 once it has the community + # riscv64 runtime packs. Those packs are symlinks into the community SDK's + # shared/ and host/ directories, so copy them dereferenced: copying the + # links would package the x64 runtime instead. + version=10.0.115 + x64_sha256=a2c56c69422f28995196290c068d0e670206f7f873cd0079500774bae8ce3ea4 + riscv64_sha256=f06bcd3f7cff2781711150ae817190ce67d630b075be0b0aedeb021049c8a0d4 + x64_archive="${RUNNER_TEMP:?}/dotnet-sdk-${version}-linux-x64.tar.gz" + riscv64_archive="${RUNNER_TEMP}/dotnet-sdk-${version}-linux-riscv64.tar.gz" + sdk_dir="${RUNNER_TEMP}/dotnet-riscv64-cross-${version}" + riscv64_sdk_dir="${RUNNER_TEMP}/dotnet-riscv64-community-${version}" + + curl -fsSL --retry 3 --connect-timeout 30 --max-time 600 -o "$x64_archive" \ + "https://builds.dotnet.microsoft.com/dotnet/Sdk/${version}/dotnet-sdk-${version}-linux-x64.tar.gz" + curl -fsSL --retry 3 --connect-timeout 30 --max-time 600 -o "$riscv64_archive" \ + "https://github.com/filipnavara/dotnet-riscv/releases/download/${version}/dotnet-sdk-${version}-linux-riscv64.tar.gz" + printf '%s %s\n' "$x64_sha256" "$x64_archive" "$riscv64_sha256" "$riscv64_archive" | sha256sum --check + mkdir -p "$sdk_dir" "$riscv64_sdk_dir" + tar -xzf "$x64_archive" -C "$sdk_dir" + tar -xzf "$riscv64_archive" -C "$riscv64_sdk_dir" + for pack in Microsoft.NETCore.App.Runtime Microsoft.NETCore.App.Host Microsoft.AspNetCore.App.Runtime; do + cp -rL "$riscv64_sdk_dir/packs/${pack}.linux-riscv64" "$sdk_dir/packs/" + done + rm -rf "$riscv64_sdk_dir" "$x64_archive" "$riscv64_archive" + + "$sdk_dir/dotnet" --version + echo "$sdk_dir" >> "${GITHUB_PATH:?}" + echo "DOTNET_ROOT=$sdk_dir" >> "${GITHUB_ENV:?}" + # riscv64-dotnet-setup:end + - name: Apply patches - if: matrix.runtime == 'linux-s390x' || matrix.runtime == 'linux-ppc64le' || matrix.runtime == 'linux-arm' + if: matrix.runtime == 'linux-s390x' || matrix.runtime == 'linux-ppc64le' || matrix.runtime == 'linux-arm' || matrix.runtime == 'linux-riscv64' run: | - git apply patches/runner-sdk8-${{ matrix.patch_tag }}.patch + if [[ "${{ matrix.runtime }}" == "linux-riscv64" && "$GITHUB_REF" == "refs/heads/main" ]]; then + git apply patches/runner-main-sdk8-riscv64.patch + else + git apply patches/runner-sdk8-${{ matrix.patch_tag || 'riscv64' }}.patch + fi - name: Update DotNet required version pin + if: matrix.runtime != 'linux-riscv64' run: | current_version=$( cat src/global.json | jq -r '.sdk.version' ) if [ "${{ matrix.runtime }}" = "linux-arm" ]; then @@ -108,9 +161,42 @@ jobs: ./dev.sh layout Release ${{ matrix.runtime }} working-directory: src + # Temporary (added 2026-12-03) until native RISC-V runners are available: lets the x64 builder + # run the riscv64 Node and runner binaries for the steps below. Invariant + # globalization avoids needing a riscv64 libicu on the host. + - name: Set up RISC-V user-mode emulation + if: matrix.runtime == 'linux-riscv64' + run: | + sudo apt-get update + sudo apt-get install -y qemu-user qemu-user-binfmt libc6-riscv64-cross libstdc++6-riscv64-cross + if [[ ! -e /proc/sys/fs/binfmt_misc/qemu-riscv64 ]]; then + echo "::error::No binfmt_misc handler for riscv64; cannot run the cross-built package." + exit 1 + fi + echo "QEMU_LD_PREFIX=/usr/riscv64-linux-gnu" >> "$GITHUB_ENV" + echo "DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1" >> "$GITHUB_ENV" + # Fork-only: see .github/scripts/strip-bundled-npm.sh. - name: Strip bundled npm and corepack - run: .github/scripts/strip-bundled-npm.sh _layout ${{ matrix.runtime }} + run: | + if [[ "${{ matrix.runtime }}" == "linux-riscv64" ]] && compgen -G '_layout/externals/node20*' > /dev/null; then + echo "::error::RISC-V runner must not bundle Node 20." + exit 1 + fi + .github/scripts/strip-bundled-npm.sh _layout ${{ matrix.runtime }} + + # Runs only on a native RISC-V runner; the temporary x64 cross-build skips + # L0 (see the SDK setup step). + - name: Apply workflow test patch + if: matrix.runtime == 'linux-riscv64' && runner.arch == 'RISCV64' + run: git apply patches/patch-sync-l0.patch + + - name: RISC-V L0 + if: matrix.runtime == 'linux-riscv64' && runner.arch == 'RISCV64' + working-directory: src + run: | + unset ACTIONS_RUNNER_HOOK_JOB_STARTED ACTIONS_RUNNER_HOOK_JOB_COMPLETED + ./dev.sh test # Create runner package tar.gz/zip - name: Package Release @@ -127,6 +213,27 @@ jobs: ./package_test/config.sh --version working-directory: src + # Temporary (added 2026-12-03) until native RISC-V runners are available. + - name: Test package (RISC-V cross-build) + if: github.event_name != 'pull_request' && matrix.runtime == 'linux-riscv64' + run: | + # A cross-build can silently bundle x64 libraries (see the SDK setup step), + # so require every ELF file in the package to target RISC-V (e_machine 243). + bad=0 + while IFS= read -r -d '' file; do + [[ "$(od -An -tx1 -N4 "$file" | tr -d ' \n')" == 7f454c46 ]] || continue + machine=$(od -An -tu2 -j18 -N2 "$file" | tr -d ' ') + if [[ "$machine" != 243 ]]; then + echo "::error::$file is not a RISC-V ELF (e_machine $machine)" + bad=1 + fi + done < <(find package_test -type f -print0) + test "$bad" -eq 0 + # `node --version` exits before V8's JIT tiers up; a hot loop exercises it + # (Node 24.22.x crashed here on riscv64). + package_test/externals/node24/bin/node -e 'let s=0; for (let i=0; i<5e6; i++) s+=i; if (s !== 12499997500000) process.exit(1)' + working-directory: src + # linux-arm produces armv7l (32-bit) binaries that cannot execute on the # arm64 build host directly, so smoke-test the package inside a 32-bit arm container. # On arm64 hosts with native AArch32 support this runs natively; if binfmt/qemu-user @@ -203,6 +310,13 @@ jobs: name: runner-packages-linux-arm path: ./ + - name: Download Artifact (linux-riscv64) + if: needs.build.outputs.riscv64-enabled == 'true' + uses: actions/download-artifact@v4 + with: + name: runner-packages-linux-riscv64 + path: ./ + # Create ReleaseNote file - name: Create ReleaseNote id: releaseNote @@ -218,6 +332,9 @@ jobs: releaseNote = releaseNote.replace(//g, '${{needs.build.outputs.linux-ppc64le-sha}}') releaseNote = releaseNote.replace(//g, '${{needs.build.outputs.linux-s390x-sha}}') releaseNote = releaseNote.replace(//g, '${{needs.build.outputs.linux-arm-sha}}') + if ('${{ needs.build.outputs.riscv64-enabled }}' === 'true') { + releaseNote += `\n\n## Linux RISC-V 64 (experimental, no guarantee it works)\n\nAsset: \`actions-runner-linux-riscv64-${runnerVersion}.tar.gz\`\n\nSHA-256: \`${{ needs.build.outputs.linux-riscv64-sha }}\`\n` + } console.log(releaseNote) core.setOutput('version', runnerVersion); core.setOutput('note', releaseNote); @@ -231,6 +348,11 @@ jobs: echo "${{needs.build.outputs.linux-s390x-sha}} actions-runner-linux-s390x-${{ steps.releaseNote.outputs.version }}.tar.gz" | shasum -a 256 -c echo "${{needs.build.outputs.linux-arm-sha}} actions-runner-linux-arm-${{ steps.releaseNote.outputs.version }}.tar.gz" | shasum -a 256 -c + - name: Validate RISC-V Package HASH + if: needs.build.outputs.riscv64-enabled == 'true' + run: | + echo "${{ needs.build.outputs.linux-riscv64-sha }} actions-runner-linux-riscv64-${{ steps.releaseNote.outputs.version }}.tar.gz" | shasum -a 256 -c + # Create GitHub release - uses: actions/create-release@master id: createRelease @@ -293,6 +415,17 @@ jobs: asset_name: actions-runner-linux-arm-${{ steps.releaseNote.outputs.version }}.tar.gz asset_content_type: application/octet-stream + - name: Upload Release Asset (linux-riscv64) + if: needs.build.outputs.riscv64-enabled == 'true' + uses: actions/upload-release-asset@v1.0.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.createRelease.outputs.upload_url }} + asset_path: ${{ github.workspace }}/actions-runner-linux-riscv64-${{ steps.releaseNote.outputs.version }}.tar.gz + asset_name: actions-runner-linux-riscv64-${{ steps.releaseNote.outputs.version }}.tar.gz + asset_content_type: application/octet-stream + - uses: mattermost/action-mattermost-notify@master if: ${{ failure() }} with: diff --git a/patches/patch-sync-l0.patch b/patches/patch-sync-l0.patch new file mode 100644 index 00000000000..4e0ef5beb7c --- /dev/null +++ b/patches/patch-sync-l0.patch @@ -0,0 +1,303 @@ +diff --git a/src/Test/L0/DotnetsdkDownloadScriptL0.cs b/src/Test/L0/DotnetsdkDownloadScriptL0.cs +index 9d3fbd2..be17541 100644 +--- a/src/Test/L0/DotnetsdkDownloadScriptL0.cs ++++ b/src/Test/L0/DotnetsdkDownloadScriptL0.cs +@@ -7,4 +7,298 @@ using System; + namespace GitHub.Runner.Common.Tests + { ++#if OS_LINUX ++ public sealed class PatchSyncL0 ++ { ++ private static readonly string[] SyncWorkflows = { "patch_update_main.yml", "patch_update_release.yml" }; ++ ++ [Theory] ++ [InlineData("")] ++ [InlineData("false")] ++ [InlineData("true ")] ++ [InlineData("1")] ++ [Trait("Level", "L0")] ++ [Trait("Category", "Common")] ++ public void DisabledRiscVDoesNotRequireAPatch(string enabled) ++ { ++ foreach (string workflow in SyncWorkflows) ++ { ++ var result = GetBaseline(workflow, "riscv64", enabled, "global", "missing.patch", "commit"); ++ ++ Assert.Equal(0, result.ExitCode); ++ Assert.Equal(string.Empty, result.Output); ++ } ++ } ++ ++ [Theory] ++ [InlineData("ppc64le", "false")] ++ [InlineData("s390x", "true")] ++ [InlineData("arm", "")] ++ [Trait("Level", "L0")] ++ [Trait("Category", "Common")] ++ public void ExistingArchitecturesKeepTheSharedBaseline(string architecture, string enabled) ++ { ++ foreach (string workflow in SyncWorkflows) ++ { ++ var result = GetBaseline(workflow, architecture, enabled, "global", "missing.patch", "commit"); ++ ++ Assert.Equal(0, result.ExitCode); ++ Assert.Equal("global", result.Output); ++ } ++ } ++ ++ [Theory] ++ [InlineData("true", "commit", "# From upstream commit: 0123456789abcdef0123456789abcdef01234567", "0123456789abcdef0123456789abcdef01234567")] ++ [InlineData("TRUE", "commit", "# From upstream commit: 0123456789abcdef0123456789abcdef01234567", "0123456789abcdef0123456789abcdef01234567")] ++ [InlineData("True", "release", "# From upstream release: v2.338.2", "v2.338.2")] ++ [InlineData("tRuE", "release", "# From upstream release: v2.338.2", "v2.338.2")] ++ [InlineData("true", "commit", "# From upstream commit: 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef")] ++ [Trait("Level", "L0")] ++ [Trait("Category", "Common")] ++ public void EnabledRiscVUsesItsOwnPatchBaseline(string enabled, string kind, string marker, string expected) ++ { ++ string patch = Path.GetTempFileName(); ++ try ++ { ++ File.WriteAllText(patch, $"diff --git a/file b/file\n{marker}\n"); ++ ++ foreach (string workflow in SyncWorkflows) ++ { ++ var result = GetBaseline(workflow, "riscv64", enabled, "newer-global", patch, kind); ++ ++ Assert.Equal(0, result.ExitCode); ++ Assert.Equal(expected, result.Output); ++ } ++ } ++ finally ++ { ++ File.Delete(patch); ++ } ++ } ++ ++ [Theory] ++ [InlineData("commit", "# From upstream release: v2.338.2")] ++ [InlineData("commit", "# From upstream commit: not-a-commit")] ++ [InlineData("release", "# From upstream release: ")] ++ [InlineData("release", "# From upstream release: -not-a-tag")] ++ [Trait("Level", "L0")] ++ [Trait("Category", "Common")] ++ public void EnabledRiscVRejectsInvalidPatchMarkers(string kind, string marker) ++ { ++ string patch = Path.GetTempFileName(); ++ try ++ { ++ File.WriteAllText(patch, $"{marker}\n"); ++ ++ foreach (string workflow in SyncWorkflows) ++ { ++ var result = GetBaseline(workflow, "riscv64", "true", "global", patch, kind); ++ ++ Assert.NotEqual(0, result.ExitCode); ++ Assert.Contains("Invalid RISC-V patch marker", result.Error); ++ } ++ } ++ finally ++ { ++ File.Delete(patch); ++ } ++ } ++ ++ [Fact] ++ [Trait("Level", "L0")] ++ [Trait("Category", "Common")] ++ public void EnabledRiscVRejectsMissingPatch() ++ { ++ string patch = Path.Combine(Path.GetTempPath(), $"missing-{Guid.NewGuid():N}.patch"); ++ ++ foreach (string workflow in SyncWorkflows) ++ { ++ var result = GetBaseline(workflow, "riscv64", "true", "global", patch, "commit"); ++ ++ Assert.NotEqual(0, result.ExitCode); ++ Assert.Contains("Invalid RISC-V patch marker", result.Error); ++ } ++ } ++ ++ [Theory] ++ [InlineData("")] ++ [InlineData("false")] ++ [InlineData("true ")] ++ [InlineData("1")] ++ [Trait("Level", "L0")] ++ [Trait("Category", "Common")] ++ public void StaleWorkflowTestPatchDoesNotBlockDisabledRiscV(string enabled) ++ { ++ string temp = CreateTestPatchFixture("changed\n"); ++ try ++ { ++ var result = ApplyTestPatch(temp, enabled); ++ ++ Assert.Equal(0, result.ExitCode); ++ Assert.Contains("::warning::", result.Output); ++ Assert.Equal("changed\n", File.ReadAllText(Path.Combine(temp, "input"))); ++ } ++ finally ++ { ++ Directory.Delete(temp, recursive: true); ++ } ++ } ++ ++ [Theory] ++ [InlineData("true")] ++ [InlineData("TRUE")] ++ [InlineData("True")] ++ [Trait("Level", "L0")] ++ [Trait("Category", "Common")] ++ public void StaleWorkflowTestPatchBlocksEnabledRiscV(string enabled) ++ { ++ string temp = CreateTestPatchFixture("changed\n"); ++ try ++ { ++ var result = ApplyTestPatch(temp, enabled); ++ ++ Assert.NotEqual(0, result.ExitCode); ++ Assert.Contains("::error::", result.Output); ++ Assert.Equal("changed\n", File.ReadAllText(Path.Combine(temp, "input"))); ++ } ++ finally ++ { ++ Directory.Delete(temp, recursive: true); ++ } ++ } ++ ++ [Theory] ++ [InlineData("")] ++ [InlineData("TRUE")] ++ [Trait("Level", "L0")] ++ [Trait("Category", "Common")] ++ public void CompatibleWorkflowTestPatchIsApplied(string enabled) ++ { ++ string temp = CreateTestPatchFixture("before\n"); ++ try ++ { ++ var result = ApplyTestPatch(temp, enabled); ++ ++ Assert.Equal(0, result.ExitCode); ++ Assert.Equal("after\n", File.ReadAllText(Path.Combine(temp, "input"))); ++ } ++ finally ++ { ++ Directory.Delete(temp, recursive: true); ++ } ++ } ++ ++ [Theory] ++ [InlineData("build.yml")] ++ [InlineData("release.yml")] ++ [Trait("Level", "L0")] ++ [Trait("Category", "Common")] ++ public void DotnetSetupRejectsUnverifiedArchives(string workflow) ++ { ++ string temp = Path.Combine(Path.GetTempPath(), $"riscv-dotnet-{Guid.NewGuid():N}"); ++ string tools = Path.Combine(temp, "bin"); ++ string githubEnv = Path.Combine(temp, "github-env"); ++ string githubPath = Path.Combine(temp, "github-path"); ++ Directory.CreateDirectory(tools); ++ ++ try ++ { ++ string curl = Path.Combine(tools, "curl"); ++ File.WriteAllText(curl, "#!/bin/sh\nwhile [ \"$#\" -gt 0 ]; do\n if [ \"$1\" = -o ]; then shift; printf corrupt > \"$1\"; exit 0; fi\n shift\ndone\nexit 1\n"); ++ if (!OperatingSystem.IsWindows()) ++ { ++ File.SetUnixFileMode(curl, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute); ++ } ++ ++ string script = GetWorkflowBlock(workflow, "riscv64-dotnet-setup"); ++ var result = RunShell(script, Array.Empty(), startInfo => ++ { ++ startInfo.Environment["PATH"] = $"{tools}:{Environment.GetEnvironmentVariable("PATH")}"; ++ startInfo.Environment["RUNNER_TEMP"] = temp; ++ startInfo.Environment["GITHUB_ENV"] = githubEnv; ++ startInfo.Environment["GITHUB_PATH"] = githubPath; ++ }); ++ ++ Assert.NotEqual(0, result.ExitCode); ++ Assert.Contains("FAILED", result.Output); ++ Assert.False(File.Exists(githubEnv)); ++ Assert.False(File.Exists(githubPath)); ++ Assert.False(Directory.Exists(Path.Combine(temp, "dotnet-riscv64-cross-10.0.115"))); ++ } ++ finally ++ { ++ Directory.Delete(temp, recursive: true); ++ } ++ } ++ ++ private static (int ExitCode, string Output, string Error) GetBaseline(string workflow, params string[] arguments) ++ { ++ string script = GetWorkflowBlock(workflow, "patch-sync-baseline"); ++ return RunShell($"{script}\npatch_sync_baseline \"$@\"", arguments); ++ } ++ ++ private static string CreateTestPatchFixture(string contents) ++ { ++ string temp = Path.Combine(Path.GetTempPath(), $"workflow-test-patch-{Guid.NewGuid():N}"); ++ Directory.CreateDirectory(temp); ++ File.WriteAllText(Path.Combine(temp, "input"), contents); ++ File.WriteAllText(Path.Combine(temp, "test.patch"), "diff --git a/input b/input\n--- a/input\n+++ b/input\n@@ -1 +1 @@\n-before\n+after\n"); ++ return temp; ++ } ++ ++ private static (int ExitCode, string Output, string Error) ApplyTestPatch(string temp, string enabled) ++ { ++ string script = GetWorkflowBlock("build.yml", "workflow-test-patch"); ++ return RunShell($"{script}\napply_workflow_test_patch \"$@\"", new[] { enabled, "test.patch" }, startInfo => ++ { ++ startInfo.WorkingDirectory = temp; ++ }); ++ } ++ ++ private static string GetWorkflowBlock(string workflow, string marker) ++ { ++ string path = Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), "..", ".github", "workflows", workflow)); ++ string[] lines = File.ReadAllLines(path); ++ int start = Array.FindIndex(lines, line => line.Trim() == $"# {marker}:start"); ++ int end = Array.FindIndex(lines, line => line.Trim() == $"# {marker}:end"); ++ Assert.True(start >= 0 && end > start, $"Missing {marker} block in {workflow}"); ++ ++ var script = new System.Text.StringBuilder(); ++ for (int i = start + 1; i < end; i++) ++ { ++ script.AppendLine(lines[i].TrimStart()); ++ } ++ ++ return script.ToString(); ++ } ++ ++ private static (int ExitCode, string Output, string Error) RunShell( ++ string script, ++ string[] arguments, ++ Action configure = null) ++ { ++ var startInfo = new System.Diagnostics.ProcessStartInfo("bash") ++ { ++ RedirectStandardOutput = true, ++ RedirectStandardError = true, ++ UseShellExecute = false, ++ }; ++ startInfo.ArgumentList.Add("-c"); ++ startInfo.ArgumentList.Add($"set -euo pipefail\n{script}"); ++ startInfo.ArgumentList.Add("workflow-test"); ++ foreach (string argument in arguments) ++ { ++ startInfo.ArgumentList.Add(argument); ++ } ++ ++ configure?.Invoke(startInfo); ++ using var process = System.Diagnostics.Process.Start(startInfo); ++ string output = process.StandardOutput.ReadToEnd().TrimEnd('\r', '\n'); ++ string error = process.StandardError.ReadToEnd(); ++ process.WaitForExit(); ++ return (process.ExitCode, output, error); ++ } ++ } ++#endif ++ + public sealed class DotnetsdkDownloadScriptL0 + { diff --git a/patches/runner-main-sdk8-riscv64.patch b/patches/runner-main-sdk8-riscv64.patch new file mode 100644 index 00000000000..7f01f30da69 --- /dev/null +++ b/patches/runner-main-sdk8-riscv64.patch @@ -0,0 +1,400 @@ +diff --git a/src/Directory.Build.props b/src/Directory.Build.props +index 5613d3c..726735c 100644 +--- a/src/Directory.Build.props ++++ b/src/Directory.Build.props +@@ -41,6 +41,10 @@ + + $(DefineConstants);ARM64 + ++ ++ $(DefineConstants);RISCV64 ++ $(WarningsNotAsErrors);NU1510 ++ + + + +diff --git a/src/Misc/externals.sh b/src/Misc/externals.sh +index ccb4e7c..af85bc1 100755 +--- a/src/Misc/externals.sh ++++ b/src/Misc/externals.sh +@@ -4,9 +4,10 @@ PRECACHE=$2 + + NODE_URL=https://nodejs.org/dist + NODE_ALPINE_URL=https://github.com/actions/alpine_nodejs/releases/download ++NODE_UNOFFICIAL_URL=https://unofficial-builds.nodejs.org/download/release + # When you update Node versions you must also create a new release of alpine_nodejs at that updated version. + # Follow the instructions here: https://github.com/actions/alpine_nodejs?tab=readme-ov-file#getting-started +-NODE24_VERSION="24.22.3" ++NODE24_VERSION="24.23.0" + + get_abs_path() { + # exploits the fact that pwd will print abs path when no args +@@ -29,10 +30,19 @@ function checkRC() { + fi + } + ++function verifyChecksum() { ++ local file=$1 ++ local checksum=$2 ++ if [[ -n "$checksum" ]]; then ++ printf '%s %s\n' "$checksum" "$file" | sha256sum --check --status || failed "SHA-256 mismatch for $file" ++ fi ++} ++ + function acquireExternalTool() { + local download_source=$1 # E.g. https://github.com/microsoft/vswhere/releases/download/2.6.7/vswhere.exe + local target_dir="$LAYOUT_DIR/externals/$2" # E.g. $LAYOUT_DIR/externals/vswhere + local fix_nested_dir=$3 # Flag that indicates whether to move nested contents up one directory. ++ local checksum=$4 + + # Extract the portion of the URL after the protocol. E.g. github.com/microsoft/vswhere/releases/download/2.6.7/vswhere.exe + local relative_url="${download_source#*://}" +@@ -45,6 +55,7 @@ function acquireExternalTool() { + if [[ "$PRECACHE" != "" ]]; then + if [ -f "$download_target" ]; then + echo "Download exists: $download_basename" ++ verifyChecksum "$download_target" "$checksum" + else + # Delete any previous partial file. + local partial_target="$DOWNLOAD_DIR/partial/$download_basename" +@@ -73,6 +84,8 @@ function acquireExternalTool() { + curl -fSL --retry 3 --retry-all-errors -o "$partial_target" "$download_source" 2>"${download_target}_download.log" || checkRC 'curl' + fi + ++ verifyChecksum "$partial_target" "$checksum" ++ + # Move the partial file to the download target. + mv "$partial_target" "$download_target" || checkRC 'mv' + +@@ -94,6 +107,7 @@ function acquireExternalTool() { + fi + fi + else ++ verifyChecksum "$download_target" "$checksum" + # Extract to layout. + mkdir -p "$target_dir" || checkRC 'mkdir' + local nested_dir="" +@@ -172,3 +186,7 @@ fi + if [[ "$PACKAGERUNTIME" == "linux-arm64" ]]; then + acquireExternalTool "$NODE_URL/v${NODE24_VERSION}/node-v${NODE24_VERSION}-linux-arm64.tar.gz" node24 fix_nested_dir + fi ++ ++if [[ "$PACKAGERUNTIME" == "linux-riscv64" ]]; then ++ acquireExternalTool "$NODE_UNOFFICIAL_URL/v${NODE24_VERSION}/node-v${NODE24_VERSION}-linux-riscv64.tar.gz" node24 fix_nested_dir 832252bca22aa10bc88fe7ceebf67ae6c40aa206dbcbca78d107c9ef5bae6c42 ++fi +diff --git a/src/Runner.Common/Constants.cs b/src/Runner.Common/Constants.cs +index 4d48cc3..f1cada2 100644 +--- a/src/Runner.Common/Constants.cs ++++ b/src/Runner.Common/Constants.cs +@@ -59,7 +59,8 @@ namespace GitHub.Runner.Common + X86, + X64, + Arm, +- Arm64 ++ Arm64, ++ RiscV64 + } + + public static class Runner +@@ -82,6 +83,8 @@ namespace GitHub.Runner.Common + public static readonly Architecture PlatformArchitecture = Architecture.Arm; + #elif ARM64 + public static readonly Architecture PlatformArchitecture = Architecture.Arm64; ++#elif RISCV64 ++ public static readonly Architecture PlatformArchitecture = Architecture.RiscV64; + #else + public static readonly Architecture PlatformArchitecture = Architecture.X64; + #endif +diff --git a/src/Runner.Common/Runner.Common.csproj b/src/Runner.Common/Runner.Common.csproj +index 257a759..ea16b96 100644 +--- a/src/Runner.Common/Runner.Common.csproj ++++ b/src/Runner.Common/Runner.Common.csproj +@@ -1,9 +1,11 @@ + + + +- net8.0 ++ net8.0 ++ net10.0 + Library + win-x64;win-x86;linux-x64;linux-arm64;osx-x64;osx-arm64;win-arm64 ++ linux-riscv64 + true + NU1701;NU1603;SYSLIB0050;SYSLIB0051 + $(Version) +diff --git a/src/Runner.Common/Util/VarUtil.cs b/src/Runner.Common/Util/VarUtil.cs +index 97273a1..766015f 100644 +--- a/src/Runner.Common/Util/VarUtil.cs ++++ b/src/Runner.Common/Util/VarUtil.cs +@@ -53,6 +53,8 @@ namespace GitHub.Runner.Common.Util + return "ARM"; + case Constants.Architecture.Arm64: + return "ARM64"; ++ case Constants.Architecture.RiscV64: ++ return "RISCV64"; + default: + throw new NotSupportedException(); // Should never reach here. + } +diff --git a/src/Runner.Listener/Runner.Listener.csproj b/src/Runner.Listener/Runner.Listener.csproj +index 08adb98..c835a56 100644 +--- a/src/Runner.Listener/Runner.Listener.csproj ++++ b/src/Runner.Listener/Runner.Listener.csproj +@@ -1,9 +1,11 @@ + + + +- net8.0 ++ net8.0 ++ net10.0 + Exe + win-x64;win-x86;linux-x64;linux-arm64;osx-x64;osx-arm64;win-arm64 ++ linux-riscv64 + true + true + NU1701;NU1603;SYSLIB0050;SYSLIB0051 +diff --git a/src/Runner.PluginHost/Runner.PluginHost.csproj b/src/Runner.PluginHost/Runner.PluginHost.csproj +index 51ee3ce..58c38e2 100644 +--- a/src/Runner.PluginHost/Runner.PluginHost.csproj ++++ b/src/Runner.PluginHost/Runner.PluginHost.csproj +@@ -1,9 +1,11 @@ +  + + +- net8.0 ++ net8.0 ++ net10.0 + Exe + win-x64;win-x86;linux-x64;linux-arm64;osx-x64;osx-arm64;win-arm64 ++ linux-riscv64 + true + true + NU1701;NU1603;SYSLIB0050;SYSLIB0051 +diff --git a/src/Runner.Plugins/Runner.Plugins.csproj b/src/Runner.Plugins/Runner.Plugins.csproj +index 1ddd57e..151986b 100644 +--- a/src/Runner.Plugins/Runner.Plugins.csproj ++++ b/src/Runner.Plugins/Runner.Plugins.csproj +@@ -1,9 +1,11 @@ +  + + +- net8.0 ++ net8.0 ++ net10.0 + Library + win-x64;win-x86;linux-x64;linux-arm64;osx-x64;osx-arm64;win-arm64 ++ linux-riscv64 + true + true + NU1701;NU1603;SYSLIB0050;SYSLIB0051 +diff --git a/src/Runner.Sdk/Runner.Sdk.csproj b/src/Runner.Sdk/Runner.Sdk.csproj +index 278bb06..afd4f0a 100644 +--- a/src/Runner.Sdk/Runner.Sdk.csproj ++++ b/src/Runner.Sdk/Runner.Sdk.csproj +@@ -1,9 +1,11 @@ +  + + +- net8.0 ++ net8.0 ++ net10.0 + Library + win-x64;win-x86;linux-x64;linux-arm64;osx-x64;osx-arm64;win-arm64 ++ linux-riscv64 + true + true + NU1701;NU1603;SYSLIB0050;SYSLIB0051 +diff --git a/src/Runner.Worker/Runner.Worker.csproj b/src/Runner.Worker/Runner.Worker.csproj +index 33e2b2f..e1f75f9 100644 +--- a/src/Runner.Worker/Runner.Worker.csproj ++++ b/src/Runner.Worker/Runner.Worker.csproj +@@ -1,9 +1,11 @@ + + + +- net8.0 ++ net8.0 ++ net10.0 + Exe + win-x64;win-x86;linux-x64;linux-arm64;osx-x64;osx-arm64;win-arm64 ++ linux-riscv64 + true + true + NU1701;NU1603;SYSLIB0050;SYSLIB0051 +diff --git a/src/Sdk/Sdk.csproj b/src/Sdk/Sdk.csproj +index c02c7b7..efb1a54 100644 +--- a/src/Sdk/Sdk.csproj ++++ b/src/Sdk/Sdk.csproj +@@ -1,9 +1,11 @@ + + + +- net8.0 ++ net8.0 ++ net10.0 + Library + win-x64;win-x86;linux-x64;linux-arm64;osx-x64;osx-arm64;win-arm64 ++ linux-riscv64 + + true + NU1701;NU1603;SYSLIB0050;SYSLIB0051 +diff --git a/src/Test/L0/ConstantGenerationL0.cs b/src/Test/L0/ConstantGenerationL0.cs +index e4dda74..1a5ca50 100644 +--- a/src/Test/L0/ConstantGenerationL0.cs ++++ b/src/Test/L0/ConstantGenerationL0.cs +@@ -19,6 +19,7 @@ namespace GitHub.Runner.Common.Tests + "win-arm64", + "linux-x64", + "linux-arm64", ++ "linux-riscv64", + "osx-x64", + "osx-arm64" + }; +diff --git a/src/Test/L0/Listener/Configuration/ConfigurationManagerL0.cs b/src/Test/L0/Listener/Configuration/ConfigurationManagerL0.cs +index 3c698fd..a76bc14 100644 +--- a/src/Test/L0/Listener/Configuration/ConfigurationManagerL0.cs ++++ b/src/Test/L0/Listener/Configuration/ConfigurationManagerL0.cs +@@ -2,6 +2,7 @@ + using GitHub.Runner.Listener; + using GitHub.Runner.Listener.Configuration; + using GitHub.Runner.Common.Util; ++using GitHub.Runner.Sdk; + using GitHub.Services.WebApi; + using Moq; + using System; +@@ -199,7 +200,8 @@ namespace GitHub.Runner.Common.Tests.Listener.Configuration + // validate GetAgentPoolsAsync gets called twice with automation pool type + _runnerServer.Verify(x => x.GetAgentPoolsAsync(It.IsAny(), It.Is(p => p == TaskAgentPoolType.Automation)), Times.Exactly(2)); + +- var expectedLabels = new List() { "self-hosted", VarUtil.OS, VarUtil.OSArchitecture }; ++ var expectedArchitecture = BuildConstants.RunnerPackage.PackageName == "linux-riscv64" ? "RISCV64" : VarUtil.OSArchitecture; ++ var expectedLabels = new List() { "self-hosted", VarUtil.OS, expectedArchitecture }; + expectedLabels.AddRange(userLabels.Split(",").ToList()); + + _runnerServer.Verify(x => x.AddAgentAsync(It.IsAny(), It.Is(a => a.Labels.Select(x => x.Name).ToHashSet().SetEquals(expectedLabels))), Times.Once); +diff --git a/src/Test/L0/Listener/SelfUpdaterL0.cs b/src/Test/L0/Listener/SelfUpdaterL0.cs +index 8003dd0..0985032 100644 +--- a/src/Test/L0/Listener/SelfUpdaterL0.cs ++++ b/src/Test/L0/Listener/SelfUpdaterL0.cs +@@ -58,7 +58,9 @@ namespace GitHub.Runner.Common.Tests.Listener + latestVersion = match.Groups["version"].Value; + + #if !OS_WINDOWS +- _packageUrl = $"https://github.com/actions/runner/releases/download/v{latestVersion}/actions-runner-{BuildConstants.RunnerPackage.PackageName}-{latestVersion}.tar.gz"; ++ // The official RISC-V archive is unavailable; this fixture is only extracted. ++ var packageName = BuildConstants.RunnerPackage.PackageName == "linux-riscv64" ? "linux-x64" : BuildConstants.RunnerPackage.PackageName; ++ _packageUrl = $"https://github.com/actions/runner/releases/download/v{latestVersion}/actions-runner-{packageName}-{latestVersion}.tar.gz"; + #else + _packageUrl = $"https://github.com/actions/runner/releases/download/v{latestVersion}/actions-runner-{BuildConstants.RunnerPackage.PackageName}-{latestVersion}.zip"; + #endif +diff --git a/src/Test/L0/Listener/SelfUpdaterV2L0.cs b/src/Test/L0/Listener/SelfUpdaterV2L0.cs +index a91e112..8fedf49 100644 +--- a/src/Test/L0/Listener/SelfUpdaterV2L0.cs ++++ b/src/Test/L0/Listener/SelfUpdaterV2L0.cs +@@ -58,7 +58,9 @@ namespace GitHub.Runner.Common.Tests.Listener + latestVersion = match.Groups["version"].Value; + + #if !OS_WINDOWS +- _packageUrl = $"https://github.com/actions/runner/releases/download/v{latestVersion}/actions-runner-{BuildConstants.RunnerPackage.PackageName}-{latestVersion}.tar.gz"; ++ // The official RISC-V archive is unavailable; this fixture is only extracted. ++ var packageName = BuildConstants.RunnerPackage.PackageName == "linux-riscv64" ? "linux-x64" : BuildConstants.RunnerPackage.PackageName; ++ _packageUrl = $"https://github.com/actions/runner/releases/download/v{latestVersion}/actions-runner-{packageName}-{latestVersion}.tar.gz"; + #else + _packageUrl = $"https://github.com/actions/runner/releases/download/v{latestVersion}/actions-runner-{BuildConstants.RunnerPackage.PackageName}-{latestVersion}.zip"; + #endif +diff --git a/src/Test/Test.csproj b/src/Test/Test.csproj +index e4ce929..9ca4687 100644 +--- a/src/Test/Test.csproj ++++ b/src/Test/Test.csproj +@@ -1,7 +1,9 @@ + + +- net8.0 ++ net8.0 ++ net10.0 + win-x64;win-x86;linux-x64;linux-arm64;osx-x64;osx-arm64;win-arm64 ++ linux-riscv64 + true + NU1701;NU1603;NU1603;xUnit2013;SYSLIB0050;SYSLIB0051 + +diff --git a/src/dev.sh b/src/dev.sh +index 6eb6df2..31c4c82 100755 +--- a/src/dev.sh ++++ b/src/dev.sh +@@ -57,6 +57,7 @@ elif [[ "$CURRENT_PLATFORM" == 'linux' ]]; then + exit 1 + ;; + aarch64) RUNTIME_ID="linux-arm64";; ++ riscv64) RUNTIME_ID="linux-riscv64";; + esac + fi + elif [[ "$CURRENT_PLATFORM" == 'darwin' ]]; then +@@ -75,7 +76,7 @@ fi + + # Make sure current platform support publish the dotnet runtime + # Windows can publish win-x86/x64/arm64 +-# Linux can publish linux-x64/arm64 ++# Linux can publish linux-x64/arm64/riscv64 + # OSX can publish osx-x64/arm64 + if [[ "$CURRENT_PLATFORM" == 'windows' ]]; then + if [[ ("$RUNTIME_ID" != 'win-x86') && ("$RUNTIME_ID" != 'win-x64') && ("$RUNTIME_ID" != 'win-arm64') ]]; then +@@ -83,7 +84,7 @@ if [[ "$CURRENT_PLATFORM" == 'windows' ]]; then + exit 1 + fi + elif [[ "$CURRENT_PLATFORM" == 'linux' ]]; then +- if [[ ("$RUNTIME_ID" != 'linux-x64') && ("$RUNTIME_ID" != 'linux-x86') && ("$RUNTIME_ID" != 'linux-arm64') ]]; then ++ if [[ ("$RUNTIME_ID" != 'linux-x64') && ("$RUNTIME_ID" != 'linux-x86') && ("$RUNTIME_ID" != 'linux-arm64') && ("$RUNTIME_ID" != 'linux-riscv64') ]]; then + echo "Failed: Can't build $RUNTIME_ID package $CURRENT_PLATFORM" >&2 + exit 1 + fi +@@ -203,7 +204,11 @@ function package () + } + + # Install .NET SDK +-if [[ (! -d "${DOTNETSDK_INSTALLDIR}") || (! -e "${DOTNETSDK_INSTALLDIR}/.${DOTNETSDK_VERSION}") || (! -e "${DOTNETSDK_INSTALLDIR}/dotnet") ]]; then ++if [[ "$RUNTIME_ID" == 'linux-riscv64' ]]; then ++ if ! command -v dotnet > /dev/null || [[ "$(dotnet --version)" != 10.0.* ]]; then ++ failed "linux-riscv64 requires a community .NET 10 SDK on PATH" ++ fi ++elif [[ (! -d "${DOTNETSDK_INSTALLDIR}") || (! -e "${DOTNETSDK_INSTALLDIR}/.${DOTNETSDK_VERSION}") || (! -e "${DOTNETSDK_INSTALLDIR}/dotnet") ]]; then + + # Download dotnet SDK to ../_dotnetsdk directory + heading "Ensure Dotnet SDK" +@@ -228,8 +233,10 @@ if [[ (! -d "${DOTNETSDK_INSTALLDIR}") || (! -e "${DOTNETSDK_INSTALLDIR}/.${DOTN + echo "${DOTNETSDK_VERSION}" > "${DOTNETSDK_INSTALLDIR}/.${DOTNETSDK_VERSION}" + fi + +-echo "Prepend ${DOTNETSDK_INSTALLDIR} to %PATH%" +-export PATH=${DOTNETSDK_INSTALLDIR}:$PATH ++if [[ "$RUNTIME_ID" != 'linux-riscv64' ]]; then ++ echo "Prepend ${DOTNETSDK_INSTALLDIR} to %PATH%" ++ export PATH=${DOTNETSDK_INSTALLDIR}:$PATH ++fi + + heading "Dotnet SDK Version" + dotnet --version +diff --git a/src/dir.proj b/src/dir.proj +index 056a312..c00520d 100644 +--- a/src/dir.proj ++++ b/src/dir.proj +@@ -48,7 +48,7 @@ + + + +- ++ + + + +diff --git a/src/global.json b/src/global.json +index 67f951e..7b920b0 100644 +--- a/src/global.json ++++ b/src/global.json +@@ -1,5 +1,6 @@ + { + "sdk": { +- "version": "8.0.428" ++ "version": "8.0.428", ++ "rollForward": "major" + } + } +# From upstream commit: aea9aaa3a0b49933412c6f59d7f05be037207a28 diff --git a/patches/runner-sdk8-riscv64.patch b/patches/runner-sdk8-riscv64.patch new file mode 100644 index 00000000000..8aff7ca711a --- /dev/null +++ b/patches/runner-sdk8-riscv64.patch @@ -0,0 +1,779 @@ +diff --git a/src/Directory.Build.props b/src/Directory.Build.props +index 9c069b1..e7b433e 100644 +--- a/src/Directory.Build.props ++++ b/src/Directory.Build.props +@@ -44,6 +44,10 @@ + + $(DefineConstants);ARM64 + ++ ++ $(DefineConstants);RISCV64 ++ $(WarningsNotAsErrors);NU1510 ++ + + + +diff --git a/src/Misc/externals.sh b/src/Misc/externals.sh +index c385c5e..de25986 100755 +--- a/src/Misc/externals.sh ++++ b/src/Misc/externals.sh +@@ -4,10 +4,11 @@ PRECACHE=$2 + + NODE_URL=https://nodejs.org/dist + NODE_ALPINE_URL=https://github.com/actions/alpine_nodejs/releases/download ++NODE_UNOFFICIAL_URL=https://unofficial-builds.nodejs.org/download/release + # When you update Node versions you must also create a new release of alpine_nodejs at that updated version. + # Follow the instructions here: https://github.com/actions/alpine_nodejs?tab=readme-ov-file#getting-started + NODE20_VERSION="20.20.2" +-NODE24_VERSION="24.22.1" ++NODE24_VERSION="24.23.0" + + get_abs_path() { + # exploits the fact that pwd will print abs path when no args +@@ -30,10 +31,19 @@ function checkRC() { + fi + } + ++function verifyChecksum() { ++ local file=$1 ++ local checksum=$2 ++ if [[ -n "$checksum" ]]; then ++ printf '%s %s\n' "$checksum" "$file" | sha256sum --check --status || failed "SHA-256 mismatch for $file" ++ fi ++} ++ + function acquireExternalTool() { + local download_source=$1 # E.g. https://github.com/microsoft/vswhere/releases/download/2.6.7/vswhere.exe + local target_dir="$LAYOUT_DIR/externals/$2" # E.g. $LAYOUT_DIR/externals/vswhere + local fix_nested_dir=$3 # Flag that indicates whether to move nested contents up one directory. ++ local checksum=$4 + + # Extract the portion of the URL after the protocol. E.g. github.com/microsoft/vswhere/releases/download/2.6.7/vswhere.exe + local relative_url="${download_source#*://}" +@@ -46,6 +56,7 @@ function acquireExternalTool() { + if [[ "$PRECACHE" != "" ]]; then + if [ -f "$download_target" ]; then + echo "Download exists: $download_basename" ++ verifyChecksum "$download_target" "$checksum" + else + # Delete any previous partial file. + local partial_target="$DOWNLOAD_DIR/partial/$download_basename" +@@ -74,6 +85,8 @@ function acquireExternalTool() { + curl -fSL --retry 3 --retry-all-errors -o "$partial_target" "$download_source" 2>"${download_target}_download.log" || checkRC 'curl' + fi + ++ verifyChecksum "$partial_target" "$checksum" ++ + # Move the partial file to the download target. + mv "$partial_target" "$download_target" || checkRC 'mv' + +@@ -95,6 +108,7 @@ function acquireExternalTool() { + fi + fi + else ++ verifyChecksum "$download_target" "$checksum" + # Extract to layout. + mkdir -p "$target_dir" || checkRC 'mkdir' + local nested_dir="" +@@ -187,3 +201,7 @@ fi + if [[ "$PACKAGERUNTIME" == "linux-arm" ]]; then + acquireExternalTool "$NODE_URL/v${NODE20_VERSION}/node-v${NODE20_VERSION}-linux-armv7l.tar.gz" node20 fix_nested_dir + fi ++ ++if [[ "$PACKAGERUNTIME" == "linux-riscv64" ]]; then ++ acquireExternalTool "$NODE_UNOFFICIAL_URL/v${NODE24_VERSION}/node-v${NODE24_VERSION}-linux-riscv64.tar.gz" node24 fix_nested_dir 832252bca22aa10bc88fe7ceebf67ae6c40aa206dbcbca78d107c9ef5bae6c42 ++fi +diff --git a/src/Runner.Common/Constants.cs b/src/Runner.Common/Constants.cs +index 4acf494..327fb89 100644 +--- a/src/Runner.Common/Constants.cs ++++ b/src/Runner.Common/Constants.cs +@@ -59,7 +59,8 @@ namespace GitHub.Runner.Common + X86, + X64, + Arm, +- Arm64 ++ Arm64, ++ RiscV64 + } + + public static class Runner +@@ -82,6 +83,8 @@ namespace GitHub.Runner.Common + public static readonly Architecture PlatformArchitecture = Architecture.Arm; + #elif ARM64 + public static readonly Architecture PlatformArchitecture = Architecture.Arm64; ++#elif RISCV64 ++ public static readonly Architecture PlatformArchitecture = Architecture.RiscV64; + #else + public static readonly Architecture PlatformArchitecture = Architecture.X64; + #endif +diff --git a/src/Runner.Common/Runner.Common.csproj b/src/Runner.Common/Runner.Common.csproj +index 9c087c8..c9207bc 100644 +--- a/src/Runner.Common/Runner.Common.csproj ++++ b/src/Runner.Common/Runner.Common.csproj +@@ -1,9 +1,11 @@ + + + +- net8.0 ++ net8.0 ++ net10.0 + Library + win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64 ++ linux-riscv64 + true + NU1701;NU1603;SYSLIB0050;SYSLIB0051 + $(Version) +diff --git a/src/Runner.Common/Util/NodeUtil.cs b/src/Runner.Common/Util/NodeUtil.cs +index 7b8055b..b812e5a 100644 +--- a/src/Runner.Common/Util/NodeUtil.cs ++++ b/src/Runner.Common/Util/NodeUtil.cs +@@ -29,7 +29,11 @@ namespace GitHub.Runner.Common.Util + } + + private const string _defaultNodeVersion = "node24"; ++#if RISCV64 ++ public static readonly ReadOnlyCollection BuiltInNodeVersions = new(new[] { "node24" }); ++#else + public static readonly ReadOnlyCollection BuiltInNodeVersions = new(new[] { "node20", "node24" }); ++#endif + public static string GetInternalNodeVersion() + { + var forcedInternalNodeVersion = Environment.GetEnvironmentVariable(Constants.Variables.Agent.ForcedInternalNodeVersion); +diff --git a/src/Runner.Common/Util/VarUtil.cs b/src/Runner.Common/Util/VarUtil.cs +index 97273a1..766015f 100644 +--- a/src/Runner.Common/Util/VarUtil.cs ++++ b/src/Runner.Common/Util/VarUtil.cs +@@ -53,6 +53,8 @@ namespace GitHub.Runner.Common.Util + return "ARM"; + case Constants.Architecture.Arm64: + return "ARM64"; ++ case Constants.Architecture.RiscV64: ++ return "RISCV64"; + default: + throw new NotSupportedException(); // Should never reach here. + } +diff --git a/src/Runner.Listener/Runner.Listener.csproj b/src/Runner.Listener/Runner.Listener.csproj +index b532500..cf41fe2 100644 +--- a/src/Runner.Listener/Runner.Listener.csproj ++++ b/src/Runner.Listener/Runner.Listener.csproj +@@ -1,9 +1,11 @@ + + + +- net8.0 ++ net8.0 ++ net10.0 + Exe + win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64 ++ linux-riscv64 + true + true + NU1701;NU1603;SYSLIB0050;SYSLIB0051 +diff --git a/src/Runner.PluginHost/Runner.PluginHost.csproj b/src/Runner.PluginHost/Runner.PluginHost.csproj +index 81a8d2e..ae69c6e 100644 +--- a/src/Runner.PluginHost/Runner.PluginHost.csproj ++++ b/src/Runner.PluginHost/Runner.PluginHost.csproj +@@ -1,9 +1,11 @@ +  + + +- net8.0 ++ net8.0 ++ net10.0 + Exe + win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64 ++ linux-riscv64 + true + true + NU1701;NU1603;SYSLIB0050;SYSLIB0051 +diff --git a/src/Runner.Plugins/Runner.Plugins.csproj b/src/Runner.Plugins/Runner.Plugins.csproj +index a786cf1..d523d36 100644 +--- a/src/Runner.Plugins/Runner.Plugins.csproj ++++ b/src/Runner.Plugins/Runner.Plugins.csproj +@@ -1,9 +1,11 @@ +  + + +- net8.0 ++ net8.0 ++ net10.0 + Library + win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64 ++ linux-riscv64 + true + true + NU1701;NU1603;SYSLIB0050;SYSLIB0051 +diff --git a/src/Runner.Sdk/Runner.Sdk.csproj b/src/Runner.Sdk/Runner.Sdk.csproj +index 3f58d58..1b53d48 100644 +--- a/src/Runner.Sdk/Runner.Sdk.csproj ++++ b/src/Runner.Sdk/Runner.Sdk.csproj +@@ -1,9 +1,11 @@ +  + + +- net8.0 ++ net8.0 ++ net10.0 + Library + win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64 ++ linux-riscv64 + true + true + NU1701;NU1603;SYSLIB0050;SYSLIB0051 +diff --git a/src/Runner.Worker/Handlers/HandlerFactory.cs b/src/Runner.Worker/Handlers/HandlerFactory.cs +index 8044f09..15af54f 100644 +--- a/src/Runner.Worker/Handlers/HandlerFactory.cs ++++ b/src/Runner.Worker/Handlers/HandlerFactory.cs +@@ -86,6 +86,9 @@ namespace GitHub.Runner.Worker.Handlers + { + bool useNode24ByDefault = executionContext.Global.Variables?.GetBoolean(Constants.Runner.NodeMigration.UseNode24ByDefaultFlag) ?? false; + bool requireNode24 = executionContext.Global.Variables?.GetBoolean(Constants.Runner.NodeMigration.RequireNode24Flag) ?? false; ++#if RISCV64 ++ requireNode24 = true; ++#endif + + var (nodeVersion, configWarningMessage) = NodeUtil.DetermineActionsNodeVersion(environment, useNode24ByDefault, requireNode24); + var (finalNodeVersion, platformWarningMessage) = NodeUtil.CheckNodeVersionForLinuxArm32(nodeVersion, deprecateArm32, killArm32, node20RemovalDate); +diff --git a/src/Runner.Worker/Runner.Worker.csproj b/src/Runner.Worker/Runner.Worker.csproj +index 6a7f36e..5ab8a19 100644 +--- a/src/Runner.Worker/Runner.Worker.csproj ++++ b/src/Runner.Worker/Runner.Worker.csproj +@@ -1,9 +1,11 @@ + + + +- net8.0 ++ net8.0 ++ net10.0 + Exe + win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64 ++ linux-riscv64 + true + true + NU1701;NU1603;SYSLIB0050;SYSLIB0051 +@@ -19,6 +21,7 @@ + + + ++ + + + +diff --git a/src/Sdk/Sdk.csproj b/src/Sdk/Sdk.csproj +index 45c8f8f..202dd13 100644 +--- a/src/Sdk/Sdk.csproj ++++ b/src/Sdk/Sdk.csproj +@@ -1,9 +1,11 @@ + + + +- net8.0 ++ net8.0 ++ net10.0 + Library + win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64 ++ linux-riscv64 + + true + NU1701;NU1603;SYSLIB0050;SYSLIB0051 +diff --git a/src/Test/L0/ConstantGenerationL0.cs b/src/Test/L0/ConstantGenerationL0.cs +index 4ff2dbb..8febad5 100644 +--- a/src/Test/L0/ConstantGenerationL0.cs ++++ b/src/Test/L0/ConstantGenerationL0.cs +@@ -20,6 +20,7 @@ namespace GitHub.Runner.Common.Tests + "linux-x64", + "linux-arm", + "linux-arm64", ++ "linux-riscv64", + "osx-x64", + "osx-arm64" + }; +diff --git a/src/Test/L0/Listener/Configuration/ConfigurationManagerL0.cs b/src/Test/L0/Listener/Configuration/ConfigurationManagerL0.cs +index 3c698fd..a76bc14 100644 +--- a/src/Test/L0/Listener/Configuration/ConfigurationManagerL0.cs ++++ b/src/Test/L0/Listener/Configuration/ConfigurationManagerL0.cs +@@ -2,6 +2,7 @@ + using GitHub.Runner.Listener; + using GitHub.Runner.Listener.Configuration; + using GitHub.Runner.Common.Util; ++using GitHub.Runner.Sdk; + using GitHub.Services.WebApi; + using Moq; + using System; +@@ -199,7 +200,8 @@ namespace GitHub.Runner.Common.Tests.Listener.Configuration + // validate GetAgentPoolsAsync gets called twice with automation pool type + _runnerServer.Verify(x => x.GetAgentPoolsAsync(It.IsAny(), It.Is(p => p == TaskAgentPoolType.Automation)), Times.Exactly(2)); + +- var expectedLabels = new List() { "self-hosted", VarUtil.OS, VarUtil.OSArchitecture }; ++ var expectedArchitecture = BuildConstants.RunnerPackage.PackageName == "linux-riscv64" ? "RISCV64" : VarUtil.OSArchitecture; ++ var expectedLabels = new List() { "self-hosted", VarUtil.OS, expectedArchitecture }; + expectedLabels.AddRange(userLabels.Split(",").ToList()); + + _runnerServer.Verify(x => x.AddAgentAsync(It.IsAny(), It.Is(a => a.Labels.Select(x => x.Name).ToHashSet().SetEquals(expectedLabels))), Times.Once); +diff --git a/src/Test/L0/Listener/SelfUpdaterL0.cs b/src/Test/L0/Listener/SelfUpdaterL0.cs +index 8003dd0..0985032 100644 +--- a/src/Test/L0/Listener/SelfUpdaterL0.cs ++++ b/src/Test/L0/Listener/SelfUpdaterL0.cs +@@ -58,7 +58,9 @@ namespace GitHub.Runner.Common.Tests.Listener + latestVersion = match.Groups["version"].Value; + + #if !OS_WINDOWS +- _packageUrl = $"https://github.com/actions/runner/releases/download/v{latestVersion}/actions-runner-{BuildConstants.RunnerPackage.PackageName}-{latestVersion}.tar.gz"; ++ // The official RISC-V archive is unavailable; this fixture is only extracted. ++ var packageName = BuildConstants.RunnerPackage.PackageName == "linux-riscv64" ? "linux-x64" : BuildConstants.RunnerPackage.PackageName; ++ _packageUrl = $"https://github.com/actions/runner/releases/download/v{latestVersion}/actions-runner-{packageName}-{latestVersion}.tar.gz"; + #else + _packageUrl = $"https://github.com/actions/runner/releases/download/v{latestVersion}/actions-runner-{BuildConstants.RunnerPackage.PackageName}-{latestVersion}.zip"; + #endif +diff --git a/src/Test/L0/Listener/SelfUpdaterV2L0.cs b/src/Test/L0/Listener/SelfUpdaterV2L0.cs +index a91e112..8fedf49 100644 +--- a/src/Test/L0/Listener/SelfUpdaterV2L0.cs ++++ b/src/Test/L0/Listener/SelfUpdaterV2L0.cs +@@ -58,7 +58,9 @@ namespace GitHub.Runner.Common.Tests.Listener + latestVersion = match.Groups["version"].Value; + + #if !OS_WINDOWS +- _packageUrl = $"https://github.com/actions/runner/releases/download/v{latestVersion}/actions-runner-{BuildConstants.RunnerPackage.PackageName}-{latestVersion}.tar.gz"; ++ // The official RISC-V archive is unavailable; this fixture is only extracted. ++ var packageName = BuildConstants.RunnerPackage.PackageName == "linux-riscv64" ? "linux-x64" : BuildConstants.RunnerPackage.PackageName; ++ _packageUrl = $"https://github.com/actions/runner/releases/download/v{latestVersion}/actions-runner-{packageName}-{latestVersion}.tar.gz"; + #else + _packageUrl = $"https://github.com/actions/runner/releases/download/v{latestVersion}/actions-runner-{BuildConstants.RunnerPackage.PackageName}-{latestVersion}.zip"; + #endif +diff --git a/src/Test/L0/ProcessExtensionL0.cs b/src/Test/L0/ProcessExtensionL0.cs +index d650b48..95e258b 100644 +--- a/src/Test/L0/ProcessExtensionL0.cs ++++ b/src/Test/L0/ProcessExtensionL0.cs +@@ -28,8 +28,12 @@ namespace GitHub.Runner.Common.Tests + { + #if OS_WINDOWS + string node = Path.Combine(TestUtil.GetSrcPath(), @"..\_layout\externals\node20\bin\node"); ++#else ++#if RISCV64 ++ string node = Path.Combine(TestUtil.GetSrcPath(), @"../_layout/externals/node24/bin/node"); + #else + string node = Path.Combine(TestUtil.GetSrcPath(), @"../_layout/externals/node20/bin/node"); ++#endif + hc.EnqueueInstance(new ProcessInvokerWrapper()); + #endif + var startInfo = new ProcessStartInfo(node, "-e \"setTimeout(function(){{}}, 15 * 1000);\""); +diff --git a/src/Test/L0/Util/NodeUtilL0.cs b/src/Test/L0/Util/NodeUtilL0.cs +index 0a493c7..41d0355 100644 +--- a/src/Test/L0/Util/NodeUtilL0.cs ++++ b/src/Test/L0/Util/NodeUtilL0.cs +@@ -13,7 +13,11 @@ namespace GitHub.Runner.Common.Tests.Util + [Trait("Category", "Common")] + [InlineData(null, "node24")] + [InlineData("node24", "node24")] ++#if RISCV64 ++ [InlineData("node20", "node24")] ++#else + [InlineData("node20", "node20")] ++#endif + [InlineData("node16", "node24")] // Unsupported versions are ignored + public void TestInternalNodeVersion(string forcedVersion, string expectedVersion) + { +diff --git a/src/Test/L0/Worker/HandlerFactoryL0.cs b/src/Test/L0/Worker/HandlerFactoryL0.cs +index e8ecdef..b9857e5 100644 +--- a/src/Test/L0/Worker/HandlerFactoryL0.cs ++++ b/src/Test/L0/Worker/HandlerFactoryL0.cs +@@ -30,9 +30,15 @@ namespace GitHub.Runner.Common.Tests.Worker + [Theory] + [Trait("Level", "L0")] + [Trait("Category", "Worker")] ++#if RISCV64 ++ [InlineData("node12", "node24")] ++ [InlineData("node16", "node24")] ++ [InlineData("node20", "node24")] ++#else + [InlineData("node12", "node20")] + [InlineData("node16", "node20")] + [InlineData("node20", "node20")] ++#endif + [InlineData("node24", "node24")] + public void IsNodeVersionUpgraded(string inputVersion, string expectedVersion) + { +@@ -74,6 +80,83 @@ namespace GitHub.Runner.Common.Tests.Worker + } + } + ++#if RISCV64 ++ [Theory] ++ [Trait("Level", "L0")] ++ [Trait("Category", "Worker")] ++ [InlineData("node12", false, false, false, false)] ++ [InlineData("node16", false, true, false, false)] ++ [InlineData("node20", false, false, false, false)] ++ [InlineData("node20", true, true, false, false)] ++ [InlineData("node20", true, true, false, true)] ++ [InlineData("node20", false, true, true, false)] ++ [InlineData("node24", false, true, false, false)] ++ public void RiscVActionsAlwaysUseNode24(string requestedVersion, bool useNode24ByDefault, bool allowNode20, bool forceNode24, bool systemAllowNode20) ++ { ++ using (TestHostContext hc = CreateTestContext()) ++ { ++ var previousSystemValue = Environment.GetEnvironmentVariable(Constants.Runner.NodeMigration.AllowUnsecureNodeVersionVariable); ++ try ++ { ++ Environment.SetEnvironmentVariable(Constants.Runner.NodeMigration.AllowUnsecureNodeVersionVariable, systemAllowNode20 ? "true" : null); ++ var hf = new HandlerFactory(); ++ hf.Initialize(hc); ++ ++ var variables = new Dictionary ++ { ++ { Constants.Runner.NodeMigration.UseNode24ByDefaultFlag, new VariableValue(useNode24ByDefault.ToString()) }, ++ { Constants.Runner.NodeMigration.WarnOnNode20Flag, new VariableValue("true") } ++ }; ++ var upgradedActions = new HashSet(StringComparer.OrdinalIgnoreCase); ++ var deprecatedActions = new HashSet(StringComparer.OrdinalIgnoreCase); ++ _ec.Setup(x => x.Global).Returns(new GlobalContext() ++ { ++ Variables = new Variables(hc, variables), ++ EnvironmentVariables = new Dictionary(), ++ UpgradedToNode24Actions = upgradedActions, ++ DeprecatedNode20Actions = deprecatedActions ++ }); ++ ++ var environment = new Dictionary ++ { ++ { Constants.Runner.NodeMigration.ForceNode24Variable, forceNode24.ToString() } ++ }; ++ if (!systemAllowNode20) ++ { ++ environment[Constants.Runner.NodeMigration.AllowUnsecureNodeVersionVariable] = allowNode20.ToString(); ++ } ++ ++ var data = new NodeJSActionExecutionData { NodeVersion = requestedVersion }; ++ var handler = hf.Create( ++ _ec.Object, ++ new RepositoryPathReference { Name = "example/action", Ref = "v1" }, ++ new Mock().Object, ++ data, ++ new Dictionary(), ++ environment, ++ new Variables(hc, new Dictionary()), ++ "", ++ new List()) as INodeScriptActionHandler; ++ ++ Assert.Equal("node24", handler.Data.NodeVersion); ++ Assert.Empty(deprecatedActions); ++ if (requestedVersion == "node24") ++ { ++ Assert.Empty(upgradedActions); ++ } ++ else ++ { ++ Assert.Contains("example/action@v1", upgradedActions); ++ } ++ } ++ finally ++ { ++ Environment.SetEnvironmentVariable(Constants.Runner.NodeMigration.AllowUnsecureNodeVersionVariable, previousSystemValue); ++ } ++ } ++ } ++#endif ++ + + + [Fact] +@@ -134,12 +217,14 @@ namespace GitHub.Runner.Common.Tests.Worker + }; + Variables serverVariables = new(hc, variables); + var deprecatedActions = new HashSet(StringComparer.OrdinalIgnoreCase); ++ var upgradedActions = new HashSet(StringComparer.OrdinalIgnoreCase); + + _ec.Setup(x => x.Global).Returns(new GlobalContext() + { + Variables = serverVariables, + EnvironmentVariables = new Dictionary(), +- DeprecatedNode20Actions = deprecatedActions ++ DeprecatedNode20Actions = deprecatedActions, ++ UpgradedToNode24Actions = upgradedActions + }); + + var actionRef = new RepositoryPathReference +@@ -164,7 +249,13 @@ namespace GitHub.Runner.Common.Tests.Worker + ); + + // Assert. ++#if RISCV64 ++ Assert.Empty(deprecatedActions); ++ Assert.Contains("actions/checkout@v4", upgradedActions); ++#else + Assert.Contains("actions/checkout@v4", deprecatedActions); ++ Assert.Empty(upgradedActions); ++#endif + } + } + +@@ -284,12 +375,14 @@ namespace GitHub.Runner.Common.Tests.Worker + }; + Variables serverVariables = new(hc, variables); + var deprecatedActions = new HashSet(StringComparer.OrdinalIgnoreCase); ++ var upgradedActions = new HashSet(StringComparer.OrdinalIgnoreCase); + + _ec.Setup(x => x.Global).Returns(new GlobalContext() + { + Variables = serverVariables, + EnvironmentVariables = new Dictionary(), +- DeprecatedNode20Actions = deprecatedActions ++ DeprecatedNode20Actions = deprecatedActions, ++ UpgradedToNode24Actions = upgradedActions + }); + + var actionRef = new RepositoryPathReference +@@ -313,8 +406,14 @@ namespace GitHub.Runner.Common.Tests.Worker + new List() + ); + +- // Assert - node12 gets migrated to node20 and should be tracked ++ // Assert - the action is tracked according to its final runtime. ++#if RISCV64 ++ Assert.Empty(deprecatedActions); ++ Assert.Contains("some-org/old-action@v1", upgradedActions); ++#else + Assert.Contains("some-org/old-action@v1", deprecatedActions); ++ Assert.Empty(upgradedActions); ++#endif + } + } + +@@ -335,12 +434,14 @@ namespace GitHub.Runner.Common.Tests.Worker + }; + Variables serverVariables = new(hc, variables); + var deprecatedActions = new HashSet(StringComparer.OrdinalIgnoreCase); ++ var upgradedActions = new HashSet(StringComparer.OrdinalIgnoreCase); + + _ec.Setup(x => x.Global).Returns(new GlobalContext() + { + Variables = serverVariables, + EnvironmentVariables = new Dictionary(), +- DeprecatedNode20Actions = deprecatedActions ++ DeprecatedNode20Actions = deprecatedActions, ++ UpgradedToNode24Actions = upgradedActions + }); + + // Local action: Name is empty, Path is the local path +@@ -367,7 +468,13 @@ namespace GitHub.Runner.Common.Tests.Worker + ); + + // Assert - local action should be tracked with its path ++#if RISCV64 ++ Assert.Empty(deprecatedActions); ++ Assert.Contains("./.github/actions/my-action", upgradedActions); ++#else + Assert.Contains("./.github/actions/my-action", deprecatedActions); ++ Assert.Empty(upgradedActions); ++#endif + } + } + +@@ -437,7 +544,7 @@ namespace GitHub.Runner.Common.Tests.Worker + [Fact] + [Trait("Level", "L0")] + [Trait("Category", "Worker")] +- public void Node20Action_NotUpgradedWhenPhase1Only() ++ public void Node20Action_UsesPlatformDefaultWhenPhase1Only() + { + using (TestHostContext hc = CreateTestContext()) + { +@@ -482,11 +589,15 @@ namespace GitHub.Runner.Common.Tests.Worker + new List() + ) as INodeScriptActionHandler; + +- // In Phase 1 (no UseNode24ByDefault), action stays on node20 +- // and should be in DeprecatedNode20Actions ++#if RISCV64 ++ Assert.Equal("node24", handler.Data.NodeVersion); ++ Assert.Empty(deprecatedActions); ++ Assert.Contains("actions/checkout@v4", upgradedActions); ++#else + Assert.Equal("node20", handler.Data.NodeVersion); + Assert.Contains("actions/checkout@v4", deprecatedActions); + Assert.Empty(upgradedActions); ++#endif + } + } + +@@ -797,7 +908,6 @@ namespace GitHub.Runner.Common.Tests.Worker + } + else + { +- // On non-ARM32, should proceed normally (node20 stays) + var handler = hf.Create( + _ec.Object, + actionRef, +@@ -810,7 +920,11 @@ namespace GitHub.Runner.Common.Tests.Worker + new List() + ) as INodeScriptActionHandler; + ++#if RISCV64 ++ Assert.Equal("node24", handler.Data.NodeVersion); ++#else + Assert.Equal("node20", handler.Data.NodeVersion); ++#endif + } + } + } +diff --git a/src/Test/L0/Worker/StepHostL0.cs b/src/Test/L0/Worker/StepHostL0.cs +index bac7d41..d81bf9b 100644 +--- a/src/Test/L0/Worker/StepHostL0.cs ++++ b/src/Test/L0/Worker/StepHostL0.cs +@@ -32,6 +32,20 @@ namespace GitHub.Runner.Common.Tests.Worker + } + + #if OS_LINUX ++ private async Task AssertAlpineNodeVersionAsync(ContainerStepHost stepHost, string preferredVersion) ++ { ++ if (Constants.Runner.PlatformArchitecture == Constants.Architecture.X64) ++ { ++ var nodeVersion = await stepHost.DetermineNodeRuntimeVersion(_ec.Object, preferredVersion); ++ Assert.Equal($"{preferredVersion}_alpine", nodeVersion); ++ } ++ else ++ { ++ var error = await Assert.ThrowsAsync(() => stepHost.DetermineNodeRuntimeVersion(_ec.Object, preferredVersion)); ++ Assert.Contains("only supported on x64 Linux runners", error.Message); ++ } ++ } ++ + [Fact] + [Trait("Level", "L0")] + [Trait("Category", "Worker")] +@@ -74,11 +88,7 @@ namespace GitHub.Runner.Common.Tests.Worker + }) + .ReturnsAsync(0); + +- // Act. +- var nodeVersion = await sh.DetermineNodeRuntimeVersion(_ec.Object, "node20"); +- +- // Assert. +- Assert.Equal("node20_alpine", nodeVersion); ++ await AssertAlpineNodeVersionAsync(sh, "node20"); + } + } + +@@ -101,11 +111,7 @@ namespace GitHub.Runner.Common.Tests.Worker + }) + .ReturnsAsync(0); + +- // Act. +- var nodeVersion = await sh.DetermineNodeRuntimeVersion(_ec.Object, "node20"); +- +- // Assert. +- Assert.Equal("node20_alpine", nodeVersion); ++ await AssertAlpineNodeVersionAsync(sh, "node20"); + } + } + +@@ -182,11 +188,7 @@ namespace GitHub.Runner.Common.Tests.Worker + }) + .ReturnsAsync(0); + +- // Act. +- var nodeVersion = await sh.DetermineNodeRuntimeVersion(_ec.Object, "node24"); +- +- // Assert. +- Assert.Equal("node24_alpine", nodeVersion); ++ await AssertAlpineNodeVersionAsync(sh, "node24"); + } + } + +diff --git a/src/Test/Test.csproj b/src/Test/Test.csproj +index 843071c..cd455b4 100644 +--- a/src/Test/Test.csproj ++++ b/src/Test/Test.csproj +@@ -1,7 +1,9 @@ + + +- net8.0 ++ net8.0 ++ net10.0 + win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64;osx-arm64;win-arm64 ++ linux-riscv64 + true + NU1701;NU1603;NU1603;xUnit2013;SYSLIB0050;SYSLIB0051 + +diff --git a/src/dev.sh b/src/dev.sh +index e4e8d10..b85192f 100755 +--- a/src/dev.sh ++++ b/src/dev.sh +@@ -54,6 +54,7 @@ elif [[ "$CURRENT_PLATFORM" == 'linux' ]]; then + case $CPU_NAME in + armv7l) RUNTIME_ID="linux-arm";; + aarch64) RUNTIME_ID="linux-arm64";; ++ riscv64) RUNTIME_ID="linux-riscv64";; + esac + fi + elif [[ "$CURRENT_PLATFORM" == 'darwin' ]]; then +@@ -72,7 +73,7 @@ fi + + # Make sure current platform support publish the dotnet runtime + # Windows can publish win-x86/x64/arm64 +-# Linux can publish linux-x64/arm/arm64 ++# Linux can publish linux-x64/arm/arm64/riscv64 + # OSX can publish osx-x64/arm64 + if [[ "$CURRENT_PLATFORM" == 'windows' ]]; then + if [[ ("$RUNTIME_ID" != 'win-x86') && ("$RUNTIME_ID" != 'win-x64') && ("$RUNTIME_ID" != 'win-arm64') ]]; then +@@ -80,7 +81,7 @@ if [[ "$CURRENT_PLATFORM" == 'windows' ]]; then + exit 1 + fi + elif [[ "$CURRENT_PLATFORM" == 'linux' ]]; then +- if [[ ("$RUNTIME_ID" != 'linux-x64') && ("$RUNTIME_ID" != 'linux-x86') && ("$RUNTIME_ID" != 'linux-arm64') && ("$RUNTIME_ID" != 'linux-arm') ]]; then ++ if [[ ("$RUNTIME_ID" != 'linux-x64') && ("$RUNTIME_ID" != 'linux-x86') && ("$RUNTIME_ID" != 'linux-arm64') && ("$RUNTIME_ID" != 'linux-arm') && ("$RUNTIME_ID" != 'linux-riscv64') ]]; then + echo "Failed: Can't build $RUNTIME_ID package $CURRENT_PLATFORM" >&2 + exit 1 + fi +@@ -200,7 +201,11 @@ function package () + } + + # Install .NET SDK +-if [[ (! -d "${DOTNETSDK_INSTALLDIR}") || (! -e "${DOTNETSDK_INSTALLDIR}/.${DOTNETSDK_VERSION}") || (! -e "${DOTNETSDK_INSTALLDIR}/dotnet") ]]; then ++if [[ "$RUNTIME_ID" == 'linux-riscv64' ]]; then ++ if ! command -v dotnet > /dev/null || [[ "$(dotnet --version)" != 10.0.* ]]; then ++ failed "linux-riscv64 requires a community .NET 10 SDK on PATH" ++ fi ++elif [[ (! -d "${DOTNETSDK_INSTALLDIR}") || (! -e "${DOTNETSDK_INSTALLDIR}/.${DOTNETSDK_VERSION}") || (! -e "${DOTNETSDK_INSTALLDIR}/dotnet") ]]; then + + # Download dotnet SDK to ../_dotnetsdk directory + heading "Ensure Dotnet SDK" +@@ -225,8 +230,10 @@ if [[ (! -d "${DOTNETSDK_INSTALLDIR}") || (! -e "${DOTNETSDK_INSTALLDIR}/.${DOTN + echo "${DOTNETSDK_VERSION}" > "${DOTNETSDK_INSTALLDIR}/.${DOTNETSDK_VERSION}" + fi + +-echo "Prepend ${DOTNETSDK_INSTALLDIR} to %PATH%" +-export PATH=${DOTNETSDK_INSTALLDIR}:$PATH ++if [[ "$RUNTIME_ID" != 'linux-riscv64' ]]; then ++ echo "Prepend ${DOTNETSDK_INSTALLDIR} to %PATH%" ++ export PATH=${DOTNETSDK_INSTALLDIR}:$PATH ++fi + + heading "Dotnet SDK Version" + dotnet --version +diff --git a/src/dir.proj b/src/dir.proj +index 056a312..c00520d 100644 +--- a/src/dir.proj ++++ b/src/dir.proj +@@ -48,7 +48,7 @@ + + + +- ++ + + + +diff --git a/src/global.json b/src/global.json +index 63e95af..bbe87d2 100644 +--- a/src/global.json ++++ b/src/global.json +@@ -1,5 +1,6 @@ + { + "sdk": { +- "version": "8.0.427" ++ "version": "8.0.427", ++ "rollForward": "major" + } + } +# From upstream release: v2.338.2 From 7d46bae0d287942d9582c2e6d9cf0e9951084dc7 Mon Sep 17 00:00:00 2001 From: Christopher Bartz Date: Fri, 4 Dec 2026 07:06:33 +0000 Subject: [PATCH 2/2] fix(ci): apply release patches when building release branches --- .github/workflows/build.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9fbe21c5fb3..4a148e2a7cc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,6 +17,7 @@ on: jobs: build: strategy: + fail-fast: false matrix: runtime: ${{ fromJSON(vars.ENABLE_RISCV64_BUILDS == 'true' && '["linux-s390x","linux-ppc64le","linux-x64","linux-arm64","linux-arm","linux-riscv64"]' || '["linux-s390x","linux-ppc64le","linux-x64","linux-arm64","linux-arm"]') }} include: @@ -93,8 +94,10 @@ jobs: - name: Apply patches if: matrix.runtime == 'linux-s390x' || matrix.runtime == 'linux-ppc64le' || matrix.runtime == 'linux-arm' || matrix.runtime == 'linux-riscv64' run: | - if [[ "${{ matrix.runtime }}" == "linux-riscv64" && ( "$GITHUB_REF" == refs/heads/releases/* || "$GITHUB_BASE_REF" == releases/* ) ]]; then - git apply patches/runner-sdk8-riscv64.patch + # Release branches carry upstream release source, which only the + # release patches (runner-sdk8-*) apply to. + if [[ "$GITHUB_REF" == refs/heads/releases/* || "$GITHUB_BASE_REF" == releases/* ]]; then + git apply patches/runner-sdk8-${{ matrix.patch_tag || 'riscv64' }}.patch else git apply patches/runner-main-sdk8-${{ matrix.patch_tag || 'riscv64' }}.patch fi