11name : Linmo CI (GNU Only)
22
33on :
4- push :
5- branches : [main, ci]
6- pull_request :
7- branches : [main, ci]
4+ push :
5+ branches : [main, ci]
6+ pull_request :
7+ branches : [main, ci]
88
99jobs :
10- test :
11- runs-on : ubuntu-latest
12-
13- steps :
14- - name : Checkout
15- uses : actions/checkout@v4
16-
17- - name : Install dependencies
18- run : |
19- sudo apt-get update
20- sudo apt-get install -y build-essential qemu-system-riscv32 wget
21-
22- - name : Download RISC-V GNU Toolchain
23- run : |
24- wget https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2025.06.13/riscv32-elf-ubuntu-22.04-gcc-nightly-2025.06.13-nightly.tar.xz
25- tar -xf riscv32-elf-ubuntu-22.04-gcc-nightly-2025.06.13-nightly.tar.xz
26- echo "$PWD/riscv/bin" >> $GITHUB_PATH
27-
28- - name : Verify toolchain installation
29- run : |
30- riscv32-unknown-elf-gcc --version
31- qemu-system-riscv32 --version
32- env :
33- CROSS_COMPILE : riscv32-unknown-elf-
34-
35- - name : Build Linmo kernel
36- run : |
37- make clean
38- make
39- env :
40- CROSS_COMPILE : riscv32-unknown-elf-
41-
42- - name : Build and run cpubench
43- run : |
44- make clean
45- make cpubench
46- timeout 5s qemu-system-riscv32 -nographic -machine virt -bios none -kernel build/image.elf || true
47- echo "cpubench completed"
48- env :
49- CROSS_COMPILE : riscv32-unknown-elf-
10+ test :
11+ runs-on : ubuntu-latest
12+
13+ steps :
14+ - name : Checkout
15+ uses : actions/checkout@v4
16+
17+ - name : Install dependencies
18+ run : |
19+ sudo apt-get update
20+ sudo apt-get install -y build-essential qemu-system-riscv32 wget
21+
22+ - name : Download RISC-V GNU Toolchain
23+ run : |
24+ wget https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2025.06.13/riscv32-elf-ubuntu-22.04-gcc-nightly-2025.06.13-nightly.tar.xz
25+ tar -xf riscv32-elf-ubuntu-22.04-gcc-nightly-2025.06.13-nightly.tar.xz
26+ echo "$PWD/riscv/bin" >> $GITHUB_PATH
27+
28+ - name : Verify toolchain installation
29+ run : |
30+ riscv32-unknown-elf-gcc --version
31+ qemu-system-riscv32 --version
32+ env :
33+ CROSS_COMPILE : riscv32-unknown-elf-
34+
35+ - name : Build Linmo kernel
36+ run : |
37+ make clean
38+ make
39+ env :
40+ CROSS_COMPILE : riscv32-unknown-elf-
41+
42+ - name : Build and run cpubench
43+ run : |
44+ make clean
45+ make cpubench
46+ set +e
47+ timeout 5s qemu-system-riscv32 -nographic -machine virt -bios none -kernel build/image.elf | tee qemu_output.txt
48+ echo "cpubench completed" >> qemu_output.txt
49+ set -e
50+ env :
51+ CROSS_COMPILE : riscv32-unknown-elf-
52+
53+ - name : Extract benchmark result
54+ id : extract
55+ run : |
56+ grep -E "Result:|Elapsed time" qemu_output.txt > result.txt || echo "Result not found" > result.txt
57+ echo "result<<EOF" >> $GITHUB_OUTPUT
58+ cat result.txt >> $GITHUB_OUTPUT
59+ echo "EOF" >> $GITHUB_OUTPUT
60+
61+ - name : Comment result to PR
62+ if : github.event_name == 'pull_request'
63+ uses : peter-evans/create-or-update-comment@v4
64+ with :
65+ token : ${{ secrets.GITHUB_TOKEN }}
66+ issue-number : ${{ github.event.pull_request.number }}
67+ body : |
68+ ✅ **cpubench test result**
69+ ```
70+ ${{ steps.extract.outputs.result }}
71+ ```
0 commit comments