riscv: add GitHub Actions workflow for RISC-V testing with QEMU (#1) #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: RISC-V Testing | |
| on: | |
| push: | |
| branches: | |
| - riscv | |
| - v2.1-riscv64 | |
| jobs: | |
| test-riscv: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| strategy: | |
| matrix: | |
| qemu-cpu: [rv64, rva22u64] | |
| steps: | |
| - name: Checkout LuaJIT | |
| uses: actions/checkout@v4 | |
| - name: Install RISC-V toolchain and QEMU | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| gcc-riscv64-linux-gnu \ | |
| qemu-user-static | |
| - name: Build LuaJIT for RISC-V | |
| run: | | |
| make clean | |
| make -j \ | |
| CROSS=riscv64-linux-gnu- \ | |
| BUILDMODE=mixed \ | |
| CCOPT="-O2 -fomir-fram-pointer" \ | |
| CFLAGS_riscv64="-march=rv64gc" \ | |
| # Note: Building with baseline rv64gc ISA for maximum compatibility. | |
| # CPU-specific features are tested via QEMU's -cpu flag at runtime. | |
| - name: Verify LuaJIT binary | |
| run: | | |
| file src/luajit | |
| qemu-riscv64-static -cpu ${{ matrix.cpu }} src/luajit -v | |
| - name: Checkout LuaJIT-test-cleanup | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: LuaJIT/LuaJIT-test-cleanup | |
| path: test-suite | |
| - name: Run LuaJIT test suite with ${{ matrix.cpu }} | |
| run: | | |
| cd test-suite | |
| echo "Running tests with CPU: ${{ matrix.cpu }}" | |
| for i in {1..372} {374..379} {381..517}; do | |
| qemu-riscv64-static -cpu ${{ matrix.qemu-cpu }} -L /usr/riscv64-linux-gnu \ | |
| ../src/luajit test/test.lua +slow $i | |
| done |