-
Notifications
You must be signed in to change notification settings - Fork 18
Utilize GitHub Actions for building and running via QEMU #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7e182f6
Add CI workflow for building and testing
G36maid c5c8369
Improve CI workflow with QEMU, cpubench, timeout
G36maid cd2f6cc
Constify error_desc and perror
visitorckw 47028a4
Correct return type of strlen function
Damien-Chen 6b935dc
Ensure consistent indention
jserv 4e2656f
Add benchmark extraction and PR comment to CI workflow
G36maid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Linmo CI (GNU Only) | ||
|
||
on: | ||
push: | ||
branches: [main, ci] | ||
pull_request: | ||
branches: [main, ci] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-24.04 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y build-essential qemu-system-riscv32 wget | ||
|
||
- name: Download RISC-V GNU Toolchain | ||
run: | | ||
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 | ||
tar -xf riscv32-elf-ubuntu-22.04-gcc-nightly-2025.06.13-nightly.tar.xz | ||
echo "$PWD/riscv/bin" >> $GITHUB_PATH | ||
|
||
- name: Verify toolchain installation | ||
run: | | ||
riscv32-unknown-elf-gcc --version | ||
qemu-system-riscv32 --version | ||
env: | ||
CROSS_COMPILE: riscv32-unknown-elf- | ||
|
||
- name: Build Linmo kernel | ||
run: | | ||
make clean | ||
make | ||
env: | ||
CROSS_COMPILE: riscv32-unknown-elf- | ||
|
||
- name: Build and run cpubench | ||
run: | | ||
make clean | ||
make cpubench | ||
set +e | ||
timeout 5s qemu-system-riscv32 -nographic -machine virt -bios none -kernel build/image.elf | tee qemu_output.txt | ||
echo "cpubench completed" >> qemu_output.txt | ||
set -e | ||
env: | ||
CROSS_COMPILE: riscv32-unknown-elf- | ||
|
||
- name: Extract benchmark result | ||
id: extract | ||
run: | | ||
grep -E "Result:|Elapsed time" qemu_output.txt > result.txt || echo "Result not found" > result.txt | ||
echo "result<<EOF" >> $GITHUB_OUTPUT | ||
cat result.txt >> $GITHUB_OUTPUT | ||
echo "EOF" >> $GITHUB_OUTPUT | ||
|
||
- name: Comment result to PR | ||
if: github.event_name == 'pull_request' | ||
uses: peter-evans/create-or-update-comment@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body: | | ||
✅ **cpubench test result** | ||
``` | ||
${{ steps.extract.outputs.result }} | ||
``` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to dedicated scripts. See https://github.com/sysprog21/rv32emu/tree/master/.ci for reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you prefer keeping the scripts in a
.ci/
directory (as in rv32emu),or splitting them into a more general
scripts/
directory for better reuse —for example, by developers who want to build and run the kernel locally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All CI-specific scripts should be placed in the .
ci
directory, as they are not intended for general use.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got it.