Skip to content

Conversation

@G36maid
Copy link
Contributor

@G36maid G36maid commented Jul 4, 2025

Implement GitHub Actions CI pipeline for testing Linmo across GNU and
LLVM RISC-V toolchains with automated reporting.

Objective: Ensure the Linmo kernel builds cleanly with both supported toolchains

Features:

  • Builds Linmo kernel with both supported toolchains
  • Matrix testing for GNU and LLVM toolchains
  • Automated app discovery and crash detection
  • Functional test framework with criterion-based validation
  • TOML-based result aggregation across toolchains
  • Automated PR comments with detailed test results
  • Proper failure handling and artifact collection

Components:

  • .ci/ci-tools.sh: Unified tool for data collection, aggregation,
    and PR comment formatting
  • .ci/run-app-tests.sh: Automated app testing with QEMU
  • .ci/run-functional-tests.sh: Criterion-based functional tests
  • .ci/setup-toolchain.sh: Automated toolchain installation
  • .github/workflows/ci.yml: Complete CI workflow with summary job
  • arch/riscv/build.mk: Builds Linmo kernel with both supported toolchains

The workflow ensures all tests run to completion, captures full output
for debugging, and fails CI based on the aggregated overall status

Slove #2

  • step1 : Build Linmo Kernel
  • step2 : Application Crash Sanity Check
  • step3 : Run Dedicated Functional Tests (partial)

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.

@jserv
Copy link
Contributor

jserv commented Jul 4, 2025

There should be only a commit, discarding unrelated ones.

@G36maid
Copy link
Contributor Author

G36maid commented Jul 4, 2025

Rebase the latest main branch.

Already.

There should be only a commit, discarding unrelated ones.

Sure.

@jserv

This comment was marked as resolved.

@G36maid

This comment was marked as resolved.

jserv

This comment was marked as duplicate.

@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
@G36maid G36maid force-pushed the ci branch 2 times, most recently from 3839694 to cc104df Compare July 5, 2025 12:02
@G36maid G36maid requested a review from Damien-Chen July 5, 2025 12:28
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.

Carefully read https://cbea.ms/git-commit/ and strictly apply its rules when writing full sentences in commit messages.

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.

Always rebase properly.

@G36maid
Copy link
Contributor Author

G36maid commented Jul 7, 2025

Always rebase properly.

I'll make sure to rebase properly before merging. For now, I prefer to keep the commits.
Once everything is finalized, I'll squash or clean them up as needed.

@G36maid G36maid force-pushed the ci branch 3 times, most recently from e792176 to 7c49a01 Compare July 7, 2025 06:57
@G36maid
Copy link
Contributor Author

G36maid commented Jul 7, 2025

Do these results match what we wanted?
@jserv @Damien-Chen
Please check this run:
G36maid#6 (comment)

@G36maid G36maid force-pushed the ci branch 2 times, most recently from 56fb4bf to e9e6c21 Compare October 23, 2025 05:16
@sysprog21 sysprog21 deleted a comment from cubic-dev-ai bot Oct 23, 2025
@sysprog21 sysprog21 deleted a comment from cubic-dev-ai bot Oct 23, 2025
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

6 issues found across 7 files

Prompt for AI agents (all 6 issues)

Understand the root cause of the following 6 issues and fix them.


<file name=".ci/run-app-tests.sh">

<violation number="1" location=".ci/run-app-tests.sh:32">
Treating exit code 124 as success causes hung QEMU runs to be marked as passing; exit status 124 from `timeout` indicates the command timed out, so this branch should fail the test instead.</violation>
</file>

<file name="arch/riscv/build.mk">

<violation number="1" location="arch/riscv/build.mk:22">
The clang-toolchain detection probes $(CROSS_COMPILE)gcc, so on LLVM jobs (where only riscv32-unknown-elf-clang is installed) CC_IS_CLANG remains empty and CC falls back to the nonexistent riscv32-unknown-elf-gcc, breaking the LLVM build.</violation>
</file>

<file name=".ci/run-functional-tests.sh">

<violation number="1" location=".ci/run-functional-tests.sh:79">
A timeout from the QEMU run (exit code 124) is currently treated the same as a clean exit, so a test that hangs after emitting the PASS lines will still be marked as passing. Please fail the test when timeout terminates QEMU to avoid masking hangs.</violation>
</file>

<file name=".ci/ci-tools.sh">

<violation number="1" location=".ci/ci-tools.sh:187">
The aggregated GNU app entries are written as `app=passed`, which is invalid TOML because the string value is unquoted. This makes the generated summary file unparsable; please quote both the key and value here (and update the matching LLVM line as well).</violation>

<violation number="2" location=".ci/ci-tools.sh:197">
Functional test results are emitted as `test=passed` without quotes, yielding invalid TOML in the `[gnu.functional_tests]` section. Please emit quoted keys/values here (and mirror the change for the LLVM line).</violation>

