Skip to content

Fix clang-format pre-commit error from #1437 (#1454) #777

Fix clang-format pre-commit error from #1437 (#1454)

Fix clang-format pre-commit error from #1437 (#1454) #777

Workflow file for this run

name: CI
on: [push, pull_request, workflow_dispatch, merge_group]
jobs:
build:
name: "Build and test model (OS: ${{ matrix.os }}, CMake Version: ${{ matrix.cmake_version }})"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-24.04-arm, macos-latest]
cmake_version: ["3.20.0", "4.1.2"]
include:
- os: ubuntu-22.04
cmake_version: "4.1.2"
run_all_steps: true
steps:
- name: Check out repository code
uses: actions/checkout@v6
with:
# Git history is needed for `git describe` in the build to work.
fetch-depth: 0
- name: Common setup
uses: ./.github/actions/sail-setup
with:
cmake-version: "${{ matrix.cmake_version }}"
- name: Ensure pre-commit checks pass
if: ${{ matrix.run_all_steps}}
run: python3 -m pip install pre-commit && pre-commit run --all-files --show-diff-on-failure --color=always
- name: Build simulators
run: |
# Ninja is used because the CMake Makefile generator doesn't
# build top-level targets in parallel unfortunately.
cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DFIRST_PARTY_TESTS=TRUE -DENABLE_RISCV_TESTS=TRUE -DENABLE_RISCV_VECTOR_TESTS_V128_E32=TRUE
ninja -C build all generated_sail_riscv_docs generated_smt_rv64d generated_smt_rv32d
- name: Run tests
run: |
ctest --test-dir build --output-junit tests.xml --output-on-failure
- name: Upload test results
if: ${{ matrix.run_all_steps}}
uses: actions/upload-artifact@v6
with:
name: tests.xml
path: build/tests.xml
if-no-files-found: error
- name: Upload event payload
if: ${{ matrix.run_all_steps}}
uses: actions/upload-artifact@v6
with:
name: event.json
path: ${{ github.event_path }}
linux:
name: "Linux boot"
runs-on: ubuntu-latest
steps:
- name: Install packages
run: sudo apt-get install -y --no-install-recommends device-tree-compiler
- name: Check out repository code
uses: actions/checkout@v6
- name: Common setup
uses: ./.github/actions/sail-setup
- name: Build simulator
run: |
cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo
ninja -C build
- name: Restore cache (linux image)
uses: actions/cache/restore@v5
id: linux-cache-restore
with:
path: os-boot/linux/build/fw_payload.elf
key: linux-image-${{ hashFiles('os-boot/linux/*.url', 'os-boot/linux/Makefile') }}
- name: Build Linux image
if: steps.linux-cache-restore.outputs.cache-hit != 'true'
run: make -C os-boot/linux --jobs=$(nproc)
- name: Cache Linux image
# Update cache only on the master branch
if: steps.linux-cache-restore.outputs.cache-hit != 'true' && github.ref == 'refs/heads/master'
uses: actions/cache/save@v5
with:
path: os-boot/linux/build/fw_payload.elf
key: ${{ steps.linux-cache-restore.outputs.cache-primary-key }}
- name: Linux boot
run: |
make -C os-boot/linux build/sail.dtb
# The Makefile target to boot Linux on the simulator cannot be used with caching in CI due to the dependency chain
./build/c_emulator/sail_riscv_sim --show-times --inst-limit 20000000 --device-tree-blob os-boot/linux/build/sail.dtb os-boot/linux/build/fw_payload.elf 2>&1 | tee linux-boot.log
grep "Initmem setup node" linux-boot.log
grep "Instructions: 20000000" linux-boot.log
# This is here so that the "Status checks that are required" Github
# option doesn't need to list all of the matrix jobs (it doesn't seem
# to work if you just specify the job ID of the matrix itself).
ci_pass:
runs-on: ubuntu-latest
needs: [build, linux]
steps:
- name: Dummy
run: echo 'Jobs need at least one step.'