Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/riscv-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: RISC-V Tests

on:
push:
branches: [ main, riscv-tests ]
pull_request:
branches: [ main ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
riscv-tests:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Generate cache key
id: cache-key
run: |
echo "key=riscv-tests-${{ hashFiles('**/*.cpp', '**/*.h', '**/*.c', '**/CMakeLists.txt') }}" >> $GITHUB_OUTPUT

- 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.


- name: Setup runtime dependencies
run: |
sudo apt update
sudo apt install -y qemu-user-static libc6-dev-riscv64-cross libstdc++6-riscv64-cross libgcc-s1-riscv64-cross parallel

- name: Setup RISC-V build toolchain
if: steps.cache-build.outputs.cache-hit != 'true'
run: |
sudo apt install -y cmake ninja-build gcc-riscv64-linux-gnu g++-riscv64-linux-gnu

- 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 \
-DCMAKE_BUILD_TYPE=Release \
-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_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++"
cmake --build build --config Release

- name: Run tests (parallel)
run: |
cd build
parallel --halt now,fail=1 qemu-riscv64-static -L /usr/riscv64-linux-gnu/ ::: $(find ./static -type f -executable -printf '%p ')

- name: Upload test logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-logs
path: |
${{github.workspace}}/build/Testing
${{github.workspace}}/build/CMakeCache.txt
${{github.workspace}}/build/CMakeFiles/CMakeOutput.log
${{github.workspace}}/build/CMakeFiles/CMakeError.log
Loading