Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

G36maid
Copy link

@G36maid G36maid commented Jul 4, 2025

Fixes #2
Improves upon PR: #11

This PR introduces a GitHub Actions CI workflow that:

  • Builds the Linmo kernel using the GNU RISC-V toolchain
  • Runs selected apps (hello, cpubench, etc.) via QEMU
  • Extracts and comments test results back to PRs
  • Moves toolchain setup, build logic, and test execution to .ci/ scripts
  • Enhances maintainability and readability of the CI workflow

Features:

  • Supports running multiple apps at once via run-qemu-tests.sh

Limitations:

  • Current test apps are not suitable for general regression testing
    → Need a more standardized test app in future

Copy link
Contributor

@jserv jserv left a 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.

Comment on lines 23 to 29
- name: Setup RISC-V Toolchain
run: .ci/setup-toolchain.sh

- name: Verify toolchain installation
run: |
riscv32-unknown-elf-gcc --version
qemu-system-riscv32 --version
env:
CROSS_COMPILE: riscv32-unknown-elf-
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validate with LLVM based toolchains as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this project support LLVM/Clang ?
I think the makefile and the /arch/riscv/build.mk does not support LLVM/Clang.

CC = $(CROSS_COMPILE)gcc          
LD = $(CROSS_COMPILE)ld          
AR = $(CROSS_COMPILE)ar           
DUMP = $(CROSS_COMPILE)objdump   

LDFLAGS = -melf32lriscv --gc-sections    
ASFLAGS = -march=rv32imzicsr -mabi=ilp32 

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this project support LLVM/Clang ? I think the makefile and the /arch/riscv/build.mk does not support LLVM/Clang.

Send a pull request for flexible CROSS_COMPILE.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

work in progress.

@jserv
Copy link
Contributor

jserv commented Jul 4, 2025

There should be only a commit, discarding unrelated ones.

@G36maid
Copy link
Author

G36maid commented Jul 4, 2025

Rebase the latest main branch.

Already.

There should be only a commit, discarding unrelated ones.

Sure.

@jserv
Copy link
Contributor

jserv commented Jul 4, 2025

Rebase the latest main branch.
Already.

No, you didn't.
commits

This pull request should contain only your own commit(s) rather than the existing ones.

@G36maid
Copy link
Author

G36maid commented Jul 4, 2025

Rebase the latest main branch.

Already.

No, you didn't.

commits

This pull request should contain only your own commit(s) rather than the existing ones.

You’re right — I did rebase onto the latest main, but I intentionally kept the existing upstream commits.

I’ll drop or squash them shortly, thank again for pointing it out.

Copy link
Contributor

@jserv jserv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check https://cbea.ms/git-commit/ carefully and rework git commit messages.

@G36maid G36maid requested a review from jserv July 5, 2025 03:37
@G36maid G36maid force-pushed the ci branch 2 times, most recently from 761c4b2 to bdf027c Compare July 5, 2025 03:56

on:
push:
branches: [main, ci]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is 'ci' branch ?

Copy link
Author

@G36maid G36maid Jul 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That ci branch was my temporary testing branch.
I've updated the workflow so the CI runs on all branches by default.

#!/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"
Copy link
Contributor

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.

Copy link
Author

@G36maid G36maid Jul 5, 2025

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.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable CI via GitHub Actions
3 participants