-
Notifications
You must be signed in to change notification settings - Fork 46
77 lines (68 loc) · 3.47 KB
/
python-package-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# 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
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.7 ] # 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-report xml --cov=pymtl3 .. --ignore=../pymtl3/passes/backends/yosys --tb=short --hypothesis-profile CI
pytest --cov-report xml --cov=pymtl3 --cov-append ../pymtl3/passes/backends/yosys --tb=short --hypothesis-profile CI
- name: Upload code coverage report
run: |
codecov