Skip to content

Commit

Permalink
Add nonregression validation on push and pull-requests in the CI
Browse files Browse the repository at this point in the history
  • Loading branch information
cfuguet authored Oct 27, 2024
1 parent 7aa4c82 commit 04b8984
Show file tree
Hide file tree
Showing 6 changed files with 416 additions and 1 deletion.
51 changes: 51 additions & 0 deletions .github/scripts/env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash -x
##
# Copyright 2023,2024 Cesar Fuguet
#
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
#
# Licensed under the Solderpad Hardware License v 2.1 (the “License”); you
# may not use this file except in compliance with the License, or, at your
# option, the Apache License version 2.0. You may obtain a copy of the
# License at
#
# https://solderpad.org/licenses/SHL-2.1/
#
# Unless required by applicable law or agreed to in writing, any work
# distributed under the License is distributed on an “AS IS” BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
##
##
# Author : Cesar Fuguet
# Date : October, 2024
# Description: Environment setup for the HPDcache's Github CI
##
export WORK_DIR=${PWD}
export BUILD_DIR=${WORK_DIR}/build
export ARCHIVE_DIR=${WORK_DIR}/archive
export PARALLEL_JOBS=7

mkdir -p ${ARCHIVE_DIR} ${BUILD_DIR} ;

# SystemC env variables
export SYSTEMC_URL=https://github.com/accellera-official/systemc/archive/refs/tags
export SYSTEMC_VER=3.0.1
export SYSTEMC_HOME=${BUILD_DIR}/systemc-${SYSTEMC_VER}
export SYSTEMC_INCLUDE=${BUILD_DIR}/systemc-${SYSTEMC_VER}/include
export SYSTEMC_LIBDIR=${BUILD_DIR}/systemc-${SYSTEMC_VER}/lib-linux64

# SystemC Verification library env variables
export SCV_URL=https://www.accellera.org/images/downloads/standards/systemc
export SCV_VER=2.0.1
export SCV_HOME=${BUILD_DIR}/scv-${SCV_VER}

# Verilator env variables
export VERILATOR_URL=https://github.com/verilator/verilator
export VERILATOR_VER=v5.028
export VERILATOR_ROOT=${BUILD_DIR}/verilator-${VERILATOR_VER}

if [[ ! "${PATH}" =~ ".*${VERILATOR_ROOT}/bin.*" ]] ; then
export PATH=${VERILATOR_ROOT}/bin:${PATH}
fi
32 changes: 32 additions & 0 deletions .github/scripts/install_deps_ubuntu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
##
# Copyright 2023,2024 Cesar Fuguet
#
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
#
# Licensed under the Solderpad Hardware License v 2.1 (the “License”); you
# may not use this file except in compliance with the License, or, at your
# option, the Apache License version 2.0. You may obtain a copy of the
# License at
#
# https://solderpad.org/licenses/SHL-2.1/
#
# Unless required by applicable law or agreed to in writing, any work
# distributed under the License is distributed on an “AS IS” BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
##
##
# Author : Cesar Fuguet
# Date : October, 2024
# Description: Install dependencies for the HPDcache's Github CI
##
# Update list of packages
sudo apt-get update ;

# Install essential packages
sudo apt-get install -y build-essential python3 git wget file ;

# Install Verilator dependencies
sudo apt-get install -y ccache mold numactl help2man make autoconf flex libfl-dev bison ;
120 changes: 120 additions & 0 deletions .github/scripts/install_systemc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#!/bin/bash -x
##
# Copyright 2023,2024 Cesar Fuguet
#
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
#
# Licensed under the Solderpad Hardware License v 2.1 (the “License”); you
# may not use this file except in compliance with the License, or, at your
# option, the Apache License version 2.0. You may obtain a copy of the
# License at
#
# https://solderpad.org/licenses/SHL-2.1/
#
# Unless required by applicable law or agreed to in writing, any work
# distributed under the License is distributed on an “AS IS” BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
##
##
# Author : Cesar Fuguet
# Date : October, 2024
# Description: SystemC installation script
##
num_jobs=${PARALLEL_JOBS:-1} ;

# Install SystemC
if [[ "x${SYSTEMC_HOME}" == "x" ]] ; then
echo "SYSTEMC_HOME env variable not defined" ;
exit 1 ;
fi

systemc_installed="no"
if [[ -e ${SYSTEMC_HOME}/lib-linux64/libsystemc.la ]] ; then
echo "SystemC is already installed" ;
systemc_installed="yes" ;
fi

if [[ "x${SYSTEMC_VER}" == "x" ]] ; then
echo "SYSTEMC_VER env variable not defined" ;
exit 1 ;
fi

