Skip to content

Conversation

@singul4ri7y
Copy link

@singul4ri7y singul4ri7y commented Aug 28, 2025

  • Added riscv-tests.yml GitHub workflow script in .github/workflows/ enabling RISC-V testing on a static QEMU RISC-V64 VM via cross-compilation.
  • Parallelized the tests for overall faster execution.
  • Also parallelized test execution for all the other platforms.

Summary by CodeRabbit

  • Tests

    • Added CI workflow to build and run tests for a RISC‑V (riscv64) target using emulation; test logs/artifacts uploaded on failures.
    • Tests now run in parallel to speed up execution.
  • Chores

    • Enabled build caching in CI to speed runs and avoid redundant installs.
    • Standardized Release build configuration for CI.
    • Adjusted workflow triggers to reduce redundant runs and include the RISC‑V test workflow on relevant branches/PRs.

@coderabbitai
Copy link

coderabbitai bot commented Aug 28, 2025

Walkthrough

Adds a new GitHub Actions workflow to build and test the project for riscv64 under QEMU (cross-compilation, cache, install toolchain, run tests) and updates the existing CMake CI to run on pushes to main only and execute ctest in parallel.

Changes

Cohort / File(s) Summary
New CI: RISC‑V tests
.github/workflows/riscv-tests.yml
Adds a "RISC-V Tests" workflow triggered on pushes to main and riscv-tests and PRs to main; computes a cache key from sources, restores/builds a cross-compiled riscv64 build (installs qemu-user-static, riscv64 cross-toolchain, cmake, ninja), configures CMake/Ninja with cross-compilation and static linking flags, runs tests under qemu-riscv64-static, and uploads build/test logs on failure. (Note: workflow command includes an extra cmake -B build token in the CMake invocation.)
CI: CMake workflow update
.github/workflows/cmake.yml
Restricts on.push.branches to main (removed riscv) and updates the Test step to run ctest --parallel $(nproc) -C ${{env.BUILD_TYPE}} --output-on-failure to execute tests in parallel.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor Dev as Push/PR
    participant GH as GitHub Actions
    participant Runner as ubuntu-latest
    participant Cache as Actions Cache
    participant Apt as apt
    participant CMake as CMake/Ninja
    participant QEMU as qemu-riscv64-static
    participant Art as Upload Artifact

    Dev->>GH: Push to main or riscv-tests / PR to main
    GH->>Runner: Start riscv-tests job

    Runner->>Runner: Checkout repo
    Runner->>Cache: Hash sources, attempt restore
    alt cache hit
        Cache-->>Runner: restore build/
    else cache miss
        Runner->>Apt: install qemu, riscv toolchain, cmake, ninja
    end
    Runner->>CMake: configure cross-build (riscv64, static flags)
    Runner->>CMake: build with Ninja
    Runner->>QEMU: run tests via qemu-riscv64-static (parallel where applicable)
    alt tests fail
        Runner->>Art: upload build/Testing and CMake logs
    else
        Runner-->>GH: job success
    end
Loading
sequenceDiagram
    autonumber
    participant CI as CMake CI
    participant Old as ctest (serial)
    participant New as ctest (parallel)

    CI->>Old: `ctest -C ${{env.BUILD_TYPE}} --output-on-failure`
    note right of Old: Serial test execution

    CI->>New: `ctest --parallel $(nproc) -C ${{env.BUILD_TYPE}} --output-on-failure`
    note right of New: Parallel across CPU cores
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

The rabbit hops, a build to start,
Cross-compiled dreams in tiny heart.
QEMU hums, tests run in band,
Parallel paws across the land.
Logs tucked safe in a burrowed mart. 🐇


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6b52759 and f4e9f27.

📒 Files selected for processing (1)
  • .github/workflows/riscv-tests.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/riscv-tests.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Codacy Static Code Analysis
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (3)
.github/workflows/riscv-tests.yml (3)

21-25: Broaden cache key inputs to avoid stale restores.

Include common C/C++/CMake extensions.

