-
Notifications
You must be signed in to change notification settings - Fork 17
Utilize GitHub Actions for building and running via QEMU #12
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
base: main
Are you sure you want to change the base?
Conversation
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.
Rebase the latest main
branch.
There should be only a commit, discarding unrelated ones. |
Already.
Sure. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
761c4b2
to
bdf027c
Compare
.ci/setup-toolchain.sh
Outdated
#!/bin/bash | ||
set -e | ||
|
||
URL="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" |
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.
May I know the reason why you download ubuntu-22.04
toolchain ?
Since your runner is ubuntu-24.04
.
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 noticed the same problem while working on LLVM support, so I temporarily included the updated setup-toolchain.sh
with LLVM support in this PR.
Please have a look.
3839694
to
cc104df
Compare
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.
Carefully read https://cbea.ms/git-commit/ and strictly apply its rules when writing full sentences in commit messages.
.github/workflows/ci.yml
Outdated
- name: Verify toolchain installation | ||
run: | | ||
riscv32-unknown-elf-gcc --version | ||
qemu-system-riscv32 --version | ||
env: | ||
CROSS_COMPILE: riscv32-unknown-elf- | ||
|
||
- name: Build Kernel | ||
run: | | ||
make clean | ||
make | ||
env: | ||
CROSS_COMPILE: riscv32-unknown-elf- |
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.
Use a matrix strategy for both GNU and LLVM toolchains.
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'm almost already done, but some build tests failed on LLVM, so I'm trying to find out if it's the makefile/toolchain problem or the kernel itself.
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.
here is the latest run: https://github.com/G36maid/linmo/actions/runs/16087958296
you can see
CC build/kernel/pipe.o
kernel/pipe.c:37:20: error: unused function 'pipe_get_byte' [-Werror,-Wunused-function]
37 | static inline char pipe_get_byte(pipe_t *p)
| ^~~~~~~~~~~~~
kernel/pipe.c:45:20: error: unused function 'pipe_put_byte' [-Werror,-Wunused-function]
45 | static inline void pipe_put_byte(pipe_t *p, char c)
| ^~~~~~~~~~~~~
2 errors generated.
make: *** [Makefile:53: build/kernel/pipe.o] Error 1
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.
Send pull request(s) regarding LLVM compilation.
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.
see #14
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.
Always rebase properly.
I'll make sure to rebase properly before merging. For now, I prefer to keep the commits. |
f29486c
to
e792176
Compare
This commit introduces initial support for compiling the RISC-V target using the LLVM toolchain. Add CI workflow to build and test with QEMU Introduce GitHub Actions-based CI that builds the kernel using the GNU RISC-V toolchain and runs selected apps (e.g., cpubench) in QEMU. Results are extracted and posted to PRs. Toolchain setup, build, and QEMU test logic are modularized into scripts in .ci/. Features: - Support multiple apps per run - CI comments results on PR automatically - Timeout prevents hangs Limitations: - Currently GNU-only (LLVM WIP) - cpubench doesn't exit cleanly due to preemptive mode Fixes: #2 Supersedes: sysprog21#11 Refactor riscv build.mk toolchain selection logic Add CI workflow for building and testing Improve CI workflow with QEMU, cpubench, timeout I notice that the cpu bench will make qemu into Scheduler mode: Preemptive so the qemu will not stop, add some trick to pass the test(not good) Refactor CI workflow for improved toolchain usage Comment out hello build and run step in CI workflow Update RISC-V toolchain and enable hello build step Add -bios none to QEMU commands in CI workflow Remove hello build and run step from CI workflow Add timeout to QEMU command in CI workflow Add completion message to cpubench CI step Allow QEMU step to pass without stopping CI job ci: refactor QEMU test workflow and extract scripts The workflow now extracts cpubench results from QEMU output and automatically comments the result on pull requests. Improve CI workflow with QEMU, cpubench, timeout I notice that the cpu bench will make qemu into Scheduler mode: Preemptive so the qemu will not stop, add some trick to pass the test(not good) Refactor CI workflow for improved toolchain usage Comment out hello build and run step in CI workflow Update RISC-V toolchain and enable hello build step Add -bios none to QEMU commands in CI workflow Remove hello build and run step from CI workflow Add timeout to QEMU command in CI workflow Add completion message to cpubench CI step Allow QEMU step to pass without stopping CI job Fix merge conflict markers in CI workflow file Use Ubuntu 24.04 in CI workflow Remove merge conflict markers from error.c Remove merge conflict markers from error.h Remove redundant libc.h include from libc.c Delete libc.c Add CI scripts and refactor workflow - Move toolchain setup, build, QEMU run, and result extraction to dedicated scripts in .ci/ - Update ci.yml to use these scripts for improved maintainability Make CI scripts executable Add flexible test sequencing and CI test suites - Replace run-qemu.sh with run-test-sequence.sh for configurable, robust test execution (supports timeouts, app lists, output dirs, continue-on-failure, and verbosity) - Add run-qemu-tests.sh for simple sequential app testing - Add test suite definitions: basic.txt, performance.txt, comprehensive.txt - Overhaul extract-result.sh to aggregate, summarize, and format results for GitHub Actions and artifacts - Update CI workflow to run multiple test suites (basic, performance, comprehensive, custom), upload artifacts, and generate a consolidated summary - Remove obsolete run-qemu.sh script Simplify CI test runner and result extraction Comment PR with benchmark results in CI workflow Run all basic apps in CI and comment results on PRs Remove extract-result.sh and update CI to inline test output Update QEMU tests to run cpubench and test64 only Inline build steps in CI workflow and remove build.sh Add LLVM toolchain support to CI and build system Remove test-summary job from CI workflow Update toolchain URLs and add CI test summary job Remove test64 argument from QEMU test script in CI Refactor toolchain URLs and add LLVM fallback in CI workflow Set CROSS_COMPILE to riscv32-unknown-elf- in CI setup Add AR=llvm-ar to LLVM toolchain environment setup Refactor toolchain URL to use TOOLCHAIN_OS variable Refactor RISC-V toolchain selection and defaults Run CI on all branches and pull requests Add __maybe_unused macro for unused attribute Use GNU ar instead of llvm-ar for LLVM toolchain Update toolchain version to verified Detect Clang toolchain in RISC-V build script
Do these results match what we wanted? |
This PR introduces a GitHub Actions CI workflow that:
Features:
run-qemu-tests.sh
Limitations:
→ Need a more standardized test app in future
Fix #2