if [[ "x${SYSTEMC_URL}" == "x" ]] ; then
echo "SYSTEMC_URL env variable not defined" ;
exit 1 ;
fi

# get SystemC
if [[ ${systemc_installed} == "no" ]] ; then
(
wget -O ${ARCHIVE_DIR}/${SYSTEMC_VER}.tar.gz \
${SYSTEMC_URL}/${SYSTEMC_VER}.tar.gz ;
tar xzf ${ARCHIVE_DIR}/${SYSTEMC_VER}.tar.gz ;
mv -f systemc-${SYSTEMC_VER} ${SYSTEMC_HOME} ;

# configure and build SystemC
mkdir -p ${SYSTEMC_HOME}/objdir ;
cd ${SYSTEMC_HOME}/objdir ;
../configure ;
[[ $? != 0 ]] && exit 1 ;

make -j${num_jobs} ;
[[ $? != 0 ]] && exit 1 ;

make install ;
[[ $? != 0 ]] && exit 1 ;

# housekeeping
rm -rf ${SYSTEMC_HOME}/objdir ;
)
fi

# Install SCV

if [[ "x${SCV_HOME}" == "x" ]] ; then
echo "SCV_HOME env variable not defined" ;
exit 1 ;
fi

scv_installed="no"
if [[ -e ${SYSTEMC_HOME}/lib-linux64/libscv.la ]] ; then
echo "SystemC Verification library is already installed" ;
scv_installed="yes" ;
fi

if [[ "x${SCV_VER}" == "x" ]] ; then
echo "SCV_VER env variable not defined" ;
exit 1 ;
fi

if [[ "x${SCV_URL}" == "x" ]] ; then
echo "SCV_URL env variable not defined" ;
exit 1 ;
fi

if [[ ${scv_installed} == "no" ]] ; then
(
# get SCV
wget -O ${ARCHIVE_DIR}/scv-${SCV_VER}.tar.gz \
${SCV_URL}/scv-${SCV_VER}.tar.gz ;
tar xzf ${ARCHIVE_DIR}/scv-${SCV_VER}.tar.gz ;
mv -f scv-${SCV_VER} ${SCV_HOME} ;

# configure and build SCV
mkdir -p ${SCV_HOME}/objdir ;
cd ${SCV_HOME}/objdir ;
../configure --with-systemc=${SYSTEMC_HOME} ;
[[ $? != 0 ]] && exit 1 ;

make -j${num_jobs} ;
[[ $? != 0 ]] && exit 1 ;

make install ;
[[ $? != 0 ]] && exit 1 ;

# housekeeping
rm -rf ${SCV_HOME}/objdir ;
)
fi
66 changes: 66 additions & 0 deletions .github/scripts/install_verilator.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash
##
# Copyright 2023,2024 Cesar Fuguet
#
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
#
# Licensed under the Solderpad Hardware License v 2.1 (the “License”); you
# may not use this file except in compliance with the License, or, at your
# option, the Apache License version 2.0. You may obtain a copy of the
# License at
#
# https://solderpad.org/licenses/SHL-2.1/
#
# Unless required by applicable law or agreed to in writing, any work
# distributed under the License is distributed on an “AS IS” BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
##
##
# Author : Cesar Fuguet
# Date : October, 2024
# Description: Verilator installation script
##
num_jobs=${PARALLEL_JOBS:-1} ;

if [[ "x${VERILATOR_ROOT}" == "x" ]] ; then
echo "VERILATOR_ROOT env variable not defined" ;
exit 1 ;
fi

verilator_installed="no"
if [[ -d ${VERILATOR_ROOT} ]] ; then
echo "Verilator is already installed" ;
verilator_installed="yes"
fi

if [[ "x${VERILATOR_VER}" == "x" ]] ; then
echo "VERILATOR_VER env variable not defined" ;
exit 1 ;
fi

if [[ "x${VERILATOR_URL}" == "x" ]] ; then
echo "VERILATOR_URL env variable not defined" ;
exit 1 ;
fi

if [[ ${verilator_installed} == "no" ]]; then
(
# clone Verilator repository
git clone -b ${VERILATOR_VER} ${VERILATOR_URL} ${VERILATOR_ROOT} ;

# configure and build Verilator in-place
cd ${VERILATOR_ROOT} ;
autoconf ;
./configure ;
[[ $? != 0 ]] && exit 1 ;

make -j${num_jobs} ;
[[ $? != 0 ]] && exit 1 ;

# housekeeping
rm -rf ${VERILATOR_ROOT}/src/obj_dbg ;
rm -rf ${VERILATOR_ROOT}/src/obj_opt ;
)
fi
Loading

0 comments on commit 04b8984

Please sign in to comment.