-        echo "key=riscv-tests-${{ hashFiles('**/*.cpp', '**/*.h', '**/*.c', '**/CMakeLists.txt') }}" >> $GITHUB_OUTPUT
+        echo "key=riscv-tests-${{ hashFiles('**/*.[ch]', '**/*.[ch]pp', '**/*.cxx', '**/*.cc', '**/*.hh', '**/*.hpp', '**/CMakeLists.txt', '**/*.cmake') }}" >> $GITHUB_OUTPUT

9-12: Use BUILD_TYPE env or drop it.

Currently unused; wire it into configure/build (see above) for consistency.


33-37: Minor: prefer apt-get and no-recommends for leaner runners.

Not blocking; consider aligning with the toolchain step.

-        sudo apt update
-        sudo apt install -y qemu-user-static libc6-dev-riscv64-cross libstdc++6-riscv64-cross libgcc-s1-riscv64-cross parallel
+        sudo apt-get update
+        sudo apt-get install -y --no-install-recommends qemu-user-static libc6-dev-riscv64-cross libstdc++6-riscv64-cross libgcc-s1-riscv64-cross
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between bd1ce17 and 510937e.

📒 Files selected for processing (1)
  • .github/workflows/riscv-tests.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/riscv-tests.yml

28-28: the runner of "actions/cache@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (1)
.github/workflows/riscv-tests.yml (1)

67-76: Artifacts: verify CTest logs exist after switching to ctest.

After adopting ctest, these paths are correct. If you keep ad‑hoc runners, Testing/ may not exist.

Would you like me to add a fallback to upload build logs (e.g., build/**/LastTest.log) if Testing/ is absent?

Comment on lines 26 to 31
- name: Restore build cache
id: cache-build
uses: actions/cache@v3
with:
path: riscv-tests
key: ${{ steps.cache-key.outputs.key }}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix cache action version and path (v3 is broken; caching wrong directory).

  • actions/cache@v3 no longer runs on GitHub-hosted runners.
  • You’re caching a non-existent path (riscv-tests) while building into build.

Apply:

-    - name: Restore build cache
-      id: cache-build
-      uses: actions/cache@v3
-      with:
-        path: riscv-tests
-        key: ${{ steps.cache-key.outputs.key }}
+    - name: Restore build cache
+      id: cache-build
+      uses: actions/cache@v4
+      with:
+        path: build
+        key: ${{ runner.os }}-riscv-build-${{ steps.cache-key.outputs.key }}
+        restore-keys: |
+          ${{ runner.os }}-riscv-build-
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Restore build cache
id: cache-build
uses: actions/cache@v3
with:
path: riscv-tests
key: ${{ steps.cache-key.outputs.key }}
- name: Restore build cache
id: cache-build
uses: actions/cache@v4
with:
path: build
key: ${{ runner.os }}-riscv-build-${{ steps.cache-key.outputs.key }}
restore-keys: |
${{ runner.os }}-riscv-build-
🧰 Tools
🪛 actionlint (1.7.7)

