Skip to content

Commit

Permalink
ci: rework ci script
Browse files Browse the repository at this point in the history
  • Loading branch information
esynr3z committed May 15, 2024
1 parent 18bb4e4 commit f37d54e
Showing 1 changed file with 22 additions and 28 deletions.
50 changes: 22 additions & 28 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,51 @@ on:
types: [opened, synchronize]

jobs:
build-and-test:
verilator-test:
runs-on: ubuntu-latest

env:
VERILATOR_VERSION: "v5.024"
VERILATOR_VERSION: v5.024
VERILATOR_INSTALL: /opt/verilator

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Cache Verilator build
- name: Cache Verilator
id: cache-verilator
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/verilator_bin
key: verilator-${{ env.VERILATOR_VERSION }}
restore-keys: verilator-
path: ${{ env.VERILATOR_INSTALL }}
key: verilator-${{ env.VERILATOR_VERSION }}-${{ runner.os }}

- name: Install dependencies and build Verilator
- 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
./configure --prefix ${{ env.VERILATOR_INSTALL }}
make -j$(nproc)
sudo make install
# Cache the built Verilator
mkdir -p ~/verilator_bin
cp /usr/local/bin/verilator* ~/verilator_bin
- name: Use cached Verilator if available
if: steps.cache-verilator.outputs.cache-hit == 'true'
run: |
sudo cp ~/verilator_bin/* /usr/local/bin/
- name: Change to tests directory
run: cd tests
- name: Checkout source code
uses: actions/checkout@v4

- name: Run tests
run: make
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@v2
uses: mikepenz/action-junit-report@v4
if: always()
with:
report_paths: '**/tests.xml'

- name: Fail CI if tests fail
if: failure()
run: exit 1
require_tests: true

0 comments on commit f37d54e

Please sign in to comment.