From 412545ad783118e565709268e9a49d2269a7288f Mon Sep 17 00:00:00 2001 From: Colin Marquardt Date: Fri, 1 Mar 2024 18:03:37 +0100 Subject: [PATCH] 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. --- .github/workflows/tests.yml | 23 +++++++++++++---------- noxfile.py | 5 +++-- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b37f6973..96b7e537 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,13 +1,11 @@ # 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 @@ -23,7 +21,7 @@ jobs: if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository - name: ${{ matrix.extra_name }}${{ matrix.sim }} (${{ matrix.sim-version }}) | ${{ matrix.os }} | Python ${{ matrix.python-version }} ${{ matrix.may_fail && '| May Fail' || '' }} + 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 }} @@ -32,15 +30,18 @@ jobs: fail-fast: false matrix: python-version: ["3.6", "3.12"] + # NOTE: align with versions in noxfile.py: + cocotb-version: ["1.6.0", "1.8.1"] include: - sim: icarus sim-version: apt - # python-version: "3.6" lang: verilog os: ubuntu-20.04 + timeout-minutes: 10 + steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install cocotb requirements @@ -48,7 +49,7 @@ jobs: DEBIAN_FRONTEND: noninteractive run: | sudo apt-get update - sudo apt-get install --yes g++ make + sudo apt-get install --yes --no-install-recommends g++ make - name: Set up Icarus (apt) if: matrix.sim == 'icarus' && matrix.sim-version == 'apt' env: @@ -57,8 +58,10 @@ jobs: 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 + env: + COCOTB_ANSI_OUTPUT: 1 continue-on-error: ${{ matrix.may_fail || false }} run: | - nox -e tests + nox --session "tests(cocotb='${{ matrix.cocotb-version }}')" diff --git a/noxfile.py b/noxfile.py index 32ded7f0..7b660d5e 100644 --- a/noxfile.py +++ b/noxfile.py @@ -2,8 +2,9 @@ @nox.session -def tests(session): - session.install("pytest", "coverage") +@nox.parametrize("cocotb", ["1.6.0", "1.8.1"]) +def tests(session, cocotb): + session.install("pytest", "coverage", f"cocotb=={cocotb}") session.install(".") session.run("make", external=True)