@@ -223,11 +223,20 @@ jobs:
223223 os : ubuntu-24.04-arm
224224 compiler : clang
225225 arm_linux : true
226+ - name : Ubuntu RISC-V GCC without luaJIT (QEMU)
227+ os : ubuntu-24.04
228+ riscv_toolchain : true
229+ riscv_toolchain_url : " https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2025.07.03/riscv64-glibc-ubuntu-24.04-gcc-nightly-2025.07.03-nightly.tar.xz"
230+ cmake_crosscompiling : -DCMAKE_CROSSCOMPILING=TRUE
231+ cmake_system_name : -DCMAKE_SYSTEM_NAME=Linux
232+ cmake_system_processor : -DCMAKE_SYSTEM_PROCESSOR=riscv64
233+ without_luajit : -DENABLE_LUAJIT=OFF
226234
227235 runs-on : ${{ matrix.os }}
228236 env :
229237 SONARCLOUD_OUTPUT_DIR : sonarcloud-data
230238 FORCE_JAVASCRIPT_ACTIONS_TO_NODE20 : true
239+ RISCV_PATH : " /opt/riscv"
231240 steps :
232241 - name : Setup macOS
233242 if : ${{ startsWith(matrix.os, 'macos') }}
@@ -253,6 +262,20 @@ jobs:
253262 if : ${{ matrix.arm_linux }}
254263 run : |
255264 sudo apt install -y git build-essential cmake libtool python3 python3-pip libssl-dev
265+ - name : Setup RISC-V Toolchain
266+ if : ${{ matrix.riscv_toolchain }}
267+ run : |
268+ sudo apt install -y wget build-essential cmake git python3 \
269+ libgflags-dev libsnappy-dev zlib1g-dev liblz4-dev libzstd-dev \
270+ qemu-user qemu-user-static
271+ sudo mkdir -p $RISCV_PATH
272+ wget "${{ matrix.riscv_toolchain_url }}" -O riscv-toolchain.tar.xz
273+ sudo tar -xvf riscv-toolchain.tar.xz -C $RISCV_PATH --strip-components=1
274+ sudo sed -i "s|libdir='/mnt/riscv/riscv64-unknown-linux-gnu/lib'|libdir='$RISCV_PATH/riscv64-unknown-linux-gnu/lib'|g" \
275+ $RISCV_PATH/riscv64-unknown-linux-gnu/lib/libatomic.la
276+ echo "PATH=$RISCV_PATH/bin:$PATH" >> $GITHUB_ENV
277+ echo "LD_LIBRARY_PATH=/opt/riscv/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
278+ echo "QEMU_LD_PREFIX=$RISCV_PATH/sysroot" >> $GITHUB_ENV
256279
257280 - name : Cache redis
258281 id : cache-redis
@@ -298,7 +321,7 @@ jobs:
298321 if : ${{ matrix.sonarcloud }}
299322
300323 - name : Build Kvrocks
301- if : ${{ !matrix.sonarcloud }}
324+ if : ${{ !matrix.sonarcloud && !matrix.riscv_toolchain }}
302325 run : |
303326 ./x.py build -j$NPROC --unittest --compiler ${{ matrix.compiler }} ${{ matrix.without_jemalloc }} \
304327 ${{ matrix.without_luajit }} ${{ matrix.with_ninja }} ${{ matrix.with_sanitizer }} ${{ matrix.with_openssl }} \
@@ -311,6 +334,14 @@ jobs:
311334 cp -r build _build
312335 build-wrapper-linux-x86-64 --out-dir ${{ env.SONARCLOUD_OUTPUT_DIR }} ./x.py build -j$NPROC --unittest --compiler ${{ matrix.compiler }} ${{ matrix.sonarcloud }}
313336
337+ - name : Build Kvrocks (RISC-V)
338+ if : ${{ matrix.riscv_toolchain }}
339+ run : |
340+ CC=riscv64-unknown-linux-gnu-gcc \
341+ CXX=riscv64-unknown-linux-gnu-g++ \
342+ ./x.py build -j$NPROC --unittest ${{ matrix.cmake_crosscompiling }} ${{ matrix.cmake_system_name }} \
343+ ${{ matrix.cmake_system_processor }} ${{ matrix.without_luajit }}
344+
314345 - name : Setup Coredump
315346 if : ${{ startsWith(matrix.os, 'ubuntu') }}
316347 run : |
@@ -325,6 +356,7 @@ jobs:
325356 ./x.py test cpp
326357
327358 - name : Run Go Integration Cases
359+ if : ${{ !matrix.riscv_toolchain }}
328360 run : |
329361 ulimit -c unlimited
330362 export LSAN_OPTIONS="suppressions=$(realpath ./tests/lsan-suppressions)"
0 commit comments