CI #3312
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, macos-latest] | |
cmake_version: ["3.20", latest] | |
include: | |
- os: ubuntu-22.04 | |
cmake_version: latest | |
run_all_steps: true | |
env: | |
SAIL_VERSION: "0.19.1" | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Install packages (Linux) | |
if: startsWith(matrix.os, 'ubuntu-') | |
run: | | |
sudo apt install -y --no-install-recommends pkg-config libgmp-dev curl ninja-build jq | |
- name: Install packages (macOS) | |
if: startsWith(matrix.os, 'macos-') | |
run: | | |
brew install opam llvm lld | |
echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH | |
- name: Install CMake | |
uses: jwlawson/actions-setup-cmake@v2 | |
with: | |
cmake-version: "${{ matrix.cmake_version }}" | |
- name: Install Sail (Linux) | |
if: startsWith(matrix.os, 'ubuntu-') | |
run: | | |
sudo mkdir -p /usr/local | |
curl --location https://github.com/rems-project/sail/releases/download/$SAIL_VERSION-linux-binary/sail.tar.gz | sudo tar xvz --directory=/usr/local --strip-components=1 | |
- name: Install Sail (macOS) | |
if: startsWith(matrix.os, 'macos-') | |
run: | | |
opam init --auto-setup --bare | |
opam switch create default 5.3.0 | |
eval $(opam env) | |
opam update | |
opam install -y sail.$SAIL_VERSION | |
- name: Load OPAM environment (macOS) | |
if: startsWith(matrix.os, 'macos-' ) | |
run: echo "$HOME/.opam/default/bin" >> $GITHUB_PATH | |
- 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 and test 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 | |
# By default only the rv32d and rv64d emulators are built, | |
# but we want to build more targets here to ensure they | |
# can at least build without errors. | |
ninja -C build all riscv_sim_rv32f riscv_sim_rv64f generated_smt_rv64f generated_docs_rv64d | |
# These targets do not work with Sail 0.18: generated_rmem_rv32d_rmem generated_coq_rv64f_coq | |
ctest --test-dir build --output-junit tests.xml --output-on-failure | |
- name: Upload test results | |
if: ${{ matrix.run_all_steps}} | |
uses: actions/upload-artifact@v4 | |
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@v4 | |
with: | |
name: event.json | |
path: ${{ github.event_path }} | |
# 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] | |
steps: | |
- name: Dummy | |
run: echo 'Jobs need at least one step.' |