From 9aa363f3b3b23d89d7947f5c228bed9b287e8173 Mon Sep 17 00:00:00 2001 From: "Rodrigo A. Melo" Date: Mon, 2 Sep 2024 23:51:08 -0300 Subject: [PATCH 1/5] ci: add windows tests --- .github/workflows/test.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 40699986..0b33ba57 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,7 @@ on: push: jobs: - test: + test-lin: strategy: matrix: os: ['ubuntu'] @@ -25,3 +25,20 @@ jobs: run: pip install . && pip install pytest - name: Run tests run: source tests/mocks/source-me.sh && make test + test-win: + runs-on: windows-latest + name: windows | 3.12 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: 3.12 + - name: Install dependencies + run: pip install . && pip install pytest + - name: Run tests + run: make test From 6dc528a4e724b398fd734cabf7c420fd66b3280e Mon Sep 17 00:00:00 2001 From: "Rodrigo A. Melo" Date: Mon, 2 Sep 2024 23:59:09 -0300 Subject: [PATCH 2/5] ci: add to run regress.sh --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0b33ba57..d45d0543 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,7 +24,9 @@ jobs: - name: Install dependencies run: pip install . && pip install pytest - name: Run tests - run: source tests/mocks/source-me.sh && make test + run: | + source tests/mocks/source-me.sh && make test + cd examples/projects && bash regress.sh test-win: runs-on: windows-latest name: windows | 3.12 From fcd51f6e5c1ea741d10a956292a5de3ac90f48b2 Mon Sep 17 00:00:00 2001 From: "Rodrigo A. Melo" Date: Wed, 4 Sep 2024 20:25:17 -0300 Subject: [PATCH 3/5] ci: modified to run ubuntu and windows tests using the same job --- .github/workflows/test.yml | 39 ++++++++++++++------------------------ tests/test_tools.py | 4 ++-- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d45d0543..12e54f2c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,19 +4,25 @@ on: push: jobs: - test-lin: + test: strategy: matrix: - os: ['ubuntu'] - pyver: ['3.8', '3.9', '3.10', '3.11', '3.12'] + os: [ubuntu, windows] + pyver: [3.8, 3.9, 3.10, 3.11, 3.12] + exclude: + - os: windows + pyver: 3.8 + - os: windows + pyver: 3.9 + - os: windows + pyver: 3.10 + - os: windows + pyver: 3.11 runs-on: ${{ matrix.os }}-latest name: ${{ matrix.os }} | ${{ matrix.pyver }} steps: - name: Checkout repository uses: actions/checkout@v4 - with: - submodules: true - fetch-depth: 0 - name: Set up Python ${{ matrix.pyver }} uses: actions/setup-python@v5 with: @@ -25,22 +31,5 @@ jobs: run: pip install . && pip install pytest - name: Run tests run: | - source tests/mocks/source-me.sh && make test - cd examples/projects && bash regress.sh - test-win: - runs-on: windows-latest - name: windows | 3.12 - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - submodules: true - fetch-depth: 0 - - name: Set up Python 3.12 - uses: actions/setup-python@v5 - with: - python-version: 3.12 - - name: Install dependencies - run: pip install . && pip install pytest - - name: Run tests - run: make test + make test + cd examples/projects && bash regress.sh --notool diff --git a/tests/test_tools.py b/tests/test_tools.py index ad28632a..98f00055 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -85,9 +85,9 @@ def generate(tool, part): prj.add_hook('postbit', 'HOOK16') try: prj.make() - except Exception: + except RuntimeError: pass try: prj.prog() - except Exception: + except RuntimeError: pass From 1a0ff918b0f63b58c52193aeed798f78aa4c7c00 Mon Sep 17 00:00:00 2001 From: "Rodrigo A. Melo" Date: Sat, 7 Sep 2024 14:22:48 -0300 Subject: [PATCH 4/5] Add the --notool option, to avoid errors when tools are not available --- examples/projects/diamond.py | 16 +++++++++++----- examples/projects/ise.py | 16 +++++++++++----- examples/projects/libero.py | 16 +++++++++++----- examples/projects/openflow.py | 16 +++++++++++----- examples/projects/quartus.py | 16 +++++++++++----- examples/projects/regress.sh | 25 +++++++++++++++++++++++-- examples/projects/vivado.py | 16 +++++++++++----- 7 files changed, 89 insertions(+), 32 deletions(-) diff --git a/examples/projects/diamond.py b/examples/projects/diamond.py index 0128d7c3..464be7ff 100644 --- a/examples/projects/diamond.py +++ b/examples/projects/diamond.py @@ -15,6 +15,9 @@ parser.add_argument( '--action', choices=['make', 'prog', 'all'], default='make' ) +parser.add_argument( + '--notool', action='store_true' +) args = parser.parse_args() prj = Diamond(odir=f'results/diamond/{args.source}/{args.board}') @@ -43,8 +46,11 @@ prj.set_top('Top') -if args.action in ['make', 'all']: - prj.make() - -if args.action in ['prog', 'all']: - prj.prog() +try: + if args.action in ['make', 'all']: + prj.make() + if args.action in ['prog', 'all']: + prj.prog() +except RuntimeError: + if not args.notool: + raise diff --git a/examples/projects/ise.py b/examples/projects/ise.py index 279a5db0..1955d34d 100644 --- a/examples/projects/ise.py +++ b/examples/projects/ise.py @@ -15,6 +15,9 @@ parser.add_argument( '--action', choices=['make', 'prog', 'all'], default='make' ) +parser.add_argument( + '--notool', action='store_true' +) args = parser.parse_args() prj = Ise(odir=f'results/ise/{args.source}/{args.board}') @@ -45,8 +48,11 @@ prj.set_top('Top') -if args.action in ['make', 'all']: - prj.make() - -if args.action in ['prog', 'all']: - prj.prog() +try: + if args.action in ['make', 'all']: + prj.make() + if args.action in ['prog', 'all']: + prj.prog() +except RuntimeError: + if not args.notool: + raise diff --git a/examples/projects/libero.py b/examples/projects/libero.py index dd2c5861..8bb94b7a 100644 --- a/examples/projects/libero.py +++ b/examples/projects/libero.py @@ -14,6 +14,9 @@ parser.add_argument( '--action', choices=['make', 'prog', 'all'], default='make' ) +parser.add_argument( + '--notool', action='store_true' +) args = parser.parse_args() prj = Libero(odir=f'results/libero/{args.source}/{args.board}') @@ -43,8 +46,11 @@ prj.set_top('Top') -if args.action in ['make', 'all']: - prj.make() - -if args.action in ['prog', 'all']: - prj.prog() +try: + if args.action in ['make', 'all']: + prj.make() + if args.action in ['prog', 'all']: + prj.prog() +except RuntimeError: + if not args.notool: + raise diff --git a/examples/projects/openflow.py b/examples/projects/openflow.py index 56a6b2ab..98e2e999 100644 --- a/examples/projects/openflow.py +++ b/examples/projects/openflow.py @@ -16,6 +16,9 @@ parser.add_argument( '--action', choices=['make', 'prog', 'all'], default='make' ) +parser.add_argument( + '--notool', action='store_true' +) args = parser.parse_args() prj = Openflow(odir=f'results/openflow/{args.source}/{args.board}') @@ -59,8 +62,11 @@ prj.set_top('Top') -if args.action in ['make', 'all']: - prj.make() - -if args.action in ['prog', 'all']: - prj.prog() +try: + if args.action in ['make', 'all']: + prj.make() + if args.action in ['prog', 'all']: + prj.prog() +except RuntimeError: + if not args.notool: + raise diff --git a/examples/projects/quartus.py b/examples/projects/quartus.py index eb7e889e..258fa8e6 100644 --- a/examples/projects/quartus.py +++ b/examples/projects/quartus.py @@ -15,6 +15,9 @@ parser.add_argument( '--action', choices=['make', 'prog', 'all'], default='make' ) +parser.add_argument( + '--notool', action='store_true' +) args = parser.parse_args() prj = Quartus(odir=f'results/quartus/{args.source}/{args.board}') @@ -44,8 +47,11 @@ prj.set_top('Top') -if args.action in ['make', 'all']: - prj.make() - -if args.action in ['prog', 'all']: - prj.prog() +try: + if args.action in ['make', 'all']: + prj.make() + if args.action in ['prog', 'all']: + prj.prog() +except RuntimeError: + if not args.notool: + raise diff --git a/examples/projects/regress.sh b/examples/projects/regress.sh index 45b7d848..a260b52e 100644 --- a/examples/projects/regress.sh +++ b/examples/projects/regress.sh @@ -13,7 +13,24 @@ TOOLS["vivado"]="zybo arty" SOURCES=("vlog" "vhdl" "slog") -SPECIFIED_TOOL=$1 +SPECIFIED_TOOL="" +NOTOOL=false +while [[ "$#" -gt 0 ]]; do + case $1 in + --tool) + SPECIFIED_TOOL="$2" + shift 2 + ;; + --notool) + NOTOOL=true + shift + ;; + *) + echo "Invalid option: $1" + exit 1 + ;; + esac +done for TOOL in "${!TOOLS[@]}"; do if [[ -n "$SPECIFIED_TOOL" && "$TOOL" != "$SPECIFIED_TOOL" ]]; then @@ -26,7 +43,11 @@ for TOOL in "${!TOOLS[@]}"; do continue fi echo "> $TOOL - $BOARD - $SOURCE" - python3 $TOOL.py --board $BOARD --source $SOURCE + if [[ "$NOTOOL" == true ]]; then + python3 $TOOL.py --board $BOARD --source $SOURCE --notool + else + python3 $TOOL.py --board $BOARD --source $SOURCE + fi done done done diff --git a/examples/projects/vivado.py b/examples/projects/vivado.py index af497b91..33fba3f3 100644 --- a/examples/projects/vivado.py +++ b/examples/projects/vivado.py @@ -15,6 +15,9 @@ parser.add_argument( '--action', choices=['make', 'prog', 'all'], default='make' ) +parser.add_argument( + '--notool', action='store_true' +) args = parser.parse_args() prj = Vivado(odir=f'results/vivado/{args.source}/{args.board}') @@ -50,8 +53,11 @@ prj.set_top('Top') -if args.action in ['make', 'all']: - prj.make() - -if args.action in ['prog', 'all']: - prj.prog() +try: + if args.action in ['make', 'all']: + prj.make() + if args.action in ['prog', 'all']: + prj.prog() +except RuntimeError: + if not args.notool: + raise From 8c061c1fe94672806b2f5efabdee92573234f4c9 Mon Sep 17 00:00:00 2001 From: "Rodrigo A. Melo" Date: Sat, 7 Sep 2024 14:27:55 -0300 Subject: [PATCH 5/5] ci: fix issue specifyng the Python version --- .github/workflows/test.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 12e54f2c..076ec499 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,17 +7,17 @@ jobs: test: strategy: matrix: - os: [ubuntu, windows] - pyver: [3.8, 3.9, 3.10, 3.11, 3.12] + os: ['ubuntu', 'windows'] + pyver: ['3.8', '3.9', '3.10', '3.11', '3.12'] exclude: - - os: windows - pyver: 3.8 - - os: windows - pyver: 3.9 - - os: windows - pyver: 3.10 - - os: windows - pyver: 3.11 + - os: 'windows' + pyver: '3.8' + - os: 'windows' + pyver: '3.9' + - os: 'windows' + pyver: '3.10' + - os: 'windows' + pyver: '3.11' runs-on: ${{ matrix.os }}-latest name: ${{ matrix.os }} | ${{ matrix.pyver }} steps: