Skip to content

PyMTL 4.0 release staging #111

PyMTL 4.0 release staging

PyMTL 4.0 release staging #111

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
# The latest ubuntu release may exclude Python versions that have reached
# the end of life. An example of this is the upgrade from ubuntu-20.04 to
# ubuntu-22.04: support for Python 3.6.* and 3.7.* has been dropped and
# this broke our Github actions. We should periodically revisit this to
# make sure PyMTL works on the latest ubuntu LTS release. As of now I'm
# targeting ubuntu-20.04 because lots of PyMTL users still work with
# Python 3.6 and 3.7.
# runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: [ 3.6, 3.7, 3.8, 3.9 ] # FIXME github recognizes 3.10 as 3.1 lol
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Verilator
run: |
wget https://github.com/cornell-brg/verilator-travisci-cache/raw/master/verilator-github-actions-5.016.tar.gz
tar -C ${HOME} -xzf verilator-github-actions-5.016.tar.gz
# We need to create a symlink to verilator/share/verilator/include.
# This is because the Verilator binaries are compiled on an EC2
# instance, and that the executable contains hard-coded paths which can
# only be bypassed by defining $VERILATOR_ROOT. See a similar issue at:
# https://github.com/verilator/verilator/issues/4035
# But when $VERILATOR_ROOT is present, Verilator assumes a different
# directory hierarchy by looking into $VERILATOR_ROOT/include, which is
# different from verilator/share/verilator/include. Verilator devs have
# mentioned this will be annoying to fix and I don't quite understand
# why; my current workaround is to symlink the correct include
# directory into the place Verilator is looking at.
ln -s ${HOME}/verilator/share/verilator/include ${HOME}/verilator/include
echo "VERILATOR_ROOT=${HOME}/verilator" >> $GITHUB_ENV
echo "PYMTL_VERILATOR_INCLUDE_DIR=${HOME}/verilator/share/verilator/include" >> $GITHUB_ENV
echo "${HOME}/verilator/bin" >> $GITHUB_PATH
- name: Check Verilator
run: |
echo ${VERILATOR_ROOT}
ls ${VERILATOR_ROOT}/include
echo ${PYMTL_VERILATOR_INCLUDE_DIR}
verilator --version
- name: Install dependencies
run: |
sudo apt-get install -y graphviz
pip install --upgrade pip
pip install --requirement requirements/CI.txt
pip install .
- name: Test with pytest
run: |
mkdir -p build && cd build
# Run all unit tests under pymtl3 directory except for those in the
# yosys backend (we run yosys tests in the second run). This is
# necessary to avoid using the same component name for different
# shared libraries (Verilog and Yosys backend translation result).
pytest --cov-config=../.coveragerc --cov-report xml --cov=pymtl3 \
../pymtl3 --ignore=../pymtl3/passes/backends/yosys --tb=short \
--hypothesis-profile CI
pytest --cov-config=../.coveragerc --cov-report xml --cov=pymtl3 --cov-append \
../pymtl3/passes/backends/yosys --tb=short \
--hypothesis-profile CI
- name: Upload code coverage report
run: |
codecov