Skip to content

Commit

Permalink
Brush up CI (#75)
Browse files Browse the repository at this point in the history
Make CI setup work again

Do not run CI on both push and PR.
Use latest version of actions.
Iterate over oldest and newest supported Python versions.
Iterate over oldest and newest supported cocotb versions.
Use color output for cocotb tests.
  • Loading branch information
cmarqu authored Jul 17, 2024
1 parent 5264d59 commit 0c99b54
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 26 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pypi-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ jobs:
runs-on: ubuntu-latest
name: deploy
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
with:
# To generate a valid version number setuptools_scm needs sufficient
# git history.
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.9"
python-version: "3.12"
- name: Install pypa/build
run: >-
python -m
Expand Down
46 changes: 29 additions & 17 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,62 @@
# Copyright cocotb contributors
# Licensed under the Revised BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-3-Clause

name: Tests

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

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
tests:
name: ${{matrix.extra_name}}${{matrix.sim}} (${{matrix.sim-version}}) | ${{matrix.os}} | Python ${{matrix.python-version}} ${{matrix.may_fail && '| May Fail' || ''}}
runs-on: ${{matrix.os}}
name: ${{ matrix.extra_name }}cocotb ${{matrix.cocotb-version }} | ${{ matrix.sim }} (${{ matrix.sim-version }}) | ${{ matrix.os }} | Python ${{ matrix.python-version }} ${{ matrix.may_fail && '| May Fail' || '' }}
runs-on: ${{ matrix.os }}
env:
SIM: ${{matrix.sim}}
TOPLEVEL_LANG: ${{matrix.lang}}
SIM: ${{ matrix.sim }}
TOPLEVEL_LANG: ${{ matrix.lang }}
strategy:
fail-fast: false
matrix:
python-version: ["3.6", "3.12"]
# NOTE: align with versions in noxfile.py:
cocotb-version: ["1.6.0", "1.9.0"]
include:
- sim: icarus
sim-version: apt
lang: verilog
python-version: 3.6
os: ubuntu-20.04
timeout-minutes: 10

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{matrix.python-version}}
python-version: ${{ matrix.python-version }}
- name: Install cocotb requirements
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt install -y g++ make
sudo apt-get update
sudo apt-get install --yes --no-install-recommends g++ make
- name: Set up Icarus (apt)
if: matrix.sim == 'icarus' && matrix.sim-version == 'apt'
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt install -y iverilog
sudo apt-get install --yes --no-install-recommends iverilog
- name: Install testing requirements
run: |
pip install nox
python -m pip install nox
- name: Run tests
continue-on-error: ${{matrix.may_fail || false}}
env:
COCOTB_ANSI_OUTPUT: 1
continue-on-error: ${{ matrix.may_fail || false }}
run: |
nox -e tests
nox --session "tests(cocotb='${{ matrix.cocotb-version }}')"
5 changes: 3 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@


@nox.session
def tests(session):
session.install("pytest", "coverage")
@nox.parametrize("cocotb", ["1.6.0", "1.9.0"])
def tests(session, cocotb):
session.install("pytest", "coverage", f"cocotb=={cocotb}")
session.install(".")
session.run("make", external=True)

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def get_version(version_file):
packages=find_packages("src"),
package_dir={"": "src"},
install_requires=[
"cocotb>=1.5.0.dev,<2.0",
"cocotb>=1.6.0,<2.0",
"scapy",
],
python_requires='>=3.5'
python_requires='>=3.6'
)
5 changes: 3 additions & 2 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
###############################################################################

# Do not fail on DeprecationWarning caused by virtualenv, which might come from
# the distutils or site modules.
export PYTHONWARNINGS = error,ignore::DeprecationWarning:distutils,ignore::DeprecationWarning:site
# the site module.
# Do not fail on DeprecationWarning caused by attrs dropping 3.6 support
export PYTHONWARNINGS = error,ignore::DeprecationWarning:site,always::FutureWarning:cocotb.scheduler,ignore::DeprecationWarning:attr

REGRESSIONS := $(shell ls test_cases/)

Expand Down

0 comments on commit 0c99b54

Please sign in to comment.