Skip to content

Commit

Permalink
Merge pull request #55 from PyFPGA/ci-win
Browse files Browse the repository at this point in the history
CI: add to verify on Windows
  • Loading branch information
rodrigomelo9 authored Sep 7, 2024
2 parents 48af8b2 + 8c061c1 commit e3fadf9
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 39 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,29 @@ jobs:
test:
strategy:
matrix:
os: ['ubuntu']
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:
python-version: ${{ matrix.pyver }}
- name: Install dependencies
run: pip install . && pip install pytest
- name: Run tests
run: source tests/mocks/source-me.sh && make test
run: |
make test
cd examples/projects && bash regress.sh --notool
16 changes: 11 additions & 5 deletions examples/projects/diamond.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
Expand Down Expand Up @@ -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
16 changes: 11 additions & 5 deletions examples/projects/ise.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
Expand Down Expand Up @@ -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
16 changes: 11 additions & 5 deletions examples/projects/libero.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
Expand Down Expand Up @@ -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
16 changes: 11 additions & 5 deletions examples/projects/openflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
Expand Down Expand Up @@ -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
16 changes: 11 additions & 5 deletions examples/projects/quartus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
Expand Down Expand Up @@ -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
25 changes: 23 additions & 2 deletions examples/projects/regress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
16 changes: 11 additions & 5 deletions examples/projects/vivado.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit e3fadf9

Please sign in to comment.