ci: add ci to run tests #15
Workflow file for this run
This file contains 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: | |
branches: | |
- master | |
pull_request: | |
types: [opened, synchronize] | |
jobs: | |
verilator-test: | |
runs-on: ubuntu-latest | |
env: | |
VERILATOR_VERSION: v5.024 | |
VERILATOR_INSTALL: /opt/verilator | |
steps: | |
- name: Cache Verilator | |
id: cache-verilator | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.VERILATOR_INSTALL }} | |
key: verilator-${{ env.VERILATOR_VERSION }}-${{ runner.os }} | |
- name: Build Verilator | |
if: steps.cache-verilator.outputs.cache-hit != 'true' | |
run: | | |
# Install dependecies | |
sudo apt-get update | |
sudo apt-get install -y git help2man perl python3 make autoconf g++ flex bison ccache libfl2 libfl-dev | |
# Clone Verilator and checkout version | |
git clone https://github.com/verilator/verilator.git | |
cd verilator | |
git checkout ${{ env.VERILATOR_VERSION }} | |
# Build Verilator | |
autoconf | |
./configure --prefix ${{ env.VERILATOR_INSTALL }} | |
make -j$(nproc) | |
sudo make install | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Run tests | |
run: | | |
echo "${{ env.VERILATOR_INSTALL }}/bin" >> $GITHUB_PATH | |
echo "${{ github.workspace }}/contrib/svunit/bin" >> $GITHUB_PATH | |
make -C tests | |
- name: Parse test results | |
uses: mikepenz/action-junit-report@v4 | |
if: always() | |
with: | |
report_paths: '**tests/work/tests.xml' | |
require_tests: true |