Skip to content

Commit

Permalink
Added GitHub workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Anderson Ignacio da Silva <[email protected]>
  • Loading branch information
aignacio committed Oct 25, 2024
1 parent 2da0003 commit 7f6045c
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
max-line-length = 80
select = C,E,F,W,B,B950
extend-ignore = E203, E501, E704, F401, W503
100 changes: 100 additions & 0 deletions .github/workflows/run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Lint > Tests > Publish

on:
push:
branches:
- master
- 'stable/**'
pull_request:
branches:
- master
- 'stable/**'

jobs:
lint:
runs-on: ubuntu-22.04

strategy:
matrix:
python-version:
- 3.9
- '3.10'
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install nox
run: pip install --upgrade nox

- name: Run nox tests
run: nox -s "lint-${{ matrix.python-version }}"

tests:
runs-on: ubuntu-22.04
needs: lint
if: |
always() &&
(needs.lint.result == 'success')
strategy:
matrix:
python-version:
- 3.7
- 3.8
- 3.9
- '3.10'
- '3.11'
- '3.12'
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Install Icarus and its requirements
run: |
sudo apt update
sudo apt-get install build-essential libboost-dev iverilog verilator
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install nox
run: pip install --upgrade nox

- name: Run nox tests
run: nox -s "run-${{ matrix.python-version }}"

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
needs: tests
if: |
always() &&
(needs.tests.result == 'success')
steps:
- uses: actions/checkout@master
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Install deps
run: >-
pip install cocotb wavedrom
- name: Install pypa/setuptools
run: >-
python -m
pip install wheel
- name: Build a binary wheel
run: >-
python setup.py sdist bdist_wheel
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1.9
with:
password: ${{ secrets.PYPI_API_TOKEN }}
1 change: 0 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def run(session):
"cocotb>=1.8.0",
"cocotbext-ahb>=0.4.4",
)
#session.install("-e", ".")
session.install(".")
session.run(
"pytest",
Expand Down
2 changes: 1 addition & 1 deletion tests/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class cfg:
EXTRA_ENV = {}
EXTRA_ENV["COCOTB_HDL_TIMEPRECISION"] = os.getenv("TIMEPREC")
EXTRA_ENV["COCOTB_HDL_TIMEUNIT"] = os.getenv("TIMEUNIT")
TIMESCALE = (os.getenv("TIMEUNIT"),os.getenv("TIMEPREC"))
TIMESCALE = (os.getenv("TIMEUNIT"), os.getenv("TIMEPREC"))

if SIMULATOR == "verilator":
EXTRA_ARGS = [
Expand Down
12 changes: 7 additions & 5 deletions tests/test_gen_ahb_waves.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,17 @@ async def setup_dut(dut, cycles):
async def run_test(dut, bp_fn=None, pip_mode=False):
N = 10

if bp_fn == None:
if bp_fn is None:
bp_name = "no_bp_default"
elif bp_fn.__name__ == "slave_back_pressure_generator":
bp_name = "w_bp"
elif bp_fn.__name__ == "slave_no_back_pressure_generator":
bp_name = "no_bp"
pip_name = "w_pip" if pip_mode else "wo_pip"

waves = waveform(clk=dut.hclk, name="ahb_test_"+bp_name+"_"+pip_name, debug=True)
waves = waveform(
clk=dut.hclk, name="ahb_test_" + bp_name + "_" + pip_name, debug=True
)
waves.add_signal(
[
dut.hsel,
Expand Down Expand Up @@ -89,10 +91,10 @@ async def run_test(dut, bp_fn=None, pip_mode=False):
value = [rnd_val(32) for _ in range(N)]
size = [random.choice([1, 2, 4]) for _ in range(N)]

resp = await ahb_master.write(address, value, pip=pip_mode, verbose=True)
resp = await ahb_master.read(address, pip=pip_mode, verbose=True)

resp = await ahb_master.write(address, value, size, pip=pip_mode, verbose=True)
resp = await ahb_master.read(address, size, pip=pip_mode, verbose=True)
waves.save()
type(resp)
del waves


Expand Down

0 comments on commit 7f6045c

Please sign in to comment.