@@ -223,11 +223,21 @@ 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+ toolchain_file : cmake/riscv64.cmake
230+ 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"
231+ cmake_crosscompiling : -DCMAKE_CROSSCOMPILING=TRUE
232+ cmake_system_name : -DCMAKE_SYSTEM_NAME=Linux
233+ cmake_system_processor : -DCMAKE_SYSTEM_PROCESSOR=riscv64
234+ without_luajit : -DENABLE_LUAJIT=OFF
226235
227236 runs-on : ${{ matrix.os }}
228237 env :
229238 SONARCLOUD_OUTPUT_DIR : sonarcloud-data
230239 FORCE_JAVASCRIPT_ACTIONS_TO_NODE20 : true
240+ RISCV_PATH : " /opt/riscv"
231241 steps :
232242 - name : Setup macOS
233243 if : ${{ startsWith(matrix.os, 'macos') }}
@@ -253,6 +263,20 @@ jobs:
253263 if : ${{ matrix.arm_linux }}
254264 run : |
255265 sudo apt install -y git build-essential cmake libtool python3 python3-pip libssl-dev
266+ - name : Setup RISC-V Toolchain
267+ if : ${{ matrix.riscv_toolchain }}
268+ run : |
269+ sudo apt install -y wget build-essential cmake git python3 \
270+ libgflags-dev libsnappy-dev zlib1g-dev liblz4-dev libzstd-dev \
271+ qemu-user qemu-user-static
272+ sudo mkdir -p $RISCV_PATH
273+ wget "${{ matrix.riscv_toolchain_url }}" -O riscv-toolchain.tar.xz
274+ sudo tar -xvf riscv-toolchain.tar.xz -C $RISCV_PATH --strip-components=1
275+ sudo sed -i "s|libdir='/mnt/riscv/riscv64-unknown-linux-gnu/lib'|libdir='$RISCV_PATH/riscv64-unknown-linux-gnu/lib'|g" \
276+ $RISCV_PATH/riscv64-unknown-linux-gnu/lib/libatomic.la
277+ echo "PATH=$RISCV_PATH/bin:$PATH" >> $GITHUB_ENV
278+ echo "LD_LIBRARY_PATH=/opt/riscv/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
279+ echo "QEMU_LD_PREFIX=$RISCV_PATH/sysroot" >> $GITHUB_ENV
256280
257281 - name : Cache redis
258282 id : cache-redis
@@ -298,7 +322,7 @@ jobs:
298322 if : ${{ matrix.sonarcloud }}
299323
300324 - name : Build Kvrocks
301- if : ${{ !matrix.sonarcloud }}
325+ if : ${{ !matrix.sonarcloud && !matrix.riscv_toolchain }}
302326 run : |
303327 ./x.py build -j$NPROC --unittest --compiler ${{ matrix.compiler }} ${{ matrix.without_jemalloc }} \
304328 ${{ matrix.without_luajit }} ${{ matrix.with_ninja }} ${{ matrix.with_sanitizer }} ${{ matrix.with_openssl }} \
@@ -311,6 +335,11 @@ jobs:
311335 cp -r build _build
312336 build-wrapper-linux-x86-64 --out-dir ${{ env.SONARCLOUD_OUTPUT_DIR }} ./x.py build -j$NPROC --unittest --compiler ${{ matrix.compiler }} ${{ matrix.sonarcloud }}
313337
338+ - name : Build Kvrocks (RISC-V)
339+ if : ${{ matrix.riscv_toolchain }}
340+ run : |
341+ ./x.py build -j$NPROC --unittest --toolchain ${{ matrix.toolchain_file }}
342+
314343 - name : Setup Coredump
315344 if : ${{ startsWith(matrix.os, 'ubuntu') }}
316345 run : |
0 commit comments