28-28: the runner of "actions/cache@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🤖 Prompt for AI Agents
In .github/workflows/riscv-tests.yml around lines 26 to 31, the workflow is
using actions/cache@v3 (which doesn't run on GitHub-hosted runners) and is
caching the wrong directory "riscv-tests"; change the action to a supported
version (actions/cache@v2) and update the cached path to the actual build output
directory ("build") so the cache key restores the correct files; keep the
existing key input unchanged.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/cmake.yml (1)

42-48: Fix cross-platform parallelism: $(nproc) breaks on Windows/macOS shells.

Matrix includes windows-latest and macos-latest; $(nproc) is Linux/GNU only and the default shell differs per OS. Force bash and use a portable core count.

Apply:

       - name: Test
         working-directory: ${{github.workspace}}/build
         # Execute tests defined by the CMake configuration.  
         # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
         #run: ctest -V -C ${{env.BUILD_TYPE}}
-        run: ctest --parallel $(nproc) -C ${{env.BUILD_TYPE}} --output-on-failure
+        shell: bash
+        run: |
+          CORES="$(getconf _NPROCESSORS_ONLN 2>/dev/null || nproc || echo 2)"
+          ctest --parallel "$CORES" -C ${{env.BUILD_TYPE}} --output-on-failure
♻️ Duplicate comments (1)
.github/workflows/riscv-tests.yml (1)

41-60: Un-gate build on cache and fix malformed CMake command (duplicate of earlier feedback).

  • cache-hit gating skips necessary (incremental) builds and can run stale binaries.
  • Command has stray “cmake -B build cmake -B build”; missing “-S .”.

Apply:

-    - name: Configure and Build for RISC-V
-      if: steps.cache-build.outputs.cache-hit != 'true'
-      run: |
-        mkdir -p build
-        cmake -G Ninja -B build cmake -B build \
+    - name: Configure and Build for RISC-V
+      run: |
+        cmake -G Ninja -S . -B build \
           -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
           -DUNIVRSL_BUILD_CI=ON \
           -DCMAKE_SYSTEM_NAME=Linux \
           -DCMAKE_SYSTEM_PROCESSOR=riscv64 \
           -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc \
           -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++ \
           -DCMAKE_FIND_ROOT_PATH=/usr/riscv64-linux-gnu \
           -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
           -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
           -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
           -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY \
           -DCMAKE_CROSSCOMPILING_EMULATOR="qemu-riscv64-static;-L;/usr/riscv64-linux-gnu" \
           -DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++"
         cmake --build build --config ${{ env.BUILD_TYPE }}
🧹 Nitpick comments (4)
.github/workflows/riscv-tests.yml (4)

61-65: CTesting looks good; add config and env for clearer logs.

Small tweaks improve clarity and parity with cmake.yml.

Apply:

-    - name: Run tests
-      run: |
-        cd build
-        ctest --parallel $(nproc) --output-on-failure
+    - name: Run tests
+      env:
+        CTEST_OUTPUT_ON_FAILURE: "1"
+      run: |
+        cd build
+        ctest -C ${{ env.BUILD_TYPE }} --parallel "$(nproc)" --output-on-failure

13-17: Add concurrency group to avoid duplicate runs per ref.

Prevents overlapping jobs on force-pushes.

Apply:

   riscv-tests:
     runs-on: ubuntu-latest
     timeout-minutes: 45
+    concurrency:
+      group: riscv-${{ github.ref }}
+      cancel-in-progress: true

35-40: Harden apt usage for CI determinism.

Use apt-get, update, and noninteractive to reduce flakes.

Apply:

-    - name: Setup runtime dependencies and RISC-V toolchain
-      run: |
-        sudo apt update
-        sudo apt install -y --no-install-recommends qemu-user-static libc6-dev-riscv64-cross libstdc++6-riscv64-cross \
-          libgcc-s1-riscv64-cross cmake ninja-build gcc-riscv64-linux-gnu g++-riscv64-linux-gnu
+    - name: Setup runtime dependencies and RISC-V toolchain
+      env:
+        DEBIAN_FRONTEND: noninteractive
+      run: |
+        sudo apt-get update
+        sudo apt-get install -y --no-install-recommends \
+          qemu-user-static libc6-dev-riscv64-cross libstdc++6-riscv64-cross libgcc-s1-riscv64-cross \
+          cmake ninja-build gcc-riscv64-linux-gnu g++-riscv64-linux-gnu

21-34: Consider stronger cache keying and lighter-weight caches.

CMake build dirs are brittle to cache; prefer ccache or key on toolchain/runner to avoid ABI mismatches.

Example:

  • Include runner OS version and compiler versions in key:
    • key: ${{ runner.os }}-${{ runner.arch }}-${{ steps.versions.outputs.gcc }}-${{ steps.cache-key.outputs.key }}
  • Or switch to ccache:
    • install ccache and add -DCMAKE_CXX_COMPILER_LAUNCHER=ccache; cache ~/.cache/ccache.

I can draft the steps if you want them in this PR.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 510937e and 527599d.

📒 Files selected for processing (2)
  • .github/workflows/cmake.yml (2 hunks)
  • .github/workflows/riscv-tests.yml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (1)
.github/workflows/cmake.yml (1)

5-5: Confirm reduced push triggers to main only.

If you rely on push CI for feature branches (beyond PR CI), this change will stop those runs. Verify branch protection rules and workflows relying on push status.

@Ravenwater Ravenwater self-assigned this Aug 29, 2025
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.

2 participants