Skip to content

Commit 82524de

Browse files
authored
Merge pull request #1 from G36maid/ci
Merge pull request #1 from G36maid/ci
2 parents 5c5f004 + 9e786fd commit 82524de

File tree

1 file changed

+66
-44
lines changed

1 file changed

+66
-44
lines changed

.github/workflows/ci.yml

Lines changed: 66 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,71 @@
11
name: Linmo CI (GNU Only)
22

33
on:
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

99
jobs:
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

Comments
 (0)