<violation number="3" location=".ci/ci-tools.sh:207">
Functional criteria entries are written as `fft:max_error=passed`, leaving both the key (contains a colon) and the string value unquoted, which violates TOML syntax. Quote the key and value here (and apply the same adjustment to the LLVM line).</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Ask questions if you need clarification on any suggestion

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

4 issues found across 7 files

Prompt for AI agents (all 4 issues)

Understand the root cause of the following 4 issues and fix them.


<file name=".ci/run-app-tests.sh">

<violation number="1" location=".ci/run-app-tests.sh:32">
Treating exit code 124 (timeout) as a pass causes hung QEMU runs to be reported as successful. A timeout should fail the test instead of being marked as passed.</violation>
</file>

<file name=".ci/ci-tools.sh">

<violation number="1" location=".ci/ci-tools.sh:187">
The GNU apps entries are emitted as `key=value` without spaces or quotes, so the generated TOML is invalid and format_comment cannot parse the section.</violation>

<violation number="2" location=".ci/ci-tools.sh:197">
GNU functional test entries are emitted without TOML-compliant formatting, preventing format_comment from parsing and making the TOML invalid.</violation>

<violation number="3" location=".ci/ci-tools.sh:207">
GNU functional criteria entries are written as `key=value`, which is not valid TOML and breaks parsing of the criteria section.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

@G36maid G36maid force-pushed the ci branch 2 times, most recently from 182b393 to 68cab6a Compare October 23, 2025 06:53
@G36maid G36maid marked this pull request as ready for review October 23, 2025 06:53
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

3 issues found across 6 files

Prompt for AI agents (all 3 issues)

Understand the root cause of the following 3 issues and fix them.


<file name=".ci/run-app-tests.sh">

<violation number="1" location=".ci/run-app-tests.sh:32">
A timeout (exit code 124 from `timeout`) indicates the QEMU run hung, but this branch treats it as a pass. That masks failures and lets broken apps appear healthy; only exit code 0 should be considered passing.</violation>
</file>

<file name="arch/riscv/build.mk">

<violation number="1" location="arch/riscv/build.mk:22">
The clang detection runs $(CROSS_COMPILE)gcc --version, but the LLVM toolchain only ships $(CROSS_COMPILE)clang, so CC_IS_CLANG never becomes 1 and the build selects the missing GNU binaries, breaking LLVM builds.</violation>
</file>

<file name=".ci/ci-tools.sh">

<violation number="1" location=".ci/ci-tools.sh:187">
The aggregated gnu apps section writes values like `app1=passed` without quotes, producing invalid TOML that downstream tools cannot parse.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

@G36maid G36maid force-pushed the ci branch 5 times, most recently from cf192bf to c89b134 Compare October 23, 2025 08:16
@sysprog21 sysprog21 deleted a comment from cubic-dev-ai bot Oct 23, 2025
@sysprog21 sysprog21 deleted a comment from G36maid Oct 23, 2025
@sysprog21 sysprog21 deleted a comment from cubic-dev-ai bot Oct 23, 2025
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 6 files

Implement GitHub Actions CI pipeline for testing Linmo across GNU and
LLVM RISC-V toolchains with automated reporting.

Features:
- Matrix testing for GNU and LLVM toolchains
- Automated app discovery and crash detection
- Functional test framework with criterion-based validation
- TOML-based result aggregation across toolchains
- Automated PR comments with detailed test results
- Proper failure handling and artifact collection

Components:
- .ci/ci-tools.sh: Unified tool for data collection, aggregation,
  and PR comment formatting
- .ci/run-app-tests.sh: Automated app testing with QEMU
- .ci/run-functional-tests.sh: Criterion-based functional tests
- .ci/setup-toolchain.sh: Automated toolchain installation
- .github/workflows/ci.yml: Complete CI workflow with summary job

The workflow ensures all tests run to completion, captures full output
for debugging, and fails CI based on the aggregated overall status.
CROSS_COMPILE ?= riscv-none-elf-

# Detect LLVM/Clang toolchain (allow user override)
CC_IS_CLANG ?= $(shell $(CROSS_COMPILE)clang --version 2>/dev/null | grep -qi clang && echo 1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Again, why does this PR include adding LLVM support, while the description makes it look like it's only adding CI tests?

Copy link
Contributor Author

@G36maid G36maid Oct 24, 2025

Choose a reason for hiding this comment

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

Sorry, just updated the description.
It’s based on a single issue that covers both CI and LLVM support.
Would you prefer that I split it into separate PRs?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, or IMHO, at least they should be in separate commits.
Ref: https://www.kernel.org/doc/html/v6.17/process/submitting-patches.html#separate-your-changes

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.

4 participants