Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/riscv64-spacemit-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
riscv64_spacemit_linux:
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} ${{ matrix.lib_type }}
env:
SPACEMIT_TOOLCHAIN_VERSION: v1.1.2
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -67,17 +69,20 @@ jobs:
uses: actions/cache@v4
with:
path: toolchain
key: https://archive.spacemit.com/toolchain/spacemit-toolchain-linux-glibc-x86_64-v1.1.2.tar.xz
key: ${{ format('https://github.com/spacemit-com/toolchain/releases/download/{0}/spacemit-toolchain-linux-glibc-x86_64-{0}.tar.xz', env.SPACEMIT_TOOLCHAIN_VERSION) }}

- name: Download toolchain
if: steps.cache-toolchain.outputs.cache-hit != 'true'
shell: bash
run: |
wget -q https://archive.spacemit.com/toolchain/spacemit-toolchain-linux-glibc-x86_64-v1.1.2.tar.xz
toolchain_archive=spacemit-toolchain-linux-glibc-x86_64-${SPACEMIT_TOOLCHAIN_VERSION}.tar.xz
toolchain_url=https://github.com/spacemit-com/toolchain/releases/download/${SPACEMIT_TOOLCHAIN_VERSION}/${toolchain_archive}

wget -q ${toolchain_url}

mkdir $GITHUB_WORKSPACE/toolchain

tar xvf spacemit-toolchain-linux-glibc-x86_64-v1.1.2.tar.xz --strip-components 1 -C $GITHUB_WORKSPACE/toolchain
tar xvf ${toolchain_archive} --strip-components 1 -C $GITHUB_WORKSPACE/toolchain
ls -lh $GITHUB_WORKSPACE/toolchain/bin

- name: Display toolchain info
Expand Down
7 changes: 4 additions & 3 deletions build-riscv64-linux-gnu-spacemit.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env bash
set -ex

SPACEMIT_TOOLCHAIN=spacemit-toolchain-linux-glibc-x86_64-v1.1.2
DOWNLOAD_URL="https://archive.spacemit.com/toolchain/${SPACEMIT_TOOLCHAIN}.tar.xz"
DOWNLOAD_FILE="./riscv-spacemit-toolchain.tar.gz"
SPACEMIT_TOOLCHAIN_VERSION=v1.1.2
SPACEMIT_TOOLCHAIN=spacemit-toolchain-linux-glibc-x86_64-${SPACEMIT_TOOLCHAIN_VERSION}
DOWNLOAD_URL="https://github.com/spacemit-com/toolchain/releases/download/${SPACEMIT_TOOLCHAIN_VERSION}/${SPACEMIT_TOOLCHAIN}.tar.xz"
DOWNLOAD_FILE="./${SPACEMIT_TOOLCHAIN}.tar.xz"
Comment on lines +4 to +7

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== build script header =="
sed -n '1,12p' build-riscv64-linux-gnu-spacemit.sh

echo
echo "== all version declarations in reviewed files =="
rg -n 'SPACEMIT_TOOLCHAIN_VERSION' \
  .github/workflows/riscv64-spacemit-linux.yaml \
  build-riscv64-linux-gnu-spacemit.sh

Repository: k2-fsa/sherpa-onnx

Length of output: 1680


🏁 Script executed:

rg -n 'SPACEMIT_TOOLCHAIN_VERSION' --type-list | head -20

Repository: k2-fsa/sherpa-onnx

Length of output: 452


🏁 Script executed:

fd -type f -name '*.sh' -o -name '*.yaml' -o -name '*.yml' | xargs rg -l 'build-riscv64-linux-gnu-spacemit' 2>/dev/null || echo "No files found calling this script"

Repository: k2-fsa/sherpa-onnx

Length of output: 286


🏁 Script executed:

rg -n 'build-riscv64-linux-gnu-spacemit\.sh' --type-list

Repository: k2-fsa/sherpa-onnx

Length of output: 452


🏁 Script executed:

grep -r "build-riscv64-linux-gnu-spacemit" . --include="*.md" --include="*.txt" 2>/dev/null | head -20

Repository: k2-fsa/sherpa-onnx

Length of output: 44


🏁 Script executed:

rg "build-riscv64-linux-gnu-spacemit" . 2>/dev/null

Repository: k2-fsa/sherpa-onnx

Length of output: 44


Honor externally provided toolchain version instead of overriding it.

Line 4 currently forces v1.1.2, preventing environment-based customization. Wrap the assignment with parameter expansion to apply the default only when the variable is unset:

-SPACEMIT_TOOLCHAIN_VERSION=v1.1.2
+SPACEMIT_TOOLCHAIN_VERSION="${SPACEMIT_TOOLCHAIN_VERSION:-v1.1.2}"

This preserves the default behavior while allowing CI or other external callers to override the version without script modification.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
SPACEMIT_TOOLCHAIN_VERSION=v1.1.2
SPACEMIT_TOOLCHAIN=spacemit-toolchain-linux-glibc-x86_64-${SPACEMIT_TOOLCHAIN_VERSION}
DOWNLOAD_URL="https://github.com/spacemit-com/toolchain/releases/download/${SPACEMIT_TOOLCHAIN_VERSION}/${SPACEMIT_TOOLCHAIN}.tar.xz"
DOWNLOAD_FILE="./${SPACEMIT_TOOLCHAIN}.tar.xz"
SPACEMIT_TOOLCHAIN_VERSION="${SPACEMIT_TOOLCHAIN_VERSION:-v1.1.2}"
SPACEMIT_TOOLCHAIN=spacemit-toolchain-linux-glibc-x86_64-${SPACEMIT_TOOLCHAIN_VERSION}
DOWNLOAD_URL="https://github.com/spacemit-com/toolchain/releases/download/${SPACEMIT_TOOLCHAIN_VERSION}/${SPACEMIT_TOOLCHAIN}.tar.xz"
DOWNLOAD_FILE="./${SPACEMIT_TOOLCHAIN}.tar.xz"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@build-riscv64-linux-gnu-spacemit.sh` around lines 4 - 7, The script currently
unconditionally sets SPACEMIT_TOOLCHAIN_VERSION to v1.1.2; change the assignment
so it only uses that default when the environment hasn't provided a value (use
shell parameter expansion on SPACEMIT_TOOLCHAIN_VERSION). Keep the subsequent
variables SPACEMIT_TOOLCHAIN, DOWNLOAD_URL, and DOWNLOAD_FILE intact so they
derive from SPACEMIT_TOOLCHAIN_VERSION; this lets CI or callers override
SPACEMIT_TOOLCHAIN_VERSION externally while preserving the default.


if [ -n "$RISCV_ROOT_PATH" ] && [ -d "$RISCV_ROOT_PATH" ]; then
echo "LOCAL RISCV_ROOT_PATH: $RISCV_ROOT_PATH"
Expand Down